After few days,I am back again with my new quick article release. Today we will continue with Magento article series and i am going to explain how you can set, get and unset session into a magento.
It’s pretty simple, just you have to have an idea about it. First time When i wanted to set, i also think once is it difficult but no its quite simple in Magento
Let’s start with understanding it
To set a Magento session variable:
1 2 3 | Mage::getSingleton('core/session')->setVariableName('data'); |
To get a Magento session variable value:
1 2 3 | $Data = Mage::getSingleton('core/session')->getVariableName(); |
To unset a Magento session variable:
1 2 3 | Mage::getSingleton('core/session')->unsVariableName(); |
NOTE: Replace ‘VariableName’ with any desire text you want but ‘set’, ‘get’ and ‘uns’ prefixes are required.
That’s it.Now you have ‘set’, ‘get’ and ‘uns’ your session variables into Magento.
Thanks for reading and feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.
Comments (1)