how to set get and unset custom session variable value in Magento.

In magento we can set session ,get session and unset session custom session variable value in magento.

1
2
3
4
5
6
7
8
9
10
11
12
<?php
 
// For Set custom session in Magento
$setSessionVariable =  Mage::getSingleton('core/session')->setYoursessionname('you session value');
 
// For Get custom session in Magento
echo $getSessionVariable =  Mage::getSingleton('core/session')->getYoursessionname();
 
// For Unset custom session value in Magento
  Mage::getSingleton('core/session')->unsYoursessionname();
 
 ?>

Leave a Reply