From 0d351e617cb2c03489dbe32efe272061db47fd81 Mon Sep 17 00:00:00 2001 From: amit sharma Date: Wed, 30 Sep 2026 17:38:50 +0530 Subject: [PATCH] Fixed: Calculate tourism tax based on each room occupancy --- .../classes/HotelRoomTypeFeaturePricing.php | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index b5a50ef12..c86d07afe 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -385,17 +385,20 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $numNights = max(1, (int) HotelHelper::getNumberOfDays($date_from, $date_to)); $unitPriceTe = (float) $totalPrice['total_price_tax_excl'] / $numNights; $taxCalculator = TaxManagerFactory::getManager($objAddress, $idTourismTaxRulesGroup)->getTaxCalculator(); - $childAges = !empty($occupancy[0]['child_ages']) ? (array) $occupancy[0]['child_ages'] : array(); - $totalPrice['total_price_tax_incl'] += $taxCalculator->getTaxesTotalAmount( - $unitPriceTe, - $date_from, - $numNights, - $occupancy[0]['adults'], - $childAges, - $collectionType, - 1, - $id_currency - ); + $roomsTourismTax = 0; + foreach ($occupancy as $roomOccupancy) { + $roomsTourismTax += $taxCalculator->getTaxesTotalAmount( + $unitPriceTe, + $date_from, + $numNights, + isset($roomOccupancy['adults']) ? (int) $roomOccupancy['adults'] : 0, + !empty($roomOccupancy['child_ages']) ? (array) $roomOccupancy['child_ages'] : array(), + $collectionType, + 1, + $id_currency + ); + } + $totalPrice['total_price_tax_incl'] += $roomsTourismTax / count($occupancy); } }