Get magento session variable in another page

后端 未结 1 585
渐次进展
渐次进展 2021-01-13 08:07

I set array variable in session in magento modal page and want to retrieve in another page like getuserdata.php but not get in another page. I set variable and get in one pa

相关标签:
1条回答
  • 2021-01-13 08:53

    If we create a session in Magento, then we can only use that session in Magento files like in the magento/app folder. If you want to use that session in external files create by you then you must first get the session in another Magento default file and then call a jquery ajax function and pass session variable through it to get it in an external file. You also pass the variable through ajax without the use of the session.

    Set session data like this.

    $fldata = 'work for set data';
    Mage::getSingleton('core/session')->setMyCustomData($fldata);
    

    and get data like this.

    session_start();
    $sessionfree = Mage::getSingleton('core/session', array('name' => 'frontend'));
    $abcfree = $sessionfree->getMyCustomData();
    
    0 讨论(0)
提交回复
热议问题