Home / Magento / How to set, get & delete Session on Magento 1x

How to set, get & delete Session on Magento 1x

1.  Magento 1x Set a new session: Here is the example of it.
Mage::getSingleton(‘core/session’)->set{YOUR SESSION NAME}({SESSION VALUE});
Example :
$Value =’test’;

*** if you use phtml/controller/model of magento 1x there you can use Mage:: function if you use a single file on root of you magento site then you need to add some functionality for call Mage::. Learn more by here.

$Value ='test';

2.  Magento 1x Get Data from session:
Mage::getSingleton(‘core/session’)->get {YOUR SESSION NAME}();

$getSession =Mage::getSingleton('core/session')->getName();

3.  Magento 1x Delete session:
Mage::getSingleton(‘core/session’)->uns{YOUR SESSION NAME}();


Hits: 93

%d bloggers like this: