Commit 097fb536 authored by Shudrum's avatar Shudrum

[-] BO Fix #PSCSX-4209 : Wrong combination generator stocks

parent a1319d30
......@@ -130,7 +130,16 @@ class AdminAttributeGeneratorControllerCore extends AdminController
$attributes = Product::getProductAttributesIds($this->product->id, true);
$quantity = (int)Tools::getValue('quantity');
foreach ($attributes as $attribute)
StockAvailable::setQuantity($this->product->id, $attribute['id_product_attribute'], $quantity);
if (Shop::getContext() == Shop::CONTEXT_ALL)
{
$shops_list = Shop::getShops();
if (is_array($shops_list))
foreach ($shops_list as $current_shop)
if (isset($current_shop['id_shop']) && (int)$current_shop['id_shop'] > 0)
StockAvailable::setQuantity($this->product->id, (int)$attribute['id_product_attribute'], $quantity, (int)$current_shop['id_shop']);
}
else
StockAvailable::setQuantity($this->product->id, (int)$attribute['id_product_attribute'], $quantity);
}
else
StockAvailable::synchronize($this->product->id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment