From 4336f3777053465121a7ed257d9e91c807dbece3 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 29 Mar 2025 10:20:32 +0530 Subject: [PATCH] Fixed: It shows a notice error when adding a product to the cart if the product selling preference is sell with hotels. --- controllers/front/CartController.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php index 20637aadd..a487803ae 100644 --- a/controllers/front/CartController.php +++ b/controllers/front/CartController.php @@ -500,6 +500,7 @@ class CartControllerCore extends FrontController if ($operator == 'up') { if ($id_hotel) { $objServiceProductCartDetail = new ServiceProductCartDetail(); + $productCartDetail = array(); if ($cartDetail = $objServiceProductCartDetail->getServiceProductsInCart( $id_cart, [$product->selling_preference_type], @@ -518,10 +519,8 @@ class CartControllerCore extends FrontController if ($product->max_quantity && $finalQuantity > $product->max_quantity) { $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $product->max_quantity)); } - } else { - if ($productCartDetail) { - $this->errors[] = Tools::displayError('You can only order one quantity for this product.'); - } + } elseif ($productCartDetail) { + $this->errors[] = Tools::displayError('You can only order one quantity for this product.'); } if (ServiceProductOption::productHasOptions($this->id_product)) { if (!$idProductOption) {