Tuesday, July 14, 2015

get and set cookie in Magento

Method 1:

$TestCookie = Mage::getModel('core/cookie')->get('TestCookie');
Mage::getModel('core/cookie')->set('TestCookie', 'My Value', 3600);

Method 2:

$cookie = Mage::getSingleton('core/cookie');
$cookie->get('TestCookie');
$cookie->set('TestCookie', 'My Value', 3600);

No comments: