If you see the file then you will get below code which has done cookies setting for magento. So we just have access all the variable and function declared in this function.If you will have a little look then you can understand better.
The cookies will available for the domain www.domainName.com
Set Expire Time:
So till now we just have declared some variable.Now we have to use the function.Suppose I want set the name of user in cookies so lets see how it works.
Set Cookie Value:
here cookie name is ‘user_name’ and its value is ‘jyotiranjan’
Get Cookie value:
Delete Cookie Value:
In server side magento do by using php.For setting,getting and deleting cookies by using php in magento we have to call cookie model the we will set out desire parameters.So I am using all the example that I have used in client side section.
So for doing In magento set get delete cookie has different functions lets starts one by one by using different examples.
My variable that I have used for references.
$name = ‘user_name’;//cookie name
$value = ‘jyotiranjan’;//cookie value
$period = 3600;//lifetime of cookie in sec
$path = ‘/’;//path or page for cookies existance
$domain = ‘.domainName.com’;//cookies domain.It can also be availabe for subdomain
$secure = true;//cookie is used for secure areas using SSH/HTTPS(boolean: true/false)
$httponly = true;//cookies can only retrived through http protocol(boolean: true/false)
Set cookie value:
Get cookie value:
Delete cookie value:
Hope you enjoyed the article Magento get set delete cookie.So please don’t forget to share or like.