If you are working with the custom Magento development/Extension Development then It’s very important to know regarding the session in Magento, In this post I am trying to cover Get Session, Set Session and Unset Session In Magento.
Suppose you want to set a custom session with Variable Name ‘testing_magento’. The session value here is ‘EWA’ then the syntax will be:
Suppose you want to set a custom session with Variable Name ‘testing_magento’. The session value here is ‘EWA’ then the syntax will be:
Set Session In Magento:
Mage::getSingleton('core/session')->setTestingMagento('EWA');
Get session testing_magento
$test = Mage::getSingleton('core/session')->getTestingMagento();
Unset Session In Magento
Mage::getSingleton('core/session')->setTestingMagento();
(You can use customer or core session in frontend. Use adminhtml session in the backend.)
Core Session In Magento
Mage::getSingleton('core/session');
Customer Session In Magento:
Mage::getSingleton('customer/session');
Admin Session In Magento:
Mage::getSingleton('adminhtml/session');
Hope this will be helpful, Thanks and Enjoy the Magento Custom Coding
(Visited 107 times, 1 visits today)