kalle@makewebo Posted April 4, 2017 Share Posted April 4, 2017 (edited) Hi! So we have two shops that are on the same domain. www.domain.com (Shop 1) and www.domain.com/shop (Shop 2). What we want is that when you logout from shop 2 that you also are logged out from shop 1 and vice versa. We got login to work, but logout seems impossible. It works fine on our local environment with both login and logout. Since everything is on the same domain I just can't understand why the cookies won't be cleared. So we have a module that is hooked to hookActionAuthentication (login) and hookActionCustomerLogoutAfter (logout) and one Configuration value holding the shop id of the opposite shop. This is our code: public function hookActionAuthentication($params) { $cookie = new Cookie('ps-s' . Configuration::get('OPPOSITE_SHOP')); $shop = new Shop(Configuration::get('OPPOSITE_SHOP')); $cookie->__set('id_compare', $this->context->cookie->id_compare); $cookie->__set('id_customer', $this->context->cookie->id_customer); $cookie->__set('customer_lastname', $this->context->cookie->customer_lastname); $cookie->__set('customer_firstname', $this->context->cookie->customer_firstname); $cookie->__set('logged', 1); $cookie->__set('is_guest', $this->context->cookie->is_quest); $cookie->__set('passwd', $this->context->cookie->passwd); $cookie->__set('email', $this->context->cookie->email); $cookie->setPath($shop->getUrls()[0]['physical_uri']); $cookie->write(); } public function hookActionCustomerLogoutAfter($params) { $cookie = new Cookie('ps-s' . Configuration::get('OPPOSITE_SHOP')); $shop = new Shop(Configuration::get('OPPOSITE_SHOP')); setcookie($cookie->getName(), '', 1); setcookie($cookie->getName(), '', 1, '/'); setcookie($cookie->getName(), '', 1, $shop->getUrls()[0]['physical_uri']); } So what am I missing? I just can't understand why the cookies won't be cleared. The physical_uri for both shops is '/' (needed to unset it for local development). Even tried other php scripts for clearing cookies, which clears them locally but doesn't logout on opposite shop. So what kind of [spam-filter] does Prestashop do with my cookies? Kind Regards Kalle Edited April 4, 2017 by kalle@makewebo (see edit history) 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