Home » Magento » Magento Customization : Certain Helpful PHP Functions

Magento Customization : Certain Helpful PHP Functions

Sometimes while building magento stores we come across custom codes that could be improved. It lets online merchants manage their stores effectively and efficiently. Magento has revolutionized the way online stores are created.
Here are several PHP uses that can raise your online store based on magento cart —
• String ucwords:
For you ucfirst might not great enough? Try this, take advantage of all WORDS
Custom: reflexion ucwords, my brand new product
Supplies: Brand New Product
• count($this) –
Counts the listing of an arrangement. Utilize this!
Custom: $myarray = arrangement
reflexion count($myarray);
Supplies: 4
• ucfirst String–
it capitalizes that first character ucfirst is an impressive function!
Custom: reflexion ucfirst;
Supplies: Product
• ($find, $replace, $fromthis) str_replace–
str_replace is very helpful, you can regenerate anything you like , Normally exercise it to take away definite unwanted from instrumented strings. for over $180 million, ‘magento’, webbo design’,‘e-commerce , ‘ebay bought magento!’
Custom: reflexion str_replace;
Supplies:ebay bought e-commerce webbo design for over $180 million!
• ($string, $findthis) stristr –
Try this one. To know if a string contains another string?
Custom: if Contains somethings,this sentence
demonstration “it is really here”;
} other {
reflexion “activity and a miss!”;
}
Supplies: it is actually here
• ($string) strtolower –Custom: reflexion strtolower();
Supplies: what a bloody mess this sentence is.
• in_arrangement ($value, $arraylist) –
with this you’ll find out! want to know is in an arrangement?
Custom: if(in_arrangement(“that”, arrangement.
reflexion “on spot ”;
} other {
}
Supplies: on spot
• Date ( $timestamp,$format,) –
You can format it any way you like! from a time, sort a date string
Custom: $mytime = strtotime(“21st Jan 2012″);
reflexion date($mytime,“d-m-Y”);
Supplies: 21-01-2012
• is_definite quantity($this) –
if what you’ve given it is a number or not a great little use that will let you know it.
Custom:if(is_definite quantity(“24 hours”)){
reflexion “damn right!”;
} other {
reflexion “you can not count?”;
}
Supplies: you can not count
• $_SERVER –
OK this isn’t a function but it’s well worth sticking in here – try the following out – it’s one of many!
Custom: note it down!
demonstration: you could even work on a live site with this going on!“This is going to only show for you”;
} other {
reflexion “we running this, Go home – let’s go”;
}Supplies: Go home