Fixed: added stock wise restrictions on standalone service products

This commit is contained in:
vishalsingh.qlo325
2025-06-20 18:51:06 +05:30
parent bd7bfcfdf5
commit 3da657dbcb
7 changed files with 56 additions and 12 deletions

View File

@@ -496,6 +496,15 @@ class ProductControllerCore extends FrontController
$this->context->smarty->assign('error', Tools::getValue('error'));
}
} else {
if ($this->product->allow_multiple_quantity) {
if ($products = $this->context->cart->getProducts()) {
$products = array_column($products, 'cart_quantity', 'id_product');
if (isset($products[$this->product->id])) {
$this->product->quantity -= $products[$this->product->id];
$this->product->max_quantity -= $products[$this->product->id];
}
}
}
$this->assignServiceProductVars();
}