How to set, retrieve and unset the session variables in magento

Hello Friends, You can find the code here to set, retrieve and unset Session Variables in magento.

To set a Magento session variable:
$myValue = 'Hello World';
Mage::getSingleton('core/session')->setMyValue($myValue);
To Retrieve a magento session variable which is already set:
$myValue=Mage::getSingleton('core/session')->getMyValue();
To Unset:
Mage::getSingleton('core/session')->unsMyValue();
Note: ‘MyValue’ can be any text you want but ‘set’, ‘get’ and ‘uns’ prefixes are required. Thanks,
Pritesh Pritesh

Pritesh Pethani

Request a Quote!!

Share your concept and we will return to you within 24 hours. Let us work out the best software solution for you!

Let's Start
Whatspp