Fix double-counted service product totals in multi-hotel cart

This commit is contained in:
Amit sharma
2026-04-29 15:03:55 +05:30
parent d1ec3e0e5d
commit 76f35e5fc5
2 changed files with 11 additions and 2 deletions

View File

@@ -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) {

View File

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