From d66074cdfcc6cde0f45a2aeb3eac61960ed800f2 Mon Sep 17 00:00:00 2001 From: mBertholino Date: Mon, 19 Dec 2011 13:20:15 +0000 Subject: [PATCH] // improve config.inc.php code, add in cookie id_cart if there's a current order in a different shop that shares orders git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11355 b9a71923-0436-4b27-9f14-aed3839534dd --- config/config.inc.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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