开发者

magento cookies not working

开发者 https://www.devze.com 2023-03-09 20:27 出处:网络
I\'m using $id = \'WelcomeWindow\'; $data = \'1\'; $time = time()+60*60*24*30; Mage::getModel(\'core/cookie\')-&开发者_JAVA百科gt;set($id, $data, $time);

I'm using

$id = 'WelcomeWindow';
$data = '1';
$time = time()+60*60*24*30;
Mage::getModel('core/cookie')-&开发者_JAVA百科gt;set($id, $data, $time);

And to get the cookie back

$data_from_cookie = Mage::getModel('core/cookie')->get('WelcomeWindow');

This kind of works but - when getting the cookie it doesn't show the value untill I refersh the Magento Cache within the admin area, is there a way around this?


I've sorted it, for some reason I've moved the code to be executed before anything else is delivered to the page, so I placed it at the top of head.phtml and it seems to work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消