Magento: How to save session data in Magento

Thursday, 28. July 2011

If you have ever wondered, this is how you can easily save data in Magento session

# Initiate session object
$session = Mage::getSingleton("core/session",  array("name"=>"your_session_name"));
#set the actual data:
$session->setData("state_id", 454);
# Access your session data:
$state_id = $session->getData("state_id");

Leave a Reply

You must be logged in to post a comment.