Magento set, get and unset session variables.
Magento session variable once is set, it can be used on any page. The examples below set, get and unset a varialbe Greeting, but any variable name would work.
Set a session variable, Greeting is the variable name, the prefix set is need to set this variable.
Mage::getSingleton('core/session')->setGreeting("hey how are you!");
Retrieve the session variable Greeting using the get prefix.
Mage::getSingleton('core/session')->getGreeting();
Unset the session variable Greeting using the uns prefix.
Mage::getSingleton('core/session')->unsGreeting();
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts