sabreen22 Posted April 13, 2016 Share Posted April 13, 2016 Hi I need in my website to avoid removing products from the cart if user make logout .. I searched a lot about it but i didn't find any module make that .... if there isn't feature in prestashop make that how to make that from the code ... and thanks in advance Link to comment Share on other sites More sharing options...
NemoPS Posted April 13, 2016 Share Posted April 13, 2016 The problem is that once you logout, the cart will still have the id_customer of your previous session, and since the logged out one is 0, it can't be loaded. I don't think there is a simple way, unless you want to try changing the user if only here public function logout() { $this->_content = array(); $this->_setcookie(); unset($_COOKIE[$this->_name]); $this->_modified = true; } 1 Link to comment Share on other sites More sharing options...
sabreen22 Posted April 13, 2016 Author Share Posted April 13, 2016 First thanks to reply but this function in which page please ? and where can i find the code that free cart when i make logout Link to comment Share on other sites More sharing options...
NemoPS Posted April 13, 2016 Share Posted April 13, 2016 This will work on all pages. THe file is classes/Cookie.phpAll of that empties the cart, as it empties the current cookie. You will have to be php savvy to make the modification, as you need to unset user variables and keep the cart only 1 Link to comment Share on other sites More sharing options...
sabreen22 Posted April 13, 2016 Author Share Posted April 13, 2016 Thanks Mr prestashop Legend you made my day I've solved the issue by enter page classes/cooki.php and commnet this line unset($this->_content['id_cart']); 1 Link to comment Share on other sites More sharing options...
bartom34 Posted December 15, 2016 Share Posted December 15, 2016 Hi Guys, I did an override on Cookie.php and commented the above line as you mentionned. Unfortunately, it does seems to work... class Cookie extends CookieCore { /** * Delete cookie * As of version 1.5 don't call this function, use Customer::logout() or Employee::logout() instead; */ public function logout() { $this->_content = array(); $this->_setcookie(); // unset($_COOKIE[$this->_name]); $this->_modified = true; } } Any iddea to fix that ? Link to comment Share on other sites More sharing options...
NemoPS Posted December 16, 2016 Share Posted December 16, 2016 Are you sure the override is working? Delete the class_index.php file just in case, cache folder Link to comment Share on other sites More sharing options...
bartom34 Posted December 16, 2016 Share Posted December 16, 2016 Are you sure the override is working? Delete the class_index.php file just in case, cache folder Is there a reason why it should not work? The path is : /override/classes/Cookie.php and the content is what I have pasted above. Link to comment Share on other sites More sharing options...
NemoPS Posted December 17, 2016 Share Posted December 17, 2016 There might, so clear the class index. If you just created it it won't work otherwise. Also, if you cleared it, try to add die('test'); and see if the script dies. Link to comment Share on other sites More sharing options...
bartom34 Posted December 19, 2016 Share Posted December 19, 2016 There might, so clear the class index. If you just created it it won't work otherwise. Also, if you cleared it, try to add die('test'); and see if the script dies. Hi NemoPS, I deleted cache_index but it does not seem to work. I just added the die('test') in my Cookie.php file and nothing happen when I tried to lot out. I guess the override class is not called? Link to comment Share on other sites More sharing options...
bartom34 Posted December 19, 2016 Share Posted December 19, 2016 New feedback: the die('test') script just started when I wanted to log in to the PS backoffice! Link to comment Share on other sites More sharing options...
NemoPS Posted December 19, 2016 Share Posted December 19, 2016 Wait, did you see this?As of version 1.5 don't call this function, use Customer::logout() or Employee::logout() instead; Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now