Magento Set, Retrieve and Unset Session Variables
Posted: April 20th, 2011 | Author: jriggs | Filed under: magento | 4 Comments »To set a Magento session variable:
$myValue = 'Hello World'; Mage::getSingleton('core/session')->setMyValue($myValue);
To Retrieve:
$myValue = ''; $myValue=Mage::getSingleton('core/session')->getMyValue();
To Unset:
Mage::getSingleton('core/session')->unsMyValue();
Note that ‘MyValue’ can be any text you want but ‘set’, ‘get’ and ‘uns’ prefixes are required.
Related posts:







I enjoyed this! Well done!
Got it! Thanks a lot again for hleipng me out!
This wasn’t actually that helpful. At this point in the game I have a good handle on magic methods. But how do I mess with a session that’s not the one I’m currently in? I’m working with a swf and that doesn’t count as the same session apparently.
Great..dude…thanks..