// Fix #PSCFV-4628
This commit is contained in:
@@ -521,6 +521,26 @@ class StockAvailableCore extends ObjectModel
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product))
|
||||
return false;
|
||||
|
||||
if (Shop::getContext() == SHOP::CONTEXT_SHOP)
|
||||
if (Shop::getContextShopGroup()->share_stock == 1)
|
||||
{
|
||||
$pa_sql = '';
|
||||
if ($id_product_attribute !== null)
|
||||
{
|
||||
$pa_sql = '_attribute';
|
||||
$id_product_attribute_sql = $id_product_attribute;
|
||||
}
|
||||
else
|
||||
$id_product_attribute_sql = $id_product;
|
||||
|
||||
if ((int)Db::getInstance()->getValue('SELECT COUNT(*)
|
||||
FROM '._DB_PREFIX_.'product'.$pa_sql.'_shop
|
||||
WHERE id_product'.$pa_sql.'='.(int)$id_product_attribute_sql.'
|
||||
AND id_shop IN ('.implode(',', array_map('intval', Shop::getContextListShopID(SHOP::SHARE_STOCK))).')'))
|
||||
return true;
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'stock_available
|
||||
WHERE id_product = '.(int)$id_product.
|
||||
|
||||
Reference in New Issue
Block a user