From 76f35e5fc5fcc96bb200835e0ea33c5910810e02 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Wed, 29 Apr 2026 15:03:55 +0530 Subject: [PATCH 1/2] Fix double-counted service product totals in multi-hotel cart --- classes/Cart.php | 7 ++++++- .../classes/ServiceProductCartDetail.php | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index f12f41249..ea7d940f7 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1840,7 +1840,12 @@ class CartCore extends ObjectModel null, 0, (int)$product['auto_add_to_cart'], - (int)$product['price_addition_type'] + (int)$product['price_addition_type'], + 0, + 0, + 0, + 0, + isset($product['id_hotel']) ? $product['id_hotel'] : null )) { foreach ($servicesWithRoom as $service) { if ($with_taxes) { diff --git a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php index 25a1edfcb..31cd3920e 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php @@ -157,7 +157,8 @@ class ServiceProductCartDetail extends ObjectModel $groupByProductId = 0, $detailedInfo = 0, $idLang = 0, - $idServiceProductCartDetail = 0 + $idServiceProductCartDetail = 0, + $idRoomTypeHotel = null ) { if ($useTax === null) { $useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true; @@ -207,6 +208,9 @@ class ServiceProductCartDetail extends ObjectModel if (!is_null($idHotel)) { $sql .= ' AND spc.`id_hotel`='.(int) $idHotel; } + if(!is_null($idRoomTypeHotel)) { + $sql .= ' AND hcbd.`id_hotel`='.(int) $idRoomTypeHotel; + } if (!is_null($idProduct)) { $sql .= ' AND spc.`id_product`='.(int) $idProduct; } From 348f9dd6dbd4308be6629548915a5577ffa00404 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Thu, 30 Apr 2026 19:08:02 +0530 Subject: [PATCH 2/2] Remove unnecessary code and fix the incorrect price calculation for multiple hotel bookings. --- classes/Cart.php | 9 ++------- .../classes/ServiceProductCartDetail.php | 6 +----- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index ea7d940f7..ad5ee4302 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1833,19 +1833,14 @@ class CartCore extends ObjectModel $this->id, [], 0, - null, + isset($product['id_hotel_cart_booking']) ? $product['id_hotel_cart_booking'] : null, null, (int)$product['id_product'], null, null, 0, (int)$product['auto_add_to_cart'], - (int)$product['price_addition_type'], - 0, - 0, - 0, - 0, - isset($product['id_hotel']) ? $product['id_hotel'] : null + (int)$product['price_addition_type'] )) { foreach ($servicesWithRoom as $service) { if ($with_taxes) { diff --git a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php index 31cd3920e..25a1edfcb 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php @@ -157,8 +157,7 @@ class ServiceProductCartDetail extends ObjectModel $groupByProductId = 0, $detailedInfo = 0, $idLang = 0, - $idServiceProductCartDetail = 0, - $idRoomTypeHotel = null + $idServiceProductCartDetail = 0 ) { if ($useTax === null) { $useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true; @@ -208,9 +207,6 @@ class ServiceProductCartDetail extends ObjectModel if (!is_null($idHotel)) { $sql .= ' AND spc.`id_hotel`='.(int) $idHotel; } - if(!is_null($idRoomTypeHotel)) { - $sql .= ' AND hcbd.`id_hotel`='.(int) $idRoomTypeHotel; - } if (!is_null($idProduct)) { $sql .= ' AND spc.`id_product`='.(int) $idProduct; }