I am describing here a way to generate coupon codes with custom configurable parameters. Hope this is helpful.
Tag: Variables
Variables in programming
Random String Generator
Below is a simple script to generate random string/password using PHP. You can customize the same by adding special characters. Hope this is helpful.
Custom Email Templates in Magento
Hello, I am explaining here the method for sending custom emails using the custom email templates with variables. 1) Create an email template from Admin-end > System > Transactional Emails, for example lets put this as Template Content 2) Suppose the id of the template created is 3 3) Below code you can write in […]
Useful code in Magento
I am listing here the codes useful in Magento
Passing by Reference
I am listing here a simple example to explain ‘passing by reference’ in PHP. I hope it is helpful. For further information kindly visit Passing by Reference
Reading XML
I am listing here method for reading XML file or XML string with the help of PHP. The output on executing above code will be: I am listing here another example: The output on executing above code will be: For further reference click here
Get Product ID and Product Name in Magento
In Magento eCommerce while working with catalog model, There arise the need to fetch product details from product id. We can get all product details if we have product id. But sometimes we only have product name, so we need to get product id for getting product details. I am listing here both the method. […]
Extracting String
This is small but very useful script. I have shown example for extracting only ‘src’ value from the ‘img’ tag, but you can modify and use as per your requirement using ‘preg_match_all’ function. Output will be ‘http://www.somesite.com/abc.jpg’
Page Redirect
I have written a script for getting the files list from directory and redirecting the page on selecting option from the select box. So you will get the script for fetching all the files from current directory and redirecting page on selection.
Get IP Address in PHP
Many times we need the IP Address of the User visiting our website in our Application. I am listing here the method to get the User IP Address, hope it might be useful to many of you.