// Added one field in Product object, so one product can be managed independantly from the stock management (advanced) if necessary
This commit is contained in:
@@ -3552,6 +3552,17 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
StockAvailable::setQuantity($product->id, (int)Tools::getValue('id_product_attribute'), (int)Tools::getValue('value'));
|
||||
break;
|
||||
case 'advanced_stock_management' :
|
||||
if (Tools::getValue('value') === false)
|
||||
return Tools::jsonEncode(array('error' => 'Undefined value'));
|
||||
if ((int)Tools::getValue('value') != 1 && (int)Tools::getValue('value') != 0)
|
||||
return Tools::jsonEncode(array('error' => 'Uncorrect value'));
|
||||
$product->advanced_stock_management = (int)Tools::getValue('value');
|
||||
$product->save();
|
||||
if (StockAvailable::dependsOnStock($product->id) == 1 && (int)Tools::getValue('value') == 0)
|
||||
StockAvailable::setProductDependsOnStock($product->id, 0);
|
||||
break;
|
||||
|
||||
}
|
||||
die(Tools::jsonEncode(array('error' => false)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user