Back to Top

How to use session in Magento

session in Magento

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:

To get a Magento session variable value:

To unset a Magento session variable:

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)

  1. Mage::getSingleton(‘core/session’)->setYourVariableName(‘value here’);

    Suppose we have some value say $name then i can save that value in session in magento in the following way.
    Mage::getSingleton(‘core/session’)->setYourVariableName($name);
    //YourVariableName is session variable name that we will also use to retrieve session value

    To retrieve variable value of session in magento use the below code.

    Mage::getSingleton(‘core/session’)->getYourVariableName();

    More details can be found at http://blogswindow.com/session-in-magento

Leave a Reply

Your email address will not be published. Required fields are marked *

Most Popular Posts

Overview of ECMAScript 6 new Features

Updated 18 years ago

Bhumi

Getting started with Amazon Web Services

Updated 18 years ago

Bhumi

Facade implementation in Laravel

Updated 18 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 2 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 3 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 4 years ago

Bhumi