In this quick article we will see how we can deal with Session variable in Magento. Here dealing include set new variable, get value of existing variable and deleting existing variable.
Here I will take as example of saving email id in Magento session.
$email = '[email protected]';
// Set value in session
$email = '';
$email = Mage::getSingleton('core/session')->getEmailID();
In above three example you must be thinking that from where function name like setEmailID, getEmailID and unsEmailID are initialized? But that is the magic of PHP Magic Methods.
In Above example you will find that EmailID, you can use anything you want for that. It will be treated as key of your session variable, important part is set, get and uns. Those are responsible to set, get and unset the session variables in Magento.
Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.
View all posts by: Avinash