Wednesday, 3 July 2013

Magento: Get and set variables in session

This code that will set / add your custom data into session.
Mage::getSingleton('core/session')->setMyCustomData('demo');

This code for retrieve the session variable


$session = Mage::getSingleton('core/session', array('name' => 'frontend'));
echo $session->getMyCustomData();

No comments:

Post a Comment

Thanks for your comments.