From 800ec6d645e8017a920ffc8db91ee0749dfba593 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 4 Jun 2025 13:34:59 +0530 Subject: [PATCH 01/24] Added missing validations in the back office --- .../products/booked_room_date_ranges_list.tpl | 2 +- .../controllers/products/configuration.tpl | 2 ++ .../admin/AdminLocalizationController.php | 14 ++++++++++++- controllers/admin/AdminProductsController.php | 18 ++++++++++++++-- .../admin/AdminHotelBedTypesController.php | 21 +++++++++++++++---- .../hotelreservationsystem.php | 1 + 6 files changed, 50 insertions(+), 8 deletions(-) diff --git a/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl b/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl index 2645f8dd8..ef41311ec 100644 --- a/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl +++ b/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl @@ -17,7 +17,7 @@ * @license LICENSE.txt *} -{l s='This room already has a booking for the selected date range.'} +{sprintf({l s='The room "%s" already has a booking for the selected date range.'}, $orderDetails->room_num)}
{l s='Order ID'}: #{$orderDetails->id_order|intval} diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index 0419331c0..a5680a24f 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -1238,6 +1238,7 @@ }; $('#page-loader').show(); + $('[name="submitBulkCreateRooms"]').attr('disabled', 'disable'); $.ajax({ url: prod_link, type: 'POST', @@ -1253,6 +1254,7 @@ }, complete: function() { $('#page-loader').hide(); + $('[name="submitBulkCreateRooms"]').attr('disabled', false); } }); }, diff --git a/controllers/admin/AdminLocalizationController.php b/controllers/admin/AdminLocalizationController.php index 49ad2c76c..7f1a8b745 100644 --- a/controllers/admin/AdminLocalizationController.php +++ b/controllers/admin/AdminLocalizationController.php @@ -401,8 +401,20 @@ class AdminLocalizationControllerCore extends AdminController public function beforeUpdateOptions() { - $lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT')); + if (!trim(Tools::getValue('PS_WEIGHT_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Weight unit')); + } + if (!trim(Tools::getValue('PS_DISTANCE_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Distance unit')); + } + if (!trim(Tools::getValue('PS_DIMENSION_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Dimension unit')); + } + if (!trim(Tools::getValue('PS_VOLUME_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Volume unit')); + } + $lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT')); if (!$lang->active) { $lang->active = 1; $lang->save(); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index c65497b23..a9e30a0c5 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -5304,6 +5304,7 @@ class AdminProductsControllerCore extends AdminController if ($idRooms = Tools::getValue('id_rooms')) { $rowsToHighlight = array(); $room = array(); + $bookedRows = array(); if (trim($floor = Tools::getValue('floor'))) { $room['floor'] = $floor; if (!Validate::isGenericName($floor)) { @@ -5371,7 +5372,8 @@ class AdminProductsControllerCore extends AdminController } } else if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE && $disableDates) { foreach ($disableDates as $key => $dateRange) { - if ($objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) { + if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) { + $bookedRows[$bookingRow['id']] = new HotelBookingDetail($bookingRow['id']); $rowsToHighlight[] = $key; } } @@ -5382,6 +5384,18 @@ class AdminProductsControllerCore extends AdminController Hook::exec('actionValidateRoomInformation', array('room_information' => $room)); } + + if (count($bookedRows)) { + foreach ($bookedRows as $bookedRow) { + $this->context->smarty->assign(array( + 'link' => $this->context->link, + 'orderDetails' => $bookedRow, + )); + + $this->errors[] = $this->context->smarty->fetch('controllers/products/booked_room_date_ranges_list.tpl'); + } + + } } if (empty($this->errors)) { @@ -5468,7 +5482,7 @@ class AdminProductsControllerCore extends AdminController if (!($roomQuantity = Tools::getValue('qty'))) { $this->errors[] = Tools::displayError('Number of rooms is required.'); - } else if ($roomQuantity < 1) { + } else if (!Validate::isUnsignedInt($roomQuantity) || $roomQuantity < 1) { $this->errors[] = Tools::displayError('Invalid value for number of rooms.'); } diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php index adad61851..2088899a7 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php @@ -143,12 +143,25 @@ class AdminHotelBedTypesController extends ModuleAdminController return; } - if (!trim(Tools::getValue('width'))) { - $this->errors[] = $this->l('Field Width is required'); + $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); + $objDefaultLanguage = Language::getLanguage((int) $defaultLangId); + $languages = Language::getLanguages(false); + if (!trim(Tools::getValue('name_'.$defaultLangId))) { + $this->errors[] = $this->l('Bed type name is required at least in ').$objDefaultLanguage['name']; + } else { + foreach ($languages as $lang) { + if (trim(Tools::getValue('name_'.$lang['id_lang'])) && !Validate::isGenericName(Tools::getValue('name_'.$lang['id_lang']))) { + $this->errors[] = $this->l('Invalid bed type name in ').$lang['name']; + } + } } - if (!trim(Tools::getValue('length'))) { - $this->errors[] = $this->l('Field Length is required'); + if (!(float) Tools::getValue('width')) { + $this->errors[] = $this->l('The width field is required'); + } + + if (!(float) Tools::getValue('length')) { + $this->errors[] = $this->l('The length field is required'); } return parent::processSave(); diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 4c6c73680..7560cc9b5 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -510,6 +510,7 @@ class HotelReservationSystem extends Module 'htl_room_type_global_demand_advance_option', 'htl_order_refund_rules', 'htl_settings_link', + 'htl_bed_type' ); //If Admin update new language when we do entry in module all lang tables. HotelHelper::updateLangTables($newIdLang, $langTables); From d80ffeb55e60cc8ba480e3613478a6ef5e7fc8cc Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 4 Jun 2025 16:48:35 +0530 Subject: [PATCH 02/24] Fixed: Got fatal error when trying to view abandoned cart --- classes/Cart.php | 129 ++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index dd7692a16..91c5c0043 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -2432,7 +2432,7 @@ class CartCore extends ObjectModel $array[$selectedProduct['id_room_type_hotel']]['total_price_tax_incl'] += $selectedProduct['total_price_tax_incl']; } else { $array[$selectedProduct['id_room_type_hotel']] = array( - 'quantity' => 0, + 'quantity' => $selectedProduct['quantity'], 'id_hotel' => $selectedProduct['id_room_type_hotel'], 'total_price_tax_excl' => $selectedProduct['total_price_tax_excl'], 'total_price_tax_incl' => $selectedProduct['total_price_tax_incl'], @@ -2452,35 +2452,37 @@ class CartCore extends ObjectModel } } - foreach($array as $selectedProduct) { - $product['cart_quantity'] = $selectedProduct['quantity']; - $product['total'] = $selectedProduct['total_price_tax_excl']; - $product['total_wt'] = $selectedProduct['total_price_tax_incl']; - $product['price_wt'] = $selectedProduct['total_price_tax_incl'] / $selectedProduct['quantity']; - $product['price'] = $selectedProduct['total_price_tax_excl'] / $selectedProduct['quantity']; - $product['id_hotel'] = $selectedProduct['id_hotel']; - $product['id_room_type'] = $selectedProduct['id_room_type']; - $product['id_hotel_cart_booking'] = $selectedProduct['id_hotel_cart_booking']; - $productinfo = $product; - $productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE; - $orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $productinfo; - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'] = $selectedProduct['id_hotel']; - } - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = $product['carrier_list']; - } else { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'], $product['carrier_list']); - } - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list']; - } - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse']; - } - if (isset($package['id_carrier'])) { - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'] = $package['id_carrier']; + if ($array) { + foreach($array as $selectedProduct) { + $product['cart_quantity'] = $selectedProduct['quantity']; + $product['total'] = $selectedProduct['total_price_tax_excl']; + $product['total_wt'] = $selectedProduct['total_price_tax_incl']; + $product['price_wt'] = $selectedProduct['total_price_tax_incl'] / $selectedProduct['quantity']; + $product['price'] = $selectedProduct['total_price_tax_excl'] / $selectedProduct['quantity']; + $product['id_hotel'] = $selectedProduct['id_hotel']; + $product['id_room_type'] = $selectedProduct['id_room_type']; + $product['id_hotel_cart_booking'] = $selectedProduct['id_hotel_cart_booking']; + $productinfo = $product; + $productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE; + $orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $productinfo; + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'] = $selectedProduct['id_hotel']; + } + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = $product['carrier_list']; + } else { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'], $product['carrier_list']); + } + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list']; + } + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse']; + } + if (isset($package['id_carrier'])) { + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'] = $package['id_carrier']; + } } } } @@ -2528,38 +2530,41 @@ class CartCore extends ObjectModel ); } } - foreach($array as $hotelProduct) { - $serviceProduct = $product; - $serviceProduct['cart_quantity'] = $hotelProduct['quantity']; - $serviceProduct['id_hotel'] = $hotelProduct['id_hotel']; - $serviceProduct['total'] = $hotelProduct['total_price_tax_excl']; - $serviceProduct['total_wt'] = $hotelProduct['total_price_tax_incl']; - $serviceProduct['price'] = $hotelProduct['total_price_tax_excl'] / $hotelProduct['quantity']; - $serviceProduct['price_wt'] = $hotelProduct['total_price_tax_incl'] / $hotelProduct['quantity']; - $serviceProduct['id_room_type'] = $hotelProduct['id_room_type']; - $serviceProduct['id_hotel_cart_booking'] = $hotelProduct['id_hotel_cart_booking']; - // if (!empty($hotelProducts['products'])) { - // foreach($hotelProducts['products'] as $hotelProduct) { - $productinfo = $serviceProduct; - $productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_HOTEL_STANDALONE; - $orderPackage[$id_address][$hotelProduct['id_hotel']]['product_list'][] = $productinfo; - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'] = $hotelProduct['id_hotel']; - } - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = $product['carrier_list']; - } else { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'], $product['carrier_list']); - } - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list']; - } - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse']; - } - if (isset($package['id_carrier'])) { - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'] = $package['id_carrier']; + + if ($array) { + foreach($array as $hotelProduct) { + $serviceProduct = $product; + $serviceProduct['cart_quantity'] = $hotelProduct['quantity']; + $serviceProduct['id_hotel'] = $hotelProduct['id_hotel']; + $serviceProduct['total'] = $hotelProduct['total_price_tax_excl']; + $serviceProduct['total_wt'] = $hotelProduct['total_price_tax_incl']; + $serviceProduct['price'] = $hotelProduct['total_price_tax_excl'] / $hotelProduct['quantity']; + $serviceProduct['price_wt'] = $hotelProduct['total_price_tax_incl'] / $hotelProduct['quantity']; + $serviceProduct['id_room_type'] = $hotelProduct['id_room_type']; + $serviceProduct['id_hotel_cart_booking'] = $hotelProduct['id_hotel_cart_booking']; + // if (!empty($hotelProducts['products'])) { + // foreach($hotelProducts['products'] as $hotelProduct) { + $productinfo = $serviceProduct; + $productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_HOTEL_STANDALONE; + $orderPackage[$id_address][$hotelProduct['id_hotel']]['product_list'][] = $productinfo; + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'] = $hotelProduct['id_hotel']; + } + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = $product['carrier_list']; + } else { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'], $product['carrier_list']); + } + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list']; + } + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse']; + } + if (isset($package['id_carrier'])) { + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'] = $package['id_carrier']; + } } } } From f3a640094da0393a61221845cbb552fd7bd57376 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 4 Jun 2025 16:51:14 +0530 Subject: [PATCH 03/24] 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 04/24] =?UTF-8?q?Fixed:=20Quantity=20adjustment=20option?= =?UTF-8?q?=20displayed=20on=20the=20service=20with=20hotel=20having=20'Al?= =?UTF-8?q?low=20ordering=20of=20multiple=20quantities=E2=80=99=20setting?= =?UTF-8?q?=20as=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}
From c2be0876d84ccc2101e809b49ceb4941033b2660 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 4 Jun 2025 17:08:03 +0530 Subject: [PATCH 05/24] Added: KPI of Standard product quantities --- controllers/admin/AdminOrdersController.php | 28 ++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index dad09b3b0..e22387662 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2850,10 +2850,36 @@ class AdminOrdersControllerCore extends AdminController $helper->color = 'color1'; $helper->title = $this->l('Total Rooms'); $helper->tooltip = $this->l('Total rooms is the number of rooms booked in this order.'); - $helper->href = '#start_products'; + $helper->href = '#start_rooms'; $helper->value = $numRooms; $this->kpis[] = $helper; + // if order has normal products the add kpi for total products + $objServiceProductOrderDetail = new ServiceProductOrderDetail(); + $hotelProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($objOrder->id, 0, 0, Product::SELLING_PREFERENCE_HOTEL_STANDALONE); + $standaloneProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($objOrder->id, 0, 0, Product::SELLING_PREFERENCE_STANDALONE); + + if ($hotelProducts || $standaloneProducts) { + $helper = new HelperKpi(); + $helper->id = 'box-total-products'; + $helper->icon = 'icon-home'; + $helper->color = 'color1'; + $helper->title = $this->l('Total Products'); + $helper->tooltip = $this->l('Total products is the number of product quantities booked in this order.'); + $helper->href = '#start_products'; + + $totalProductQuantity = 0; + if ($hotelProducts) { + $totalProductQuantity += array_sum(array_column($hotelProducts, 'quantity')); + } + if ($standaloneProducts) { + $totalProductQuantity += array_sum(array_column($standaloneProducts, 'quantity')); + } + + $helper->value = $totalProductQuantity; + $this->kpis[] = $helper; + } + $helper = new HelperKpi(); if (isset($orderHistory[0]['id_order_state']) && ($orderHistory[0]['id_order_state'] == Configuration::get('PS_OS_PAYMENT_ACCEPTED'))) { $initialPaymentStatus = $this->l('Full Payment'); From 8b8e5a5de760920bd7a89f7675797a51fb2aa371 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 4 Jun 2025 17:16:37 +0530 Subject: [PATCH 06/24] Fixed: undefined index issues in the front --- controllers/front/OrderOpcController.php | 1 + modules/blockcart/cartrow.tpl | 2 +- themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl | 2 +- themes/hotel-reservation-theme/product.tpl | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 8663589a1..1851a2acc 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -1148,6 +1148,7 @@ class OrderOpcControllerCore extends ParentOrderController $this->_assignCheckoutValidationVars(); $this->_assignCheckoutVars(); $this->_assignShoppingCart(); + $this->_assignSummaryInformations(); $response['success'] = true; $response['shopping_cart'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'shopping-cart.tpl'); $response['cart_total_block'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'cart-total-block.tpl'); diff --git a/modules/blockcart/cartrow.tpl b/modules/blockcart/cartrow.tpl index 2e0e5ac52..5f3b5f92f 100644 --- a/modules/blockcart/cartrow.tpl +++ b/modules/blockcart/cartrow.tpl @@ -65,7 +65,7 @@
{if !isset($customizedDatas.$productId.$productAttributeId) && (!isset($product.is_gift) || !$product.is_gift)} -   +   {/if}
diff --git a/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl b/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl index 2e0e5ac52..5f3b5f92f 100644 --- a/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl +++ b/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl @@ -65,7 +65,7 @@
{if !isset($customizedDatas.$productId.$productAttributeId) && (!isset($product.is_gift) || !$product.is_gift)} -   +   {/if}
diff --git a/themes/hotel-reservation-theme/product.tpl b/themes/hotel-reservation-theme/product.tpl index 06a16a8eb..351edf8f8 100644 --- a/themes/hotel-reservation-theme/product.tpl +++ b/themes/hotel-reservation-theme/product.tpl @@ -217,7 +217,7 @@ {if isset($id_hotel) && $id_hotel}
  • {l s='Refund Policies'}
  • {/if} - {if $display_google_maps && ($hotel_latitude|floatval != 0 && $hotel_longitude|floatval != 0)} + {if $display_google_maps && !empty($hotel_latitude) && !empty($hotel_longitude) && ($hotel_latitude|floatval != 0 && $hotel_longitude|floatval != 0)}
  • {l s='View on Map'}
  • {/if} {block name='displayProductTab'} @@ -399,7 +399,7 @@ {/if} {/block} {block name='product_map_tab_content'} - {if $display_google_maps && ($hotel_latitude|floatval != 0 && $hotel_longitude|floatval != 0)} + {if $display_google_maps && !empty($hotel_latitude) && !empty($hotel_longitude) && ($hotel_latitude|floatval != 0 && $hotel_longitude|floatval != 0)}