// improve config.inc.php code, add in cookie id_cart if there's a current order in a different shop that shares orders

This commit is contained in:
mBertholino
2011-12-19 13:20:15 +00:00
parent 51704646e2
commit c97b48b394
+4 -8
View File
@@ -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