0

I have set the array in magento session in one of the template file using following code

 Mage::getSingleton('core/session')->setData('filterarray',$filtercatarray);

I'm getting correct value in same template file but when i'm calling same session using following code in another template file i'm getting old session values.

$session = Mage::getSingleton("core/session",  array("name"=>"frontend"));
$catarray = $session->getData('filterarray');

When i'm refreshing the page i'm getting update session value. why i'm not getting update value in first call in another template file?

6
  • What is the serial in which these files are called ?
    – Prateek
    Commented Feb 29, 2016 at 6:45
  • @Prateek what do you mean by serial? Commented Feb 29, 2016 at 6:47
  • might be issue with session name. use $session = Mage::getSingleton("core/session"); without session name. Commented Feb 29, 2016 at 7:37
  • I meant whether file having setting of session data is called prior to the file which is trying to retrieve it ?
    – Prateek
    Commented Feb 29, 2016 at 9:23
  • @Prateek yes session is setting prior to the file. and i'm retrieving it on product list.phtml Commented Feb 29, 2016 at 9:27

1 Answer 1

0

Clear session value below code may be help you

 $session = Mage::getSingleton("core/session",  array("name"=>"frontend"));
    $catarray = $session->getData('filterarray');
    Mage::getSingleton('core/session')->unsData();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.