// Fix many bug with stock

This commit is contained in:
rGaillard
2012-06-21 10:41:11 +00:00
parent 4543a10b3a
commit 21939edce0
+8 -3
View File
@@ -409,7 +409,7 @@ class StockAvailableCore extends ObjectModel
$context = Context::getContext(); $context = Context::getContext();
// if there is no $id_shop, gets the context one // if there is no $id_shop, gets the context one
if ($id_shop === null) if ($id_shop === null && Shop::getContext() != Shop::CONTEXT_GROUP)
$id_shop = (int)$context->shop->id; $id_shop = (int)$context->shop->id;
$depends_on_stock = StockAvailable::dependsOnStock($id_product); $depends_on_stock = StockAvailable::dependsOnStock($id_product);
@@ -574,8 +574,13 @@ class StockAvailableCore extends ObjectModel
// get shop group too // get shop group too
if ($id_shop === null) if ($id_shop === null)
{ {
$id_shop = $context->shop->id; if (Shop::getContext() == Shop::CONTEXT_GROUP)
$shop_group = $context->shop->getGroup(); $shop_group = Shop::getContextShopGroup();
else
{
$shop_group = $context->shop->getGroup();
$id_shop = $context->shop->id;
}
} }
else else
{ {