Get, Set and Unset Session In Magento

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:

Set Session In Magento:


Get session testing_magento

$test = Mage::getSingleton('core/session')->getTestingMagento();

Unset Session In Magento


(You can use customer or core session in frontend. Use adminhtml session in the backend.)

Core Session In Magento


Customer Session In Magento:


Admin Session In Magento:


Hope this will be helpful, Thanks and Enjoy the Magento Custom Coding.