Jump to content

Deleting variable from context cookie


jafakash cp

Recommended Posts

hi,

 

i have created an custom cookie variable like $context->cookie->line = $p_line; . now after completing my functionality i just need to unset this variable from context cookie .  

 

for deleting cookie variable in php  we will do like unset($_COOKIE['mycookiename']); how this method can be apply to above context cookie. Looking forward to prestashop expertise reply.

 

 

Thanks 

Jafakash cp 

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

 

To Set and unset a cookie variable:

$this->context->cookie->__set($key,$value);

$this->context->cookie->__unset($key);

Also useful:

$this->context->cookie->__isset($key);

$this->context->cookie->__get($key); 
OR 
$this->context->cookie->key;

And of course if $this->context is not set yet, first get it with

$context = Context::getContext(); 
OR
$this->context = Context::getContext();

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...