diff --git a/classes/Cart.php b/classes/Cart.php index db1e6b5a9..c5c27bd62 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -150,7 +150,10 @@ class CartCore extends ObjectModel parent::__construct($id, $id_lang); if ($this->id_customer) { - $customer = new Customer((int)$this->id_customer); + if (isset(Context::getContext()->customer) && Context::getContext()->customer->id == $this->id_customer) + $customer = Context::getContext()->customer; + else + $customer = new Customer((int)$this->id_customer); $this->_taxCalculationMethod = Group::getPriceDisplayMethod((int)$customer->id_default_group); if ((!$this->secure_key || $this->secure_key == '-1') && $customer->secure_key) diff --git a/classes/Product.php b/classes/Product.php index 93ea878aa..cb1944a1f 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -2216,8 +2216,9 @@ class ProductCore extends ObjectModel die(Tools::displayError()); // Initializations $id_group = (isset($context->customer) ? $context->customer->id_default_group : _PS_DEFAULT_CUSTOMER_GROUP_); - //var_dump($id_group); - if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart)) + + // If there is cart in context or if the specified id_cart is different from the context cart id + if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart && $cur_cart->id != $id_cart)) { /* * When a user (e.g., guest, customer, Google...) is on PrestaShop, he has already its cart as the global (see /init.php)