Merge pull request #1525 from vishal-singh-webkul/gli-standard_product_stock_changes
Fixed: added stock and quantity wise restrictions on standalone service products in the front-office.
This commit is contained in:
@@ -510,6 +510,19 @@ class ProductControllerCore extends FrontController
|
||||
$this->context->smarty->assign('error', Tools::getValue('error'));
|
||||
}
|
||||
} else {
|
||||
if ($this->product->allow_multiple_quantity) {
|
||||
$this->product->cart_quantity = 0;
|
||||
if ($products = $this->context->cart->getProducts()) {
|
||||
$products = array_column($products, 'cart_quantity', 'id_product');
|
||||
if (isset($products[$this->product->id])) {
|
||||
$this->product->cart_quantity = $products[$this->product->id];
|
||||
$this->product->max_quantity -= $products[$this->product->id];
|
||||
if (!$this->product->isAvailableWhenOutOfStock((int) $this->product->out_of_stock)) {
|
||||
$this->product->quantity -= $products[$this->product->id];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assignServiceProductVars();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user