diff --git a/config/config.inc.php b/config/config.inc.php index 8ad97d39d..1d7e58792 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -141,14 +141,10 @@ else if (!isset($cookie->id_cart)) { - $groupShop = new GroupShop(Context::getContext()->shop->id_group_shop); - foreach (Shop::getSharedShops(Context::getContext()->shop->getID(), Shop::SHARE_ORDER) as $k => $v) - { - $cart = new Cart(); - $id_cart = Db::getInstance()->getValue('SELECT `id_cart` FROM `'._DB_PREFIX_.'cart` WHERE `id_customer` = "'.(int)$customer->id.'" ORDER BY `id_cart` DESC'); - if (Db::getInstance()->getValue('SELECT `quantity` FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart` = "'.(int)$id_cart.'"') > 0) - $cookie->id_cart = $id_cart; - } + $shops_share = Context::getContext()->shop->getListOfID(Shop::SHARE_ORDER); + $id_cart = Db::getInstance()->getValue('SELECT `id_cart` FROM `'._DB_PREFIX_.'cart` WHERE `id_customer` = "'.(int)$customer->id.'" AND `id_shop` IN ("'.implode('","', $shops_share).'") ORDER BY `id_cart` DESC'); + if ($id_cart != false) + $cookie->id_cart = $id_cart; } } else