From f3a640094da0393a61221845cbb552fd7bd57376 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 4 Jun 2025 16:51:14 +0530 Subject: [PATCH 1/2] Fixed: undefined indexes issues and auto added service not being removed on room delete --- classes/Dispatcher.php | 2 +- controllers/admin/AdminNormalProductsController.php | 8 ++++---- controllers/admin/AdminOrdersController.php | 6 +++--- .../classes/ServiceProductCartDetail.php | 5 ++++- .../classes/ServiceProductOrderDetail.php | 8 +++++++- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/classes/Dispatcher.php b/classes/Dispatcher.php index b4903c747..7452b4924 100644 --- a/classes/Dispatcher.php +++ b/classes/Dispatcher.php @@ -652,7 +652,7 @@ class DispatcherCore if (!isset($this->routes[$id_shop][$id_lang][$route_id])) { $query = http_build_query($params, '', '&'); $index_link = $this->use_routes ? '' : 'index.php'; - return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((trim($route_id) == '') ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor; + return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((!is_null($route_id) ? (trim($route_id) == '') : 1) ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor; } $route = $this->routes[$id_shop][$id_lang][$route_id]; // Check required fields diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index f27cab407..597c89dbf 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -3854,14 +3854,14 @@ class AdminNormalProductsControllerCore extends AdminController } $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - $selectetRoomTypes = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE); - $selectetHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL); + $selectedRoomTypes = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE); + $selectedHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL); $tree = new HelperTree('hotels-room-tree'); $tree->setData(HotelHelper::generateTreeData([ 'rootNode' => HotelHelper::NODE_HOTEL, 'leafNode' => HotelHelper::NODE_ROOM_TYPE, - 'selectedElements' => $selectetRoomTypes + 'selectedElements' => $selectedRoomTypes ])) ->setUseCheckBox(true) ->setAutoSelectChildren(true) @@ -3873,7 +3873,7 @@ class AdminNormalProductsControllerCore extends AdminController $tree->setData(HotelHelper::generateTreeData([ 'rootNode' => HotelHelper::NODE_HOTEL, 'leafNode' => HotelHelper::NODE_HOTEL, - 'selectedElements' => $selectetHotels + 'selectedElements' => $selectedHotels ])) ->setUseCheckBox(true) ->setAutoSelectChildren(true) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index dad09b3b0..186f31c1c 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -6222,7 +6222,7 @@ class AdminOrdersControllerCore extends AdminController 0, 1, 1, - 0, + null, // to get the auto added services. null, 0, $idHotelBooking @@ -6238,7 +6238,7 @@ class AdminOrdersControllerCore extends AdminController 0, 1, 0, - 0, + null, // to get the auto added services. null, 0, $idHotelBooking @@ -6254,7 +6254,7 @@ class AdminOrdersControllerCore extends AdminController 0, 0, null, - 0, + null, // to get the auto added services. null, 0, $idHotelBooking diff --git a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php index f62b0d9ec..91046c8f1 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php @@ -168,7 +168,7 @@ class ServiceProductCartDetail extends ObjectModel $sql = 'SELECT spc.*, p.`selling_preference_type`, hcbd.`date_from`, spc.`id_cart` as service_id_cart, hcbd.`date_to`, p.`price_calculation_method`, hcbd.`id_product` as `id_product_room_type`'; if (!$getTotalPrice) { - $sql .= ', hbil.`hotel_name` '; + $sql .= ', hbil.`hotel_name`, p.`auto_add_to_cart`, p.`price_addition_type` '; } $sql .= ' FROM `'._DB_PREFIX_.'service_product_cart_detail` spc'; $sql .= ' LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = spc.`id_product`)'; @@ -310,6 +310,9 @@ class ServiceProductCartDetail extends ObjectModel 'total_price_tax_excl' => $priceTaxExcl * (int)$product['quantity'] * $numDays, 'cover_img' => $coverImg, 'price_calculation_method' => $product['price_calculation_method'], + 'auto_add_to_cart' => $product['auto_add_to_cart'], + 'price_addition_type' => $product['price_addition_type'], + 'total_price' => ($useTax ? $priceTaxIncl * (int)$product['quantity'] * $numDays : $priceTaxExcl * (int)$product['quantity'] * $numDays), ); if ($product['htl_cart_booking_id']) { diff --git a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php index 604890df7..776cfa5b9 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php @@ -127,7 +127,9 @@ class ServiceProductOrderDetail extends ObjectModel $sql = 'SELECT spod.*'; if (!$getTotalPrice) { - $sql .= ', hbd.`id_product` as `id_room_type`, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, hbd.`id_room`, hbd.`adults`, hbd.`children`, hbd.`id_product`, hbd.`date_from`, hbd.`date_to`, hbd.`room_type_name`, spod.`id_product` as id_product'; + $sql .= ', hbd.`id_product` as `id_room_type`, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, + hbd.`id_room`, hbd.`adults`, hbd.`children`, hbd.`id_product`, hbd.`date_from`, hbd.`date_to`, hbd.`room_type_name`, + spod.`id_product` as id_product, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, od.`product_auto_add`, od.`product_price_addition_type`'; } $sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd LEFT JOIN `'._DB_PREFIX_.'service_product_order_detail` spod ON(spod.`id_htl_booking_detail` = hbd.`id`)'; @@ -210,6 +212,8 @@ class ServiceProductOrderDetail extends ObjectModel 'total_price_tax_incl' => $product['total_price_tax_incl'], 'unit_price_tax_excl' => $product['unit_price_tax_excl'], 'unit_price_tax_incl' => $product['unit_price_tax_incl'], + 'product_auto_add' => $product['product_auto_add'], + 'product_price_addition_type' => $product['product_price_addition_type'], ); } else { $selectedAdditionalServices[$product['id_htl_booking_detail']]['id_order'] = $product['id_order']; @@ -240,6 +244,8 @@ class ServiceProductOrderDetail extends ObjectModel 'total_price_tax_incl' => $product['total_price_tax_incl'], 'unit_price_tax_excl' => $product['unit_price_tax_excl'], 'unit_price_tax_incl' => $product['unit_price_tax_incl'], + 'product_auto_add' => $product['product_auto_add'], + 'product_price_addition_type' => $product['product_price_addition_type'], ), ); } From c32f0dfc6264bd8208c4f8d11a2423a0fb2d2ee1 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 4 Jun 2025 17:01:58 +0530 Subject: [PATCH 2/2] =?UTF-8?q?Fixed:=20Quantity=20adjustment=20option=20d?= =?UTF-8?q?isplayed=20on=20the=20service=20with=20hotel=20having=20'Allow?= =?UTF-8?q?=20ordering=20of=20multiple=20quantities=E2=80=99=20setting=20a?= =?UTF-8?q?s=20disabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shopping-cart-detail.tpl | 62 +++++++------------ 1 file changed, 21 insertions(+), 41 deletions(-) diff --git a/themes/hotel-reservation-theme/shopping-cart-detail.tpl b/themes/hotel-reservation-theme/shopping-cart-detail.tpl index 387efb74d..12e682bf7 100644 --- a/themes/hotel-reservation-theme/shopping-cart-detail.tpl +++ b/themes/hotel-reservation-theme/shopping-cart-detail.tpl @@ -240,8 +240,8 @@
-
-
+
+

{if $priceDisplay}{displayPrice price=($product['unit_price_tax_excl'])}{else}{displayPrice price=($product['unit_price_tax_incl'])}{/if} @@ -251,35 +251,26 @@ {l s='Unit price'} {if $display_tax_label}{if $priceDisplay} {l s='(Excl.'} {else}{l s='(Incl.)'}{/if} {l s='all taxes.)'}{/if}

-
-
-
- - -
- - {if $product.minimal_quantity < ($product.quantity)} - - - - {else} - - - - {/if} - + {if $product.allow_multiple_quantity} +
+
+ + +
+ + {if $product.minimal_quantity < ($product.quantity)} + + + + {else} + + + + {/if} +
+
-
- {*
-

- - {if $product['quantity'] <= 9}0{$product['quantity']}{else}{$product['quantity']}{/if} - -

-

- {l s='Total Qty'} -

-
*} + {/if}
@@ -370,17 +361,6 @@
- - {*
-

- - {if $product['quantity'] <= 9}0{$product['quantity']}{else}{$product['quantity']}{/if} - -

-

- {l s='Total Qty'} -

-
*}
{/if}