Magento Session : Set,Get and Unset session value in Magento

Session variable is very important part of any programming language and CMS.Magento also has session variable to set user information and product etc.In This tutorial You will learn how to deal session variable in Magento, in Session you can set variables and get variables and if you do not use session variable further in application then you simply unset existing variable.

Here we are taking example a customer session object where we will set value, Look at the following code.

You can also check other tutorial of magento session,

How to set session value in customer object

setMyValue is used to set value to variable into customer.

How to set session value in core session object

setMyValue is used to set value to variable into session variable.

This piece of code sets the session variable setMyValue to the value of “variable”.

How to get session value from session variable

getMyValue is used to get value from customer session variable.

How to get session value in core session object

getMyValue is used to get value from session variable.

How to unset session value

unsMyValue is used to unset value from customer session variable.

How to unset session value in core session object

unsMyValue is used to unset value from customer session variable.

I hope its help you.