How to create Edit, Delete Cookies in magento

Understanding Magento Cookies and how to manipulate.
<?php    
/**      
* set cookie      
* name and value are mandatory; other parameters are optional and can be set as null      
* $period = cookie expire date in seconds      
*/    
Mage::getModel('core/cookie')--->set($name, $value, $period, $path, $domain, $secure, $httponly);
/**
* get cookie with a specific name
* $name = name of the cookie
*/
Mage::getModel('core/cookie')->get($name);
/**
* get all cookies as an array
*/
Mage::getModel('core/cookie')->get();
/**
* delete/remove cookie
* $name is mandatory; other parameters are optional and can be set to null
*/
Mage::getModel('core/cookie')->delete($name, $path, $domain, $secure, $httponly);
?>

No comments:

Post a Comment