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:
Rohit Jain
2025-06-24 18:12:11 +05:30
committed by GitHub
7 changed files with 66 additions and 12 deletions

View File

@@ -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();
}