From 9c258da9fc5a9e0dcbdcadb7363dbd77f4dd83b2 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 19 Jun 2025 10:58:36 +0530 Subject: [PATCH 01/39] Fixed: notice on the edit feature price rule --- .../admin/hotel_feature_prices_settings/helpers/form/form.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl index 30a613ea2..d799be9da 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl @@ -124,7 +124,7 @@ {/if} {if isset($restrictions) && $restrictions} {foreach $restrictions as $key => $restriction} - {include file="../../../_partials/feature_price_rules.tpl" key=$key advancePriceRule=$rule} + {include file="../../../_partials/feature_price_rules.tpl" key=$key} {/foreach} {else} {include file="../../../_partials/feature_price_rules.tpl" key=0 collapse=true} From 356cd1f569d314d34ebe51f245520b7e3f7d72e8 Mon Sep 17 00:00:00 2001 From: Aman deep sharma Date: Thu, 19 Jun 2025 16:24:26 +0530 Subject: [PATCH 02/39] Fixed: Tax rate calculation and breakdown --- classes/PaymentModule.php | 2 - classes/order/Order.php | 190 +++++++++++++----- classes/order/OrderDetail.php | 137 +++++++++++-- .../classes/HotelReservationSystemDb.php | 2 + .../classes/ServiceProductOrderDetail.php | 45 +++++ 5 files changed, 309 insertions(+), 67 deletions(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index f1eba0008..9cca21cb6 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -1571,8 +1571,6 @@ abstract class PaymentModuleCore extends Module } } } - - $order->updateOrderDetailTax(); } else { $error = Tools::displayError('Order creation failed'); PrestaShopLogger::addLog($error, 4, '0000002', 'Cart', intval($order->id_cart)); diff --git a/classes/order/Order.php b/classes/order/Order.php index abcd65007..99814f532 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -2520,78 +2520,162 @@ class OrderCore extends ObjectModel $order_ecotax_tax = 0; - $tax_rates = array(); - foreach ($order_details as $order_detail) { + $tax_rates = array(); $id_order_detail = $order_detail['id_order_detail']; + + $taxesList = OrderDetail::getTaxListStatic($id_order_detail); + if (!$taxesList) { + continue; + } + $tax_calculator = OrderDetail::getTaxCalculatorStatic($id_order_detail); - - // TODO: probably need to make an ecotax tax breakdown here instead, - // but it seems unlikely there will be different tax rates applied to the - // ecotax in the same order in the real world - $unit_ecotax_tax = $order_detail['ecotax'] * $order_detail['ecotax_tax_rate'] / 100.0; - $order_ecotax_tax += $order_detail['product_quantity'] * $unit_ecotax_tax; - - $discount_ratio = 0; - - if ($this->total_products > 0) { - $discount_ratio = ($order_detail['unit_price_tax_excl'] + $order_detail['ecotax']) / $this->total_products; - } - - // share of global discount - $discounted_price_tax_excl = $order_detail['unit_price_tax_excl'] - $discount_ratio * $order_discount_tax_excl; - // specific discount - if (!empty($product_specific_discounts[$order_detail['product_id']])) { - $discounted_price_tax_excl -= $product_specific_discounts[$order_detail['product_id']]; - } - $quantity = $order_detail['product_quantity']; + $unit_price_tax_excl = $order_detail['total_price_tax_excl'] / $quantity; + + /* + * Discounted taxes are intentionally not calculated here, as we do not want to display them. + * + * TODO: Consider implementing a proper ecotax breakdown if needed in future. + * However, it is unlikely that different tax rates would apply to ecotax within the same order. + * + * + * $unit_ecotax_tax = $order_detail['ecotax'] * $order_detail['ecotax_tax_rate'] / 100.0; + * $order_ecotax_tax += $order_detail['product_quantity'] * $unit_ecotax_tax; + * + * $discount_ratio = 0; + * if ($this->total_products > 0) { + * $discount_ratio = ($order_detail['unit_price_tax_excl'] + $order_detail['ecotax']) / $this->total_products; + * } + * + * // Apply share of global discount + * $discounted_price_tax_excl = $order_detail['unit_price_tax_excl'] - $discount_ratio * $order_discount_tax_excl; + * + * // Apply specific product-level discount + * if (!empty($product_specific_discounts[$order_detail['product_id']])) { + * $discounted_price_tax_excl -= $product_specific_discounts[$order_detail['product_id']]; + * } + */ foreach ($tax_calculator->taxes as $tax) { $tax_rates[$tax->id] = $tax->rate; } - foreach ($tax_calculator->getTaxesAmount($discounted_price_tax_excl) as $id_tax => $unit_amount) { - $total_tax_base = 0; - $total_tax_base = Tools::processPriceRounding($discounted_price_tax_excl, $quantity); - $total_amount = Tools::processPriceRounding($unit_amount, $quantity); - if (!isset($breakdown[$id_tax])) { - $breakdown[$id_tax] = array('tax_base' => 0, 'tax_amount' => 0); - } - - $breakdown[$id_tax]['tax_base'] += $total_tax_base; - $breakdown[$id_tax]['tax_amount'] += $total_amount; - - $order_detail_tax_rows[] = array( - 'id_order_detail' => $id_order_detail, - 'id_tax' => $id_tax, - 'tax_rate' => $tax_rates[$id_tax], - 'unit_tax_base' => $discounted_price_tax_excl, - 'total_tax_base' => $total_tax_base, - 'unit_amount' => $unit_amount, - 'total_amount' => $total_amount + if (!Product::isBookingProduct($order_detail['product_id'])) { + $quantity = Db::getInstance()->getValue( + 'SELECT SUM(`quantity`) + FROM `'._DB_PREFIX_.'service_product_order_detail` + WHERE `id_order_detail` = '.(int)$id_order_detail.' + AND `id_tax_rules_group` > 0 ' ); } - } - if (!empty($order_detail_tax_rows)) { - foreach ($breakdown as $data) { - $actual_total_tax += Tools::ps_round($data['tax_amount'], _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode); - $actual_total_base += Tools::ps_round($data['tax_base'], _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode); + $totalTaxBase = Tools::processPriceRounding($unit_price_tax_excl, $quantity); + + $objServiceProductOrderDetail = new ServiceProductOrderDetail(); + $groupedTaxDetails = array(); + $additionalTaxAmounts = array(); + + if ( + Product::isBookingProduct($order_detail['product_id']) && + $autoAddedPriceExcl = $objServiceProductOrderDetail->getRoomTypeServiceProducts( + $order_detail['id_order'], + 0, 0, + $order_detail['product_id'], + 0, 0, 0, + true, false, true, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ) + ) { + $additionalTaxAmounts = $tax_calculator->getTaxesAmount($autoAddedPriceExcl); + $totalTaxBase += $autoAddedPriceExcl; } - $order_ecotax_tax = Tools::ps_round($order_ecotax_tax, _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode); + $taxBaseShare = $totalTaxBase / count($tax_rates); - $tax_rounding_error = $expected_total_tax - $actual_total_tax - $order_ecotax_tax; - if ($tax_rounding_error != 0) { - Tools::spreadAmount($tax_rounding_error, _PS_PRICE_COMPUTE_PRECISION_, $order_detail_tax_rows, 'total_amount'); + foreach ($taxesList as $detailTax) { + $taxId = $detailTax['id_tax']; + + $unitAmount = $detailTax['unit_amount'] + ($additionalTaxAmounts[$taxId] ?? 0); + $totalAmount = $detailTax['total_amount'] + ($additionalTaxAmounts[$taxId] ?? 0); + + if (!isset($groupedTaxDetails[$taxId])) { + $groupedTaxDetails[$taxId] = array( + 'id_order_detail' => $id_order_detail, + 'id_tax' => $taxId, + 'tax_rate' => $tax_rates[$taxId], + 'unit_tax_base' => $unit_price_tax_excl, + 'total_tax_base' => $taxBaseShare, + 'unit_amount' => $unitAmount, + 'total_amount' => $totalAmount, + ); + } else { + $groupedTaxDetails[$taxId]['total_amount'] += $totalAmount; + } } - $base_rounding_error = $expected_total_base - $actual_total_base; - if ($base_rounding_error != 0) { - Tools::spreadAmount($base_rounding_error, _PS_PRICE_COMPUTE_PRECISION_, $order_detail_tax_rows, 'total_tax_base'); + if (!empty($groupedTaxDetails)) { + foreach ($groupedTaxDetails as $item) { + $order_detail_tax_rows[] = $item; + } } + + /* + * This tax recalculation logic is intentionally disabled. + * + * Taxes have already been calculated and stored in the `order_detail_tax` table, + * so there is no need to recompute them here. + * + * foreach ($tax_calculator->getTaxesAmount($discounted_price_tax_excl) as $id_tax => $unit_amount) { + * $total_tax_base = 0; + * $total_tax_base = Tools::processPriceRounding($discounted_price_tax_excl, $quantity); + * $total_amount = Tools::processPriceRounding($unit_amount, $quantity); + * + * if (!isset($breakdown[$id_tax])) { + * $breakdown[$id_tax] = array('tax_base' => 0, 'tax_amount' => 0); + * } + * + * $breakdown[$id_tax]['tax_base'] += $total_tax_base; + * $breakdown[$id_tax]['tax_amount'] += $total_amount; + * + * $order_detail_tax_rows[] = array( + * 'id_order_detail' => $id_order_detail, + * 'id_tax' => $id_tax, + * 'tax_rate' => $tax_rates[$id_tax], + * 'unit_tax_base' => $discounted_price_tax_excl, + * 'total_tax_base' => $total_tax_base, + * 'unit_amount' => $unit_amount, + * 'total_amount' => $total_amount + * ); + * } + */ + } + /* + * The following tax adjustment logic was disabled as it is not currently in use. + * It was intended to handle rounding errors in tax and base amounts by spreading + * the discrepancy across order detail tax rows. However, this logic is not required + * due to updated tax calculation and breakdown handling. + */ + + // if (!empty($order_detail_tax_rows)) { + // foreach ($breakdown as $data) { + // $actual_total_tax += Tools::ps_round($data['tax_amount'], _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode); + // $actual_total_base += Tools::ps_round($data['tax_base'], _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode); + // } + + // $order_ecotax_tax = Tools::ps_round($order_ecotax_tax, _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode); + + // $tax_rounding_error = $expected_total_tax - $actual_total_tax - $order_ecotax_tax; + // if ($tax_rounding_error != 0) { + // Tools::spreadAmount($tax_rounding_error, _PS_PRICE_COMPUTE_PRECISION_, $order_detail_tax_rows, 'total_amount'); + // } + + // $base_rounding_error = $expected_total_base - $actual_total_base; + // if ($base_rounding_error != 0) { + // Tools::spreadAmount($base_rounding_error, _PS_PRICE_COMPUTE_PRECISION_, $order_detail_tax_rows, 'total_tax_base'); + // } + // } return $order_detail_tax_rows; } diff --git a/classes/order/OrderDetail.php b/classes/order/OrderDetail.php index 17b1a420e..b0e165b1d 100644 --- a/classes/order/OrderDetail.php +++ b/classes/order/OrderDetail.php @@ -398,27 +398,140 @@ class OrderDetailCore extends ObjectModel } } - $ratio = $this->unit_price_tax_excl / $order->total_products; - $order_reduction_amount = ($order->total_discounts_tax_excl - $shipping_tax_amount) * $ratio; - $discounted_price_tax_excl = $this->unit_price_tax_excl - $order_reduction_amount; - $values = ''; - foreach ($this->tax_calculator->getTaxesAmount($discounted_price_tax_excl) as $id_tax => $amount) { + $idCart = $order->id_cart; - $total_amount = Tools::processPriceRounding($amount, $this->product_quantity, $order->round_type, $order->round_mode); + /** + * Calculate tax rule groups for the service product based on each associated room type. + */ + if (!Product::isBookingProduct($this->product_id)) { + // Get all associated room type IDs for this service product and cart + $associatedRoomTypes = Db::getInstance()->executeS( + 'SELECT hcbd.`id_product` + FROM `'._DB_PREFIX_.'htl_cart_booking_data` hcbd + INNER JOIN `'._DB_PREFIX_.'service_product_cart_detail` spcd + ON spcd.`htl_cart_booking_id` = hcbd.`id` + WHERE spcd.`id_product` = '.(int)$this->product_id.' + AND spcd.`id_cart` = '.(int)$idCart + ); - $values .= '('.(int)$this->id.','.(int)$id_tax.','.(float)$amount.','.(float)$total_amount.'),'; + if (!empty($associatedRoomTypes)) { + $associatedRoomTypeIds = array_column($associatedRoomTypes, 'id_product'); + $taxGroupInfoList = array(); + + foreach ($associatedRoomTypeIds as $idRoomType) { + $taxGroupInfo = Db::getInstance()->getRow( + 'SELECT `id_element`, `id_tax_rules_group` + FROM `'._DB_PREFIX_.'htl_room_type_service_product_price` + WHERE `id_product` = '.(int)$this->product_id.' + AND `id_element` = '.(int)$idRoomType + ); + + if ($taxGroupInfo) { + // Specific tax rules found + $taxGroupInfoList[] = $taxGroupInfo; + } else { + // Use default tax rule for the service product + $defaultTaxGroupId = (int)Product::getIdTaxRulesGroupByIdProduct($this->product_id, $this->context); + $taxGroupInfoList[] = array( + 'id_element' => $idRoomType, + 'id_tax_rules_group' => $defaultTaxGroupId + ); + } + } + } } + + /** + * Calculate service product tax separately for each room type because + * a service product can be attached to multiple room types with different tax rules. + */ + if (!Product::isBookingProduct($this->product_id) && isset($taxGroupInfoList) && $taxGroupInfoList) { + $objServiceProductCartDetail = new ServiceProductCartDetail(); + // Saving tax details according to the service product tax groups for different rooms + foreach ($taxGroupInfoList as $taxGroupInfo) { + $tax_manager = TaxManagerFactory::getManager($this->vat_address, (int)$taxGroupInfo['id_tax_rules_group']); + $this->tax_calculator = $tax_manager->getTaxCalculator(); - if ($replace) { - Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'order_detail_tax` WHERE id_order_detail='.(int)$this->id); + if ($this->tax_calculator == null) { + continue; + } + + if (!($this->tax_calculator instanceof TaxCalculator)) { + continue; + } + + if (count($this->tax_calculator->taxes) == 0) { + continue; + } + + $serviceProductCartData = $objServiceProductCartDetail->getServiceProductsInCart( + $idCart, + array(), + null, + null, + $taxGroupInfo['id_element'], + $this->product_id + ); + $serviceProduct = array_shift($serviceProductCartData); + $unit_price_tax_excl = $serviceProduct['unit_price_tax_excl']; + + foreach ($this->tax_calculator->getTaxesAmount($unit_price_tax_excl) as $id_tax => $amount) { + + $total_amount = Tools::processPriceRounding($amount, $serviceProduct['quantity'], $order->round_type, $order->round_mode); + + $values .= '('.(int)$this->id.','.(int)$id_tax.','.(float)$amount.','.(float)$total_amount.'),'; + } + } + } else { + if ($this->tax_calculator == null) { + return true; + } + + if (!($this->tax_calculator instanceof TaxCalculator)) { + return false; + } + + if (count($this->tax_calculator->taxes) == 0) { + return true; + } + + if ($order->total_products <= 0) { + return true; + } + + $unit_price_tax_excl = $this->total_price_tax_excl / $this->product_quantity; + /* + * The logic for distributing discount proportionally across products is intentionally skipped, + * as we do not want to save taxes on discounted amounts. + * + * $ratio = $unit_price_tax_excl / $order->total_products; + * $order_reduction_amount = ($order->total_discounts_tax_excl - $shipping_tax_amount) * $ratio; + * $discounted_price_tax_excl = $unit_price_tax_excl - $order_reduction_amount; + */ + + foreach ($this->tax_calculator->getTaxesAmount($unit_price_tax_excl) as $id_tax => $amount) { + + $total_amount = Tools::processPriceRounding($amount, $this->product_quantity, $order->round_type, $order->round_mode); + + $values .= '('.(int)$this->id.','.(int)$id_tax.','.(float)$amount.','.(float)$total_amount.'),'; + } } $values = rtrim($values, ','); - $sql = 'INSERT INTO `'._DB_PREFIX_.'order_detail_tax` (id_order_detail, id_tax, unit_amount, total_amount) - VALUES '.$values; - return Db::getInstance()->execute($sql); + if ($values) { + if ($replace) { + Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'order_detail_tax` WHERE id_order_detail='.(int)$this->id); + } + + $sql = 'INSERT INTO `'._DB_PREFIX_.'order_detail_tax` (id_order_detail, id_tax, unit_amount, total_amount) + VALUES '.$values; + + return Db::getInstance()->execute($sql); + } + + return true; } public function updateTaxAmount($order) diff --git a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php index d103e1576..a91163edb 100644 --- a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php +++ b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php @@ -430,6 +430,8 @@ class HotelReservationSystemDb `id_hotel` int(11) NOT NULL, `id_htl_booking_detail` int(11) NOT NULL, `id_product_option` int(11) NOT NULL, + `tax_computation_method` tinyint(1) unsigned NOT NULL DEFAULT '0', + `id_tax_rules_group` int(11) unsigned NOT NULL DEFAULT '0', `unit_price_tax_excl` decimal(20,6) NOT NULL, `unit_price_tax_incl` decimal(20,6) NOT NULL, `total_price_tax_excl` decimal(20,6) NOT NULL, diff --git a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php index 173e2fe3f..76151f738 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php @@ -28,6 +28,8 @@ class ServiceProductOrderDetail extends ObjectModel public $id_hotel; public $id_htl_booking_detail; public $id_product_option; + public $tax_computation_method; + public $id_tax_rules_group; public $unit_price_tax_excl; public $unit_price_tax_incl; public $total_price_tax_excl; @@ -53,6 +55,8 @@ class ServiceProductOrderDetail extends ObjectModel 'id_hotel' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_htl_booking_detail' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_product_option' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'tax_computation_method' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'id_tax_rules_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'unit_price_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), 'unit_price_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), 'total_price_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), @@ -69,6 +73,47 @@ class ServiceProductOrderDetail extends ObjectModel ) ); + public function add($autodate = true, $null_values = true) + { + if (Validate::isLoadedObject($objOrder = new Order((int)$this->id_order)) + && Validate::isLoadedObject($objServiceProduct = new Product((int)$this->id_product)) + ) { + $objAddress = new Address((int)$objOrder->id_address_tax); + $idRoomType = Db::getInstance()->getValue( + 'SELECT `id_product` + FROM `'._DB_PREFIX_.'htl_booking_detail` + WHERE `id` = '.(int)$this->id_htl_booking_detail + ); + + if ($objServiceProduct->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM && $objServiceProduct->auto_add_to_cart) { + if (Validate::isLoadedObject($objRoomTypeProduct = new Product((int)$idRoomType))) { + $this->id_tax_rules_group = $objRoomTypeProduct->id_tax_rules_group; + } + } else { + $idTaxRulesGroup = Db::getInstance()->getValue( + 'SELECT `id_tax_rules_group` + FROM `'._DB_PREFIX_.'htl_room_type_service_product_price` + WHERE `id_product` = '.(int)$this->id_product.' + AND `id_element` = '.(int)$idRoomType + ); + + if ($idTaxRulesGroup === false || $idTaxRulesGroup === null) { + // Use default tax rule for the service product + $idTaxRulesGroup = (int)Product::getIdTaxRulesGroupByIdProduct($this->id_product, Context::getContext()); + } + + $this->id_tax_rules_group = $idTaxRulesGroup; + } + + $taxCalculator = TaxManagerFactory::getManager($objAddress, $this->id_tax_rules_group)->getTaxCalculator(); + $this->tax_computation_method = (int)$taxCalculator->computation_method; + + return parent::add($autodate, $null_values); + } + + return false; + } + public function getServiceProductsInOrder( $idOrder, $idOrderDetail = 0, From 97eff5a421386ec40d56d40bb6819f742477dfdd Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 19 Jun 2025 17:51:55 +0530 Subject: [PATCH 03/39] Fixed: Total rooms KPI does nothing on click event --- .../default/template/controllers/orders/helpers/view/view.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index 6327e9f76..0bf76f7fe 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -826,7 +826,7 @@ {hook h="displayAdminOrder" id_order=$order->id} -
+
From b4485ae91f41c3c34eef391a681804db08887948 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 19 Jun 2025 18:03:51 +0530 Subject: [PATCH 04/39] Fixed: bed types were not added in new/dupliucate bed types --- controllers/admin/AdminProductsController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index b1e02b73b..bf4321607 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -944,6 +944,12 @@ class AdminProductsControllerCore extends AdminController $id_hotel_new = $room_type_info['id_hotel']; } + $objHotelRoomTypeBedType = new HotelRoomTypeBedType(); + if ($roomTypeBedTypes = $objHotelRoomTypeBedType->getRoomTypeBedTypes($id_product_old)) { + $roomTypeBedTypes = array_column($roomTypeBedTypes, 'id_bed_type'); + $objHotelRoomTypeBedType->updateRoomTypeBedTypes($roomTypeBedTypes, $product->id); + } + if ($product->hasAttributes()) { Product::updateDefaultAttribute($product->id); } else { @@ -1918,7 +1924,8 @@ class AdminProductsControllerCore extends AdminController $this->copyFromPost($this->object, $this->table); $this->object->booking_product = true; if ($this->object->add()) { - + $objHotelRoomTypeBedType = new HotelRoomTypeBedType(); + $objHotelRoomTypeBedType->updateRoomTypeBedTypes(Tools::getValue('id_bed_types'), $this->object->id); // associateroom type to hotel // if ($this->object->is_virtual) { From 23b4b42e63d6c0d4a55ded24946c802897e77061 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 19 Jun 2025 18:20:54 +0530 Subject: [PATCH 05/39] Fixed: set optional as false of order column in the customer service controller --- controllers/admin/AdminCustomerThreadsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index ea35a45ff..2b99d990c 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -175,7 +175,7 @@ class AdminCustomerThreadsControllerCore extends AdminController 'id_order' => array( 'title' => $this->l('ID Order'), 'filter_key' => 'a!id_order', - 'optional' => true, + 'optional' => false, 'visible_default' => false, 'displayed' => false, ), From a6965b93f64130af6448f3cdea9a853f262bcbc3 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 19 Jun 2025 19:22:26 +0530 Subject: [PATCH 06/39] Fixed: the docs and customer guest are not deleted on order and customer delete process --- modules/qlocleaner/qlocleaner.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/qlocleaner/qlocleaner.php b/modules/qlocleaner/qlocleaner.php index 3ae7a928f..f953ef1cb 100644 --- a/modules/qlocleaner/qlocleaner.php +++ b/modules/qlocleaner/qlocleaner.php @@ -310,6 +310,17 @@ class QloCleaner extends Module foreach ($tables as $table) { $db->execute('TRUNCATE TABLE `'._DB_PREFIX_.bqSQL($table).'`'); } + + $objHotelBookingDocument = new HotelBookingDocument(); + if ($objHotelBookingDocument->documentsBaseDir && file_exists($objHotelBookingDocument->documentsBaseDir) && ($docs = scandir($objHotelBookingDocument->documentsBaseDir))) { + foreach ($docs as $doc) { + if ($doc != '.' && $doc != '..' && $doc != 'index.php') { + if (is_dir($objHotelBookingDocument->documentsBaseDir.'/'.$doc)) { + Tools::deleteDirectory($objHotelBookingDocument->documentsBaseDir.'/'.$doc, true); + } + } + } + } $db->execute('DELETE FROM `'._DB_PREFIX_.'address` WHERE id_customer > 0'); $db->execute('UPDATE `'._DB_PREFIX_.'employee` SET `id_last_order` = 0,`id_last_customer_message` = 0,`id_last_customer` = 0'); @@ -870,7 +881,9 @@ class QloCleaner extends Module 'htl_booking_demands', 'htl_booking_demands_tax', 'service_product_order_detail', - 'service_product_cart_detail' + 'service_product_cart_detail', + 'customer_guest_detail', + 'cart_customer_guest' ); } } From b701548196b85f1af0bdb6f8b5a0f932bcbd5f0c Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 20 Jun 2025 11:22:29 +0530 Subject: [PATCH 07/39] Fixed: empty range filters are set in the cookies --- classes/controller/AdminController.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 1ecc82811..01970232d 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -876,20 +876,35 @@ class AdminControllerCore extends Controller $filters = array(); if (isset($this->list_id)) { foreach ($_POST as $key => $value) { + if (is_array($value)) { + if ($value[0] === '' && $value[1] === '') { + $value = ''; + } else { + $value = json_encode($value); + } + } + if ($value === '') { unset($this->context->cookie->{$prefix.$key}); } elseif (stripos($key, $this->list_id.'Filter_') === 0) { - $filters[$prefix.$key] = !is_array($value) ? $value : json_encode($value); + $filters[$prefix.$key] = $value; } elseif (stripos($key, 'submitFilter') === 0) { - $this->context->cookie->$key = !is_array($value) ? $value : json_encode($value); + $this->context->cookie->$key = $value; } } foreach ($_GET as $key => $value) { + if (is_array($value)) { + if ($value[0] === '' && $value[1] === '') { + $value = ''; + } else { + $value = json_encode($value); + } + } if (stripos($key, $this->list_id.'Filter_') === 0) { - $filters[$prefix.$key] = !is_array($value) ? $value : json_encode($value); + $filters[$prefix.$key] = $value; } elseif (stripos($key, 'submitFilter') === 0) { - $this->context->cookie->$key = !is_array($value) ? $value : json_encode($value); + $this->context->cookie->$key = $value; } if (stripos($key, $this->list_id.'Orderby') === 0 && Validate::isOrderBy($value)) { if ($value === '' || $value == $this->_defaultOrderBy) { From 2e3a7e41340d734d40b5767c384d6a4b6308f038 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 20 Jun 2025 15:06:13 +0530 Subject: [PATCH 08/39] Fixed: Text realted issues in the hotel features tab in the back office --- .../admin/AdminHotelfeaturesController.php | 26 ++++++++++++------- .../hotel_features/helpers/form/form.tpl | 6 ++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelfeaturesController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelfeaturesController.php index 8d7611c62..e2bd87471 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelfeaturesController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelfeaturesController.php @@ -97,8 +97,16 @@ class AdminHotelFeaturesController extends ModuleAdminController public function postProcess() { + if (!$this->loadObject(true)) { + return; + } + if (Tools::isSubmit('submitHtlFeatures') || Tools::isSubmit('submitHtlFeaturesAndStay')) { - $parentFeatureId = Tools::getValue('id'); + $conf = 3; + if ($parentFeatureId = Tools::getValue('id')) { + $conf = 4; + } + $pos = Tools::getValue('position'); $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); @@ -142,9 +150,6 @@ class AdminHotelFeaturesController extends ModuleAdminController } } } - - if (!count($this->errors)) { - } } else { $this->errors[] = $this->l('Please add atleast one Child features.'); } @@ -217,10 +222,10 @@ class AdminHotelFeaturesController extends ModuleAdminController if (Tools::isSubmit('submitHtlFeaturesAndStay')) { Tools::redirectAdmin( self::$currentIndex.'&id='.(int) $parentFeatureId.'&update'.$this->table. - '&conf=4&token='.$this->token + '&conf='.$conf.'&token='.$this->token ); } else { - Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf='.$conf.'&token='.$this->token); } } else { $this->errors[] = $this->l('Some error has been occurred while saving features.'); @@ -262,10 +267,10 @@ class AdminHotelFeaturesController extends ModuleAdminController if (Tools::isSubmit('submitHtlFeaturesAndStay')) { Tools::redirectAdmin( self::$currentIndex.'&id='.(int) $parentFeatureId.'&update'.$this->table. - '&conf=4&token='.$this->token + '&conf='.$conf.'&token='.$this->token ); } else { - Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf='.$conf.'&token='.$this->token); } } } else { @@ -279,7 +284,10 @@ class AdminHotelFeaturesController extends ModuleAdminController $this->display = 'add'; } } - parent::postProcess(); + + if (empty($this->errors) || $this->ajax) { + parent::postProcess(); + } } public function ajaxProcessDeleteFeature() diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_features/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_features/helpers/form/form.tpl index 2464898f4..020b017ba 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_features/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_features/helpers/form/form.tpl @@ -19,7 +19,11 @@
-   {l s='Add New Features' mod='hotelreservationsystem'} + {if isset($edit) && $edit} +   {l s='Edit Features' mod='hotelreservationsystem'} + {else} +   {l s='Add New Features' mod='hotelreservationsystem'} + {/if}
From f0eac28b42a492450e8ddeac7c9a6e1e9d126424 Mon Sep 17 00:00:00 2001 From: Aman deep sharma Date: Fri, 20 Jun 2025 15:39:19 +0530 Subject: [PATCH 09/39] Remove isBookingProduct usage and optimize related logic --- classes/PaymentModule.php | 6 +++ classes/order/Order.php | 34 ++++++++---- classes/order/OrderDetail.php | 48 +++++++++-------- .../classes/ServiceProductOrderDetail.php | 54 ++++++++++--------- 4 files changed, 87 insertions(+), 55 deletions(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 9cca21cb6..dde838155 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -1571,6 +1571,12 @@ abstract class PaymentModuleCore extends Module } } } + /** + * This function is not being called because taxes are already saved correctly. + * The issue lies only in displaying the tax breakdown. + * + * $order->updateOrderDetailTax(); + */ } else { $error = Tools::displayError('Order creation failed'); PrestaShopLogger::addLog($error, 4, '0000002', 'Cart', intval($order->id_cart)); diff --git a/classes/order/Order.php b/classes/order/Order.php index 99814f532..39fe39691 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -2561,22 +2561,38 @@ class OrderCore extends ObjectModel $tax_rates[$tax->id] = $tax->rate; } - if (!Product::isBookingProduct($order_detail['product_id'])) { - $quantity = Db::getInstance()->getValue( - 'SELECT SUM(`quantity`) - FROM `'._DB_PREFIX_.'service_product_order_detail` - WHERE `id_order_detail` = '.(int)$id_order_detail.' - AND `id_tax_rules_group` > 0 ' - ); - } $totalTaxBase = Tools::processPriceRounding($unit_price_tax_excl, $quantity); + if (!$order_detail['is_booking_product']) { + $objServiceProductOrderDetail = new ServiceProductOrderDetail(); + $serviceProductDetail = $objServiceProductOrderDetail->getServiceProductsInOrder( + $order_detail['id_order'], + $id_order_detail + ); + if ($serviceProductDetail = $objServiceProductOrderDetail->getServiceProductsInOrder( + $order_detail['id_order'], + $id_order_detail + )) { + $totals = array_reduce($serviceProductDetail, function ($carry, $item) { + if (!empty($item['id_tax_rules_group'])) { + $qty = isset($item['quantity']) ? $item['quantity'] : 0; + $price = isset($item['unit_price_tax_excl']) ? $item['unit_price_tax_excl'] : 0; + + $carry['quantity'] += $qty; + $carry['total_price_tax_excl'] += $price; + } + return $carry; + }, ['quantity' => 0, 'total_price_tax_excl' => 0]); + $quantity = $totals['quantity']; + $totalTaxBase = $totals['total_price_tax_excl']; + } + } $objServiceProductOrderDetail = new ServiceProductOrderDetail(); $groupedTaxDetails = array(); $additionalTaxAmounts = array(); if ( - Product::isBookingProduct($order_detail['product_id']) && + $order_detail['is_booking_product'] && $autoAddedPriceExcl = $objServiceProductOrderDetail->getRoomTypeServiceProducts( $order_detail['id_order'], 0, 0, diff --git a/classes/order/OrderDetail.php b/classes/order/OrderDetail.php index b0e165b1d..75d254e40 100644 --- a/classes/order/OrderDetail.php +++ b/classes/order/OrderDetail.php @@ -404,7 +404,7 @@ class OrderDetailCore extends ObjectModel /** * Calculate tax rule groups for the service product based on each associated room type. */ - if (!Product::isBookingProduct($this->product_id)) { + if (!$this->is_booking_product && $this->selling_preference_type == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) { // Get all associated room type IDs for this service product and cart $associatedRoomTypes = Db::getInstance()->executeS( 'SELECT hcbd.`id_product` @@ -420,22 +420,21 @@ class OrderDetailCore extends ObjectModel $taxGroupInfoList = array(); foreach ($associatedRoomTypeIds as $idRoomType) { - $taxGroupInfo = Db::getInstance()->getRow( - 'SELECT `id_element`, `id_tax_rules_group` - FROM `'._DB_PREFIX_.'htl_room_type_service_product_price` - WHERE `id_product` = '.(int)$this->product_id.' - AND `id_element` = '.(int)$idRoomType - ); - - if ($taxGroupInfo) { - // Specific tax rules found - $taxGroupInfoList[] = $taxGroupInfo; - } else { - // Use default tax rule for the service product - $defaultTaxGroupId = (int)Product::getIdTaxRulesGroupByIdProduct($this->product_id, $this->context); + if ($serviceProductPriceRoomInfo = RoomTypeServiceProductPrice::getProductRoomTypePriceAndTax( + $this->product_id, + $idRoomType, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + )) { + //Special tax rule group for the Service product accroding to Room type $taxGroupInfoList[] = array( - 'id_element' => $idRoomType, - 'id_tax_rules_group' => $defaultTaxGroupId + 'id_room_type' => $idRoomType, + 'id_tax_rules_group' => $serviceProductPriceRoomInfo['id_tax_rules_group'] + ); + } else { + // Use default tax rule group for the service product + $taxGroupInfoList[] = array( + 'id_room_type' => $idRoomType, + 'id_tax_rules_group' => $objOrderDetail->id_tax_rules_group ); } } @@ -446,7 +445,7 @@ class OrderDetailCore extends ObjectModel * Calculate service product tax separately for each room type because * a service product can be attached to multiple room types with different tax rules. */ - if (!Product::isBookingProduct($this->product_id) && isset($taxGroupInfoList) && $taxGroupInfoList) { + if (!$this->is_booking_product && isset($taxGroupInfoList) && $taxGroupInfoList) { $objServiceProductCartDetail = new ServiceProductCartDetail(); // Saving tax details according to the service product tax groups for different rooms foreach ($taxGroupInfoList as $taxGroupInfo) { @@ -470,15 +469,22 @@ class OrderDetailCore extends ObjectModel array(), null, null, - $taxGroupInfo['id_element'], + $taxGroupInfo['id_room_type'], $this->product_id ); - $serviceProduct = array_shift($serviceProductCartData); - $unit_price_tax_excl = $serviceProduct['unit_price_tax_excl']; + $total_price_tax_excl = array_reduce($serviceProductCartData, function ($totalPriceTaxExcl, $item) { + return $totalPriceTaxExcl + (isset($item['total_price_tax_excl']) ? $item['total_price_tax_excl'] : 0); + }, 0); + + $quantity = array_reduce($serviceProductCartData, function ($totalQty, $item) { + return $totalQty + (isset($item['quantity']) ? $item['quantity'] : 0); + }, 0); + + $unit_price_tax_excl = $total_price_tax_excl / $quantity; foreach ($this->tax_calculator->getTaxesAmount($unit_price_tax_excl) as $id_tax => $amount) { - $total_amount = Tools::processPriceRounding($amount, $serviceProduct['quantity'], $order->round_type, $order->round_mode); + $total_amount = Tools::processPriceRounding($amount, $quantity, $order->round_type, $order->round_mode); $values .= '('.(int)$this->id.','.(int)$id_tax.','.(float)$amount.','.(float)$total_amount.'),'; } diff --git a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php index 76151f738..6802a6700 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php @@ -77,37 +77,41 @@ class ServiceProductOrderDetail extends ObjectModel { if (Validate::isLoadedObject($objOrder = new Order((int)$this->id_order)) && Validate::isLoadedObject($objServiceProduct = new Product((int)$this->id_product)) + && Validate::isLoadedObject($objOrderDetail = new OrderDetail((int)$this->id_order_detail)) ) { - $objAddress = new Address((int)$objOrder->id_address_tax); - $idRoomType = Db::getInstance()->getValue( - 'SELECT `id_product` - FROM `'._DB_PREFIX_.'htl_booking_detail` - WHERE `id` = '.(int)$this->id_htl_booking_detail - ); + if ($objOrderDetail->selling_preference_type == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) { + if ($this->id_htl_booking_detail + && Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail((int)$this->id_htl_booking_detail)) + ) { + $idRoomType = $objHotelBookingDetail->id_product; + $objAddress = new Address((int)$objOrder->id_address_tax); + if ($objServiceProduct->auto_add_to_cart && $objServiceProduct->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM) { + if (Validate::isLoadedObject($objRoomTypeProduct = new Product((int)$idRoomType))) { + $this->id_tax_rules_group = $objRoomTypeProduct->id_tax_rules_group; + } + } else { + if ($serviceProductPriceRoomInfo = RoomTypeServiceProductPrice::getProductRoomTypePriceAndTax( + $this->id_product, + $idRoomType, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + )) { + //Special tax rule group for the Service product accroding to Room type + $this->id_tax_rules_group = $serviceProductPriceRoomInfo['id_tax_rules_group']; + } else { + // Use default tax rule group for the service product + $this->id_tax_rules_group = $objOrderDetail->id_tax_rules_group; + } + } - if ($objServiceProduct->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM && $objServiceProduct->auto_add_to_cart) { - if (Validate::isLoadedObject($objRoomTypeProduct = new Product((int)$idRoomType))) { - $this->id_tax_rules_group = $objRoomTypeProduct->id_tax_rules_group; + $taxCalculator = TaxManagerFactory::getManager($objAddress, $this->id_tax_rules_group)->getTaxCalculator(); + $this->tax_computation_method = (int)$taxCalculator->computation_method; } } else { - $idTaxRulesGroup = Db::getInstance()->getValue( - 'SELECT `id_tax_rules_group` - FROM `'._DB_PREFIX_.'htl_room_type_service_product_price` - WHERE `id_product` = '.(int)$this->id_product.' - AND `id_element` = '.(int)$idRoomType - ); - - if ($idTaxRulesGroup === false || $idTaxRulesGroup === null) { - // Use default tax rule for the service product - $idTaxRulesGroup = (int)Product::getIdTaxRulesGroupByIdProduct($this->id_product, Context::getContext()); - } - - $this->id_tax_rules_group = $idTaxRulesGroup; + // Use default tax rule group for the service product + $this->id_tax_rules_group = $objOrderDetail->id_tax_rules_group; + $this->tax_computation_method = $objOrderDetail->tax_computation_method; } - $taxCalculator = TaxManagerFactory::getManager($objAddress, $this->id_tax_rules_group)->getTaxCalculator(); - $this->tax_computation_method = (int)$taxCalculator->computation_method; - return parent::add($autodate, $null_values); } From f6c188025b49a999bc534a957043ec25ae87e7f8 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 20 Jun 2025 15:49:54 +0530 Subject: [PATCH 10/39] Fixed: total_paid not showing in check and bankwire --- modules/bankwire/bankwire.php | 3 ++- modules/bankwire/views/templates/mail/mail_template_html.tpl | 2 +- modules/bankwire/views/templates/mail/mail_template_text.tpl | 2 +- modules/cheque/cheque.php | 3 ++- modules/cheque/views/templates/mail/mail_template_html.tpl | 2 +- modules/cheque/views/templates/mail/mail_template_text.tpl | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php index b395b10a0..f90c68feb 100644 --- a/modules/bankwire/bankwire.php +++ b/modules/bankwire/bankwire.php @@ -83,7 +83,8 @@ class Bankwire extends PaymentModule 'bankwire_owner' => Configuration::get('BANK_WIRE_OWNER'), 'bankwire_details' => nl2br(Configuration::get('BANK_WIRE_DETAILS')), 'bankwire_address' => nl2br(Configuration::get('BANK_WIRE_ADDRESS')), - 'lang' => new Language($order->id_lang) + 'lang' => new Language($order->id_lang), + 'total_paid' => Tools::displayPrice($order->total_paid, $this->context->currency, false) )); return array( diff --git a/modules/bankwire/views/templates/mail/mail_template_html.tpl b/modules/bankwire/views/templates/mail/mail_template_html.tpl index ac5f35d46..71d7217ea 100644 --- a/modules/bankwire/views/templates/mail/mail_template_html.tpl +++ b/modules/bankwire/views/templates/mail/mail_template_html.tpl @@ -27,7 +27,7 @@ {l s='Here are the bank details for your transfer:' mod='bankwire' lang=$lang}

- {l s='Amount:' mod='bankwire' lang=$lang} {literal}{total_paid}{/literal}
+ {l s='Amount:' mod='bankwire' lang=$lang} {$total_paid}
{l s='Account owner:' mod='bankwire' lang=$lang} {$bankwire_owner}
{l s='Account details:' mod='bankwire' lang=$lang} {$bankwire_details}
{l s='Bank address:' mod='bankwire' lang=$lang} {$bankwire_address} diff --git a/modules/bankwire/views/templates/mail/mail_template_text.tpl b/modules/bankwire/views/templates/mail/mail_template_text.tpl index c15a111f6..f187d745d 100644 --- a/modules/bankwire/views/templates/mail/mail_template_text.tpl +++ b/modules/bankwire/views/templates/mail/mail_template_text.tpl @@ -18,7 +18,7 @@ *} {l s='Here are the bank details for your transfer:' mod='bankwire'} -{l s='Amount:' mod='bankwire'} {literal}{total_paid}{/literal} +{l s='Amount:' mod='bankwire'} {$total_paid} {l s='Account owner:' mod='bankwire'} {$bankwire_owner} {l s='Account details:' mod='bankwire'} {$bankwire_details} {l s='Bank address:' mod='bankwire'} {$bankwire_address} diff --git a/modules/cheque/cheque.php b/modules/cheque/cheque.php index fc888108d..4cdcadcd7 100644 --- a/modules/cheque/cheque.php +++ b/modules/cheque/cheque.php @@ -78,7 +78,8 @@ class Cheque extends PaymentModule 'cheque_name' => Configuration::get('CHEQUE_NAME'), 'cheque_address' => Configuration::get('CHEQUE_ADDRESS'), 'cheque_address_html' => str_replace("\n", '
', Configuration::get('CHEQUE_ADDRESS')), - 'lang' => new Language($order->id_lang) + 'lang' => new Language($order->id_lang), + 'total_paid' => Tools::displayPrice($order->total_paid, $this->context->currency, false) )); return array( diff --git a/modules/cheque/views/templates/mail/mail_template_html.tpl b/modules/cheque/views/templates/mail/mail_template_html.tpl index d6ade1dac..59e845fc6 100644 --- a/modules/cheque/views/templates/mail/mail_template_html.tpl +++ b/modules/cheque/views/templates/mail/mail_template_html.tpl @@ -27,7 +27,7 @@ {l s='Here are the bank details for your check:' mod='cheque' lang=$lang}

- {l s='Amount:' mod='cheque' lang=$lang} {literal}{total_paid}{/literal}
+ {l s='Amount:' mod='cheque' lang=$lang} {$total_paid}
{l s='Payable to the order of:' mod='cheque' lang=$lang} {$cheque_name}
{l s='Please mail your check to:' mod='cheque' lang=$lang} {$cheque_address_html}
diff --git a/modules/cheque/views/templates/mail/mail_template_text.tpl b/modules/cheque/views/templates/mail/mail_template_text.tpl index adc2c0ac6..ecf5044ec 100644 --- a/modules/cheque/views/templates/mail/mail_template_text.tpl +++ b/modules/cheque/views/templates/mail/mail_template_text.tpl @@ -18,6 +18,6 @@ *} {l s='Here are the bank details for your check:' mod='cheque' lang=$lang} -{l s='Amount:' mod='cheque' lang=$lang} {literal}{total_paid}{/literal} +{l s='Amount:' mod='cheque' lang=$lang} {$total_paid} {l s='Payable to the order of:' mod='cheque' lang=$lang} {$cheque_name} {l s='Please mail your check to:' mod='cheque' lang=$lang} {$cheque_address} From 513faf92cf47f6156e2077e19d26a74a9357c20d Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 20 Jun 2025 16:20:28 +0530 Subject: [PATCH 11/39] Fixed: warnings on the admin orders page in the back office --- .../controllers/orders/modals/_discount_form.tpl | 2 +- .../controllers/orders/modals/_order_payment_form.tpl | 2 +- controllers/admin/AdminOrdersController.php | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_discount_form.tpl b/admin/themes/default/template/controllers/orders/modals/_discount_form.tpl index 32838a5e1..f41dd0905 100644 --- a/admin/themes/default/template/controllers/orders/modals/_discount_form.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_discount_form.tpl @@ -55,7 +55,7 @@
{if $order->hasInvoice()} -
+ @@ -62,8 +80,16 @@ {l s='Date From'} {l s='Date To'} - {l s='Minimum length of stay'} - {l s='Maximum length of stay'} + + + + + + From 475a547bd69b20ca2c3b8a104f250a692bacf961 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 23 Jun 2025 18:30:31 +0530 Subject: [PATCH 25/39] Updated the Google Maps API endpoints for improved performance and compatibility --- controllers/front/ContactController.php | 5 +- controllers/front/GuestTrackingController.php | 4 +- controllers/front/OrderDetailController.php | 5 +- controllers/front/OurPropertiesController.php | 7 +- controllers/front/ProductController.php | 14 +- .../admin/AdminAddHotelController.php | 13 +- .../AdminHotelGeneralSettingsController.php | 5 + .../hotelreservationsystem.php | 6 +- .../views/css/HotelReservationAdmin.css | 3 - .../views/js/HotelReservationAdmin.js | 188 ++++++------------ .../views/js/searchResultsMap.js | 39 ++-- .../admin/add_hotel/helpers/form/form.tpl | 2 +- .../js/contact-form.js | 28 +-- .../js/order-detail.js | 37 ++-- .../js/our-properties.js | 23 +-- themes/hotel-reservation-theme/js/product.js | 19 +- 16 files changed, 171 insertions(+), 227 deletions(-) diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index 06e8b0759..1014a8b5f 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -237,15 +237,16 @@ class ContactControllerCore extends FrontController $this->addJS(_PS_JS_DIR_.'validate.js'); // GOOGLE MAP - if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { + if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && ($PS_MAP_ID = Configuration::get('PS_MAP_ID')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { Media::addJsDef( array( 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), + 'PS_MAP_ID' => $PS_MAP_ID, ) ); $this->addJS( 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY. - '&libraries=places&language='.$this->context->language->iso_code.'®ion='.$this->context->country->iso_code + '&libraries=places,marker&loading=async&callback=initMap&language='.$this->context->language->iso_code.'®ion='.$this->context->country->iso_code ); } } diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php index 9a9df2490..596d54185 100644 --- a/controllers/front/GuestTrackingController.php +++ b/controllers/front/GuestTrackingController.php @@ -639,6 +639,7 @@ class GuestTrackingControllerCore extends FrontController if (Validate::isLoadedObject($objHotelBranchInformation)) { if (($apiKey = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP') + && ($PS_MAP_ID = Configuration::get('PS_MAP_ID')) ) { if (floatval($objHotelBranchInformation->latitude) != 0 && floatval($objHotelBranchInformation->longitude) != 0 @@ -646,10 +647,11 @@ class GuestTrackingControllerCore extends FrontController Media::addJsDef(array( 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), 'initiateMap' => 1, + 'PS_MAP_ID' => $PS_MAP_ID, )); $this->addJS( - 'https://maps.googleapis.com/maps/api/js?key='.$apiKey.'&libraries=places&language='. + 'https://maps.googleapis.com/maps/api/js?key='.$apiKey.'&libraries=places,marker&loading=async&callback=initMap&language='. $this->context->language->iso_code.'®ion='.$this->context->country->iso_code ); diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index 6be63643b..40f3edaf6 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -871,6 +871,7 @@ class OrderDetailControllerCore extends FrontController if (Validate::isLoadedObject($objHotelBranchInformation)) { if (($apiKey = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP') + && ($PS_MAP_ID = Configuration::get('PS_MAP_ID')) ) { if (floatval($objHotelBranchInformation->latitude) != 0 && floatval($objHotelBranchInformation->longitude) != 0 @@ -878,10 +879,10 @@ class OrderDetailControllerCore extends FrontController Media::addJsDef(array( 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), 'initiateMap' => 1, + 'PS_MAP_ID' => $PS_MAP_ID, )); - $this->addJS( - 'https://maps.googleapis.com/maps/api/js?key='.$apiKey.'&libraries=places&language='. + 'https://maps.googleapis.com/maps/api/js?key='.$apiKey.'&libraries=places,marker&loading=async&callback=initMap&language='. $this->context->language->iso_code.'®ion='.$this->context->country->iso_code ); } diff --git a/controllers/front/OurPropertiesController.php b/controllers/front/OurPropertiesController.php index cb651ba1b..52fd94a86 100644 --- a/controllers/front/OurPropertiesController.php +++ b/controllers/front/OurPropertiesController.php @@ -111,7 +111,7 @@ class OurPropertiesControllerCore extends FrontController $hotelsInfo = array_slice($hotelsInfo, $page * 10, 10); } - if ($displayHotelMap && Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { + if ($displayHotelMap && Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP') && Configuration::get('PS_MAP_ID')) { if ($hotelLocations = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY'))) { $hotelLocationArray = str_replace(array('\n', '\r'), '', json_encode($hotelLocations)); } @@ -144,16 +144,17 @@ class OurPropertiesControllerCore extends FrontController $this->addJS(_THEME_JS_DIR_.'our-properties.js'); $this->addCSS(_THEME_CSS_DIR_.'our-properties.css'); // GOOGLE MAP - if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { + if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && ($PS_MAP_ID = Configuration::get('PS_MAP_ID')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { Media::addJsDef( array( 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), + 'PS_MAP_ID' => $PS_MAP_ID ) ); $this->addJS( 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY. - '&libraries=places&language='.$this->context->language->iso_code.'®ion='.$this->context->country->iso_code + '&libraries=places,marker&loading=async&callback=initMap&language='.$this->context->language->iso_code.'®ion='.$this->context->country->iso_code ); } } diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 24cc682af..67627e5ac 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -66,10 +66,11 @@ class ProductControllerCore extends FrontController $this->addJqueryPlugin('jqzoom'); } - if (($PS_API_KEY = Configuration::get('PS_API_KEY'))) { + if (($PS_API_KEY = Configuration::get('PS_API_KEY')) + && ($PS_MAP_ID = Configuration::get('PS_MAP_ID')) + ) { $objHotelRoomType = new HotelRoomType(); - $roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->product->id); - if ($roomTypeInfo) { + if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->product->id)) { $objHotelBranchInformation = new HotelBranchInformation($roomTypeInfo['id_hotel']); if (floatval($objHotelBranchInformation->latitude) != 0 && floatval($objHotelBranchInformation->longitude) != 0 @@ -79,12 +80,13 @@ class ProductControllerCore extends FrontController 'latitude' => $objHotelBranchInformation->latitude, 'longitude' => $objHotelBranchInformation->longitude, ), - 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')) + 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), + 'PS_MAP_ID' => $PS_MAP_ID )); $this->addJS( - 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY.'&libraries=places&language='. - $this->context->language->iso_code.'®ion='.$this->context->country->iso_code + 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY. + '&libraries=places,marker&loading=async&callback=initMap&language='.$this->context->language->iso_code.'®ion='.$this->context->country->iso_code ); } } diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index 08813efcb..75feb0dd4 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -214,7 +214,7 @@ class AdminAddHotelController extends ModuleAdminController } $smartyVars['state_var'] = $stateOptions; - $smartyVars['enabledDisplayMap'] = Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP'); + $smartyVars['enabledDisplayMap'] = Configuration::get('PS_API_KEY') && Configuration::get('PS_MAP_ID') && Configuration::get('WK_GOOGLE_ACTIVE_MAP'); $smartyVars['ps_img_dir'] = _PS_IMG_.'l/'; $smartyVars['PS_MAX_CHECKOUT_OFFSET'] = (int) Configuration::get('PS_MAX_CHECKOUT_OFFSET'); $smartyVars['PS_MIN_BOOKING_OFFSET'] = (int) Configuration::get('PS_MIN_BOOKING_OFFSET'); @@ -605,8 +605,8 @@ class AdminAddHotelController extends ModuleAdminController $objHotelBranch->check_in = $check_in; $objHotelBranch->check_out = $check_out; $objHotelBranch->rating = $rating; - $objHotelBranch->latitude = $latitude; - $objHotelBranch->longitude = $longitude; + $objHotelBranch->latitude = Tools::ps_round($latitude, 8); + $objHotelBranch->longitude = Tools::ps_round($longitude, 8); $objHotelBranch->map_formated_address = $map_formated_address; $objHotelBranch->map_input_text = $map_input_text; $objHotelBranch->save(); @@ -984,15 +984,16 @@ class AdminAddHotelController extends ModuleAdminController 'primaryHotelId' => Configuration::get('WK_PRIMARY_HOTEL'), 'disableHotelMsg' => $this->l('Primary hotel for website will be updated to first available active hotel.', null, true), 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), + 'PS_MAP_ID' => ($PS_MAP_ID = Configuration::get('PS_MAP_ID')) ) ); // GOOGLE MAP $language = $this->context->language; $country = $this->context->country; - if ($PS_API_KEY = Configuration::get('PS_API_KEY')) { + if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && $PS_MAP_ID) { $this->addJS( - 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY.'&libraries=places&language='. - $language->iso_code.'®ion='.$country->iso_code + 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY.'&libraries=places,marker&loading=async&language='. + $language->iso_code.'®ion='.$country->iso_code.'&callback=initGoogleMaps' ); } //tinymce diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index ca6e55912..9cc4d589a 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -397,6 +397,11 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'hint' => $this->l('Unique API key for Google Maps.'), 'type' => 'text', ), + 'PS_MAP_ID' => array( + 'title' => $this->l('Google Maps Id'), + 'hint' => $this->l('Map Id for Google Maps.'), + 'type' => 'text' + ), 'WK_GOOGLE_ACTIVE_MAP' => array( 'title' => $this->l('Display Google Maps For Hotel Location'), 'cast' => 'intval', diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 8da3931ea..41b38b695 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -285,6 +285,7 @@ class HotelReservationSystem extends Module if (Tools::getValue('controller') == 'category') { if (($apiKey = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP') + && ($PS_MAP_ID = Configuration::get('PS_MAP_ID')) ) { $idCategory = Tools::getValue('id_category'); $idHotel = HotelBranchInformation::getHotelIdByIdCategory($idCategory); @@ -299,13 +300,14 @@ class HotelReservationSystem extends Module 'longitude' => $objHotel->longitude, 'map_input_text' => $objHotel->map_input_text, ), + 'PS_MAP_ID' => $PS_MAP_ID, 'hotel_name' => $objHotel->hotel_name, 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), )); $this->context->controller->addJS( - 'https://maps.googleapis.com/maps/api/js?key='.$apiKey.'&libraries=places&language='. - $this->context->language->iso_code.'®ion='.$this->context->country->iso_code + 'https://maps.googleapis.com/maps/api/js?key='.$apiKey. + '&libraries=places,marker&loading=async&callback=initMap&language='.$this->context->language->iso_code.'®ion='.$this->context->country->iso_code ); $this->context->controller->addJS($this->getPathUri().'views/js/searchResultsMap.js'); $this->context->controller->addCSS($this->getPathUri().'views/css/searchResultsMap.css'); diff --git a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css index 5dd54412f..b27f73368 100644 --- a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css +++ b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css @@ -472,10 +472,7 @@ p.room_cat_data } #pac-input { - background-color: #fff; - height: 38px; width: 300px; - font-size: 14px; text-overflow: ellipsis; } diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index c6e6a80a2..24d0ea886 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -22,17 +22,12 @@ var GoogleMapsManager = { defaultZoom: 10, map: null, markers: [], - placesService: null, + placeService: null, init: function(jQDiv) { this.mapDiv = jQDiv; this.geocoder = new google.maps.Geocoder(); }, - setPlacesService: function() { - if (!this.placesService && this.map) { - this.placesService = new google.maps.places.PlacesService(this.map); - } - }, setDefaultLatLng: function(cb) { if (!this.defaultLatLng) { var latitude = Number($("#loclatitude").val()); @@ -64,6 +59,24 @@ var GoogleMapsManager = { } } }, + fetchFields: async function(request) { + if (!request.placeId) return; + const place = new google.maps.places.Place({ + id: request.placeId + }); + + const fieldsRequest = { + fields: ["displayName", "formattedAddress", "location"] + }; + + try { + await place.fetchFields(fieldsRequest); + this.placeService = place; + return place; + } catch (error) { + console.log(error); + } + }, initMap: function(cb) { if (!this.map) { var that = this; @@ -71,85 +84,26 @@ var GoogleMapsManager = { that.map = new google.maps.Map($(that.mapDiv).get(0), { zoom: that.defaultZoom, clickableIcons: true, + mapId: PS_MAP_ID }); that.map.setCenter(that.defaultLatLng); if (that.defaultLatLng && that.formattedAddress) { that.addMarker(that.defaultLatLng, null, that.formattedAddress); } - that.setPlacesService(); - // register marker events that.map.addListener('click', function (e) { var latLng = e.latLng; - - var isInfoWindowNeeded = true; // if it is a Place Of Interest (POI), event contains the property 'placeId' if (Object.hasOwn(e, 'placeId')) { - isInfoWindowNeeded = false; - - that.geocoder.geocode({ location: latLng }, function (results, status) { - if (status == google.maps.GeocoderStatus.OK && results[0]) { - var request = { - placeId: e.placeId, - fields: ['name'], - }; - - that.placesService.getDetails(request, function(place, status) { - if (status === google.maps.places.PlacesServiceStatus.OK) { - var content = '
' + place.name + '

' + - results[0].formatted_address + '

'; - - var callback = function (latLng) { - that.setFormVars({ - lat: latLng.lat(), - lng: latLng.lng(), - formattedAddress: content, - inputText: $('#pac-input').val(), - }); - } - - that.addMarker( - latLng, - results[0], - null, - isInfoWindowNeeded, - callback(latLng) - ); - } - }); + that.fetchFields({ placeId: e.placeId }).then(place => { + if (place && place.location) { + that.addMarker(place.location, null, place.formattedAddress); } }); } else { - that.geocoder.geocode({ location: latLng }, function (results, status) { - if (status == google.maps.GeocoderStatus.OK && results[0]) { - var request = { - placeId: results[0].place_id, - fields: ['name'], - }; - - that.placesService.getDetails(request, function(place, status) { - if (status === google.maps.places.PlacesServiceStatus.OK) { - var content = '
' + place.name + '

' + - results[0].formatted_address + '

'; - - var callback = function (latLng) { - that.setFormVars({ - lat: latLng.lat(), - lng: latLng.lng(), - formattedAddress: content, - inputText: $('#pac-input').val(), - }); - } - - that.addMarker( - latLng, - results[0], - null, - isInfoWindowNeeded, - callback(latLng) - ); - } - }); + that.geocoder.geocode({ location: latLng }, function(results, status) { + if (status === 'OK' && results[0]) { + that.addMarker(latLng, null, results[0].formatted_address); } }); } @@ -163,42 +117,37 @@ var GoogleMapsManager = { cb(); } } - }, initAutocomplete: function(jQInput, cb) { var that = this; that.initMap(function() { that.autocompleteInput = jQInput; var input = $(that.autocompleteInput).get(0); - that.map.controls[google.maps.ControlPosition.TOP_CENTER].push(input); - that.autocomplete = new google.maps.places.Autocomplete(input); - that.autocomplete.bindTo('bounds', that.map); - - that.autocomplete.addListener('place_changed', function() { - that.clearAllMarkers(); - var place = that.autocomplete.getPlace(); - - if (place.geometry.viewport) { - that.map.fitBounds(place.geometry.viewport); - } else { - that.map.setCenter(place.geometry.location); - that.map.setZoom(18); - } - var latLng = { - lat: place.geometry.location.lat(), - lng: place.geometry.location.lng(), - }; - that.addMarker(latLng, place); - - var content = '
' + place.name + '

' + place.formatted_address + '

'; - that.setFormVars({ - lat: latLng.lat, - lng: latLng.lng, - formattedAddress: content, - inputText: $('#pac-input').val(), - }); + that.autocomplete = new google.maps.places.PlaceAutocompleteElement({ + locationRestriction: that.map.getBounds() }); + that.autocomplete.id = "place-autocomplete-input"; + input.appendChild(that.autocomplete); + + that.map.controls[google.maps.ControlPosition.TOP_LEFT].push(input); + that.infoWindow = new google.maps.InfoWindow({}); + that.autocomplete.addEventListener("gmp-select", async (event) => { + const place = event.placePrediction.toPlace(); + + await place.fetchFields({ + fields: ["displayName", "formattedAddress", "location", "viewport"] + }); + // Fit the map to the place + if (place.viewport) { + that.map.fitBounds(place.viewport); + } else { + that.map.setCenter(place.location); + that.map.setZoom(18); + } + + that.addMarker(place.location, null, place.formattedAddress); + }); google.maps.event.addDomListener(input, 'keydown', function (e) { if (e.keyCode === 13) { e.preventDefault(); @@ -213,11 +162,17 @@ var GoogleMapsManager = { addMarker: function(latLng, address = null, fa = null, addInfoWindow = true, cb = null) { var that = this; that.clearAllMarkers(); - var marker = new google.maps.Marker({ + + let icon = document.createElement('img'); + icon.src = PS_STORES_ICON; + icon.style.width = '24px'; + icon.style.height = '24px'; + + var marker = new google.maps.marker.AdvancedMarkerElement({ position: latLng, map: that.map, + content: icon, draggable: true, - icon: PS_STORES_ICON }); that.markers.push(marker); marker.addListener('dragend', function(e) { @@ -237,22 +192,11 @@ var GoogleMapsManager = { // open info window that.addInfoWindow(marker, fa); } else { - var request = { - placeId: address.place_id, - fields: ['name'], - }; - - that.placesService.getDetails(request, function(place, status) { - if (status === google.maps.places.PlacesServiceStatus.OK) { - // open info window - var content = '
' + place.name + '

' + address.formatted_address + '

'; - that.addInfoWindow(marker, content); - - if(cb && typeof cb === 'function') { - cb(); - } - } - }); + var content = '
' + this.placeService.displayName + '

' + address.formatted_address + '

'; + that.addInfoWindow(marker, content); + if(cb && typeof cb === 'function') { + cb(); + } } } else { if(cb && typeof cb === 'function') { @@ -287,10 +231,10 @@ var GoogleMapsManager = { that.clearAllMarkers(); }); - var latLng = marker.getPosition(); + var latLng = marker.position; that.setFormVars({ - lat: latLng.lat(), - lng: latLng.lng(), + lat: latLng.lat, + lng: latLng.lng, formattedAddress: content, inputText: $('#pac-input').val(), }); @@ -988,8 +932,6 @@ $(document).ready(function() { $('input[name="min_booking_offset"]').closest('.form-group').show(200); } }); - - initGoogleMaps(); }); function toggleGoogleMapsFields() diff --git a/modules/hotelreservationsystem/views/js/searchResultsMap.js b/modules/hotelreservationsystem/views/js/searchResultsMap.js index f24c762c4..39fc4faf7 100644 --- a/modules/hotelreservationsystem/views/js/searchResultsMap.js +++ b/modules/hotelreservationsystem/views/js/searchResultsMap.js @@ -28,33 +28,36 @@ function initMap() { center: hotelLocation, disableDefaultUI: true, fullscreenControl: true, + mapId: PS_MAP_ID }); - const marker = new google.maps.Marker({ - position: hotelLocation, + let icon = document.createElement('img'); + icon.src = PS_STORES_ICON; + icon.style.width = '24px'; + icon.style.height = '24px'; + + const marker = new google.maps.marker.AdvancedMarkerElement({ map: map, - title: hotel_name, - icon: PS_STORES_ICON + position: hotelLocation, + title: location.hotel_name, + content: icon, }); + marker.query = location.query || null; + marker.latitude = hotelLocation.lat; + marker.longitude = hotelLocation.lng; + marker.addListener('click', function() { let query = ''; - if (hotel_location.map_input_text != '') { - query = hotel_location.map_input_text; - } else { - query = hotel_location.latitude + ',' + hotel_location.longitude; + if (this.query) { + query = this.query; + } else if (this.latitude && this.longitude) { + query = `${this.latitude},${this.longitude}`; } - window.open('https://www.google.com/maps/search/?api=1&query='+encodeURIComponent(query), '_blank'); + if (query) { + window.open(`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(query)}`, '_blank'); + } }); } -$(document).ready(function() { - if (typeof hotel_location == 'object' - && $('#search-results-wrap .map-wrap').length - && typeof google == 'object' - && typeof google.maps == 'object' - ) { - initMap(); - } -}); diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index db7b2070a..1fd9dd071 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -303,7 +303,7 @@ - +
diff --git a/themes/hotel-reservation-theme/js/contact-form.js b/themes/hotel-reservation-theme/js/contact-form.js index 4f8f51dc2..9b16260d5 100644 --- a/themes/hotel-reservation-theme/js/contact-form.js +++ b/themes/hotel-reservation-theme/js/contact-form.js @@ -48,15 +48,6 @@ $(document).ready(function() { }); showProductSelect($('select[name=id_order]').attr('value')); - - //By Webkul JS for Map locations of the hotels on google Map - if (typeof hotelLocationArray != 'undefined' - && $('#map').length - && typeof google == 'object' - && typeof google.maps == 'object' - ) { - initMap(); - } }); function showProductSelect(id_order) { @@ -75,7 +66,7 @@ function initMap() { hotelLocationArray = JSON.parse(hotelLocationArray); // Display a map on the page - map = new google.maps.Map(document.getElementById("map")); + map = new google.maps.Map(document.getElementById("map"), {mapId: PS_MAP_ID}); google.maps.event.trigger(map, 'resize'); map.setTilt(45); @@ -88,14 +79,17 @@ function initMap() { $.each(hotelLocationArray, function(i, location) { var position = new google.maps.LatLng(location.latitude, location.longitude); bounds.extend(position); - marker = new google.maps.Marker({ - position: position, - map: map, - title: location.hotel_name, - animation: google.maps.Animation.DROP, - icon: PS_STORES_ICON - }); + let icon = document.createElement('img'); + icon.src = PS_STORES_ICON; + icon.style.width = '24px'; + icon.style.height = '24px'; + marker = new google.maps.marker.AdvancedMarkerElement({ + map: map, + position: position, + title: location.hotel_name, + content: icon, + }); // Allow each marker to have an info window google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { diff --git a/themes/hotel-reservation-theme/js/order-detail.js b/themes/hotel-reservation-theme/js/order-detail.js index b60101ccf..800440304 100644 --- a/themes/hotel-reservation-theme/js/order-detail.js +++ b/themes/hotel-reservation-theme/js/order-detail.js @@ -144,24 +144,36 @@ function initMap() { center: hotelLocation, disableDefaultUI: true, fullscreenControl: true, + mapId: PS_MAP_ID }); - const marker = new google.maps.Marker({ + let icon = document.createElement('img'); + icon.src = PS_STORES_ICON; + icon.style.width = '24px'; + icon.style.height = '24px'; + + const marker = new google.maps.marker.AdvancedMarkerElement({ position: hotelLocation, map: map, - title: $(this).attr('title'), - icon: PS_STORES_ICON + title: location.hotel_name, + content: icon, }); + marker.query = location.query || null; + marker.latitude = hotelLocation.lat; + marker.longitude = hotelLocation.lng; + marker.addListener('click', function() { let query = ''; - if ($(this).attr('query') != '') { - query = $(this).attr('query'); - } else { - query = $(this).attr('latitude') + ',' + $(this).attr('longitude'); + if (this.query) { + query = this.query; + } else if (this.latitude && this.longitude) { + query = `${this.latitude},${this.longitude}`; } - window.open('https://www.google.com/maps/search/?api=1&query='+encodeURIComponent(query), '_blank'); + if (query) { + window.open(`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(query)}`, '_blank'); + } }); }); } @@ -376,14 +388,5 @@ $(document).ready(function () { }); initPriceTooltip(); - - if (typeof google === 'object' - && typeof google.maps === 'object' - && typeof initiateMap !== 'undefined' - && initiateMap === 1 - ) { - initMap(); - } - initRefundDeniedTooltip(); }); diff --git a/themes/hotel-reservation-theme/js/our-properties.js b/themes/hotel-reservation-theme/js/our-properties.js index ba9408875..81a0d0be9 100644 --- a/themes/hotel-reservation-theme/js/our-properties.js +++ b/themes/hotel-reservation-theme/js/our-properties.js @@ -21,15 +21,6 @@ */ $(document).ready(function() { - //By Webkul JS for Map locations of the hotels on google Map - if (typeof hotelLocationArray != 'undefined' - && $('#map').length - && typeof google == 'object' - && typeof google.maps == 'object' - ) { - initMap(); - } - $(document).on('click', 'ul.pagination li a', function(e){ e.preventDefault(); $('#pagination').val($(this).data('pagination')); @@ -43,7 +34,7 @@ function initMap() { hotelLocationArray = JSON.parse(hotelLocationArray); // Display a map on the page - map = new google.maps.Map(document.getElementById("map")); + map = new google.maps.Map(document.getElementById("map"), {mapId: PS_MAP_ID}); google.maps.event.trigger(map, 'resize'); map.setTilt(45); @@ -56,12 +47,16 @@ function initMap() { $.each(hotelLocationArray, function(i, location) { var position = new google.maps.LatLng(location.latitude, location.longitude); bounds.extend(position); - marker = new google.maps.Marker({ - position: position, + let icon = document.createElement('img'); + icon.src = PS_STORES_ICON; + icon.style.width = '24px'; + icon.style.height = '24px'; + + marker = new google.maps.marker.AdvancedMarkerElement({ map: map, + position: position, title: location.hotel_name, - animation: google.maps.Animation.DROP, - icon: PS_STORES_ICON + content: icon, }); // Allow each marker to have an info window diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js index 22e483de5..cfdaea6f1 100644 --- a/themes/hotel-reservation-theme/js/product.js +++ b/themes/hotel-reservation-theme/js/product.js @@ -1089,15 +1089,6 @@ $(document).ready(function() { } e.preventDefault(); }); - - if (typeof hotel_location == 'object' - && $('#room_type_map_tab .map-wrap').length - && typeof google == 'object' - && typeof google.maps == 'object' - ) { - initMap(); - } - // normal product $(document).on('click', '.add_roomtype_product', function(e){ e.preventDefault(); @@ -1306,6 +1297,7 @@ function initMap() { const map = new google.maps.Map($('#room_type_map_tab .map-wrap').get(0), { zoom: 10, streetViewControl: false, + mapId: PS_MAP_ID }); const hotelLatLng = { @@ -1314,11 +1306,14 @@ function initMap() { }; map.setCenter(hotelLatLng); - - const marker = new google.maps.Marker({ + let icon = document.createElement('img'); + icon.src = PS_STORES_ICON; + icon.style.width = '24px'; + icon.style.height = '24px'; + let marker = new google.maps.marker.AdvancedMarkerElement({ position: hotelLatLng, map: map, - icon: PS_STORES_ICON + content: icon, }); const uiContent = $('#room-info-map-ui-content .hotel-info-wrap').get(0); From 1073902026b963cd9ff896ea472e0316f62d1faa Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 23 Jun 2025 18:46:32 +0530 Subject: [PATCH 26/39] Updated the toolbar title for order for all display except view --- controllers/admin/AdminOrdersController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 41070e81b..c38e8088c 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -540,12 +540,12 @@ class AdminOrdersControllerCore extends AdminController public function initToolbarTitle() { parent::initToolbarTitle(); - switch ($this->display) { - case '': - case 'list': - array_pop($this->toolbar_title); - $this->toolbar_title[] = $this->l('Orders'); - break; + if ($this->display == 'add') { + array_pop($this->toolbar_title); + $this->toolbar_title[] = $this->l('Add new'); + } elseif ($this->display != 'view') { + array_pop($this->toolbar_title); + $this->toolbar_title[] = $this->l('Orders'); } } From a1d3d569bda6f5e1e1f50291273291cb95c77040 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 23 Jun 2025 19:18:30 +0530 Subject: [PATCH 27/39] Fixed: Unit price in the add-order page is not correct in-case a specific price is created and a feature price is applied on the room for the original amount --- .../controllers/orders/_current_cart_details_data.tpl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl index 088c112e8..98c575d33 100644 --- a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl +++ b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl @@ -115,11 +115,7 @@ {/if} - {if $data.feature_price_diff != 0} - {assign var=shown_room_type_price value=$data.feature_price_tax_excl} - {else} - {assign var=shown_room_type_price value=$data.product_price_tax_excl} - {/if} + {assign var=shown_room_type_price value=$data.feature_price_tax_excl}
{$currency->prefix}{$currency->suffix} From f615dda17c07d73a93a58d173754aa24c5ad0416 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 24 Jun 2025 11:55:55 +0530 Subject: [PATCH 28/39] Fixed: folder structure --- .../helpers/list/index.php | 0 .../helpers/list/list_header.tpl | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename modules/hotelreservationsystem/views/templates/admin/{hotel_features => hotel_feature_prices_settings}/helpers/list/index.php (100%) rename modules/hotelreservationsystem/views/templates/admin/{hotel_features => hotel_feature_prices_settings}/helpers/list/list_header.tpl (100%) diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_features/helpers/list/index.php b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/list/index.php similarity index 100% rename from modules/hotelreservationsystem/views/templates/admin/hotel_features/helpers/list/index.php rename to modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/list/index.php diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_features/helpers/list/list_header.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/list/list_header.tpl similarity index 100% rename from modules/hotelreservationsystem/views/templates/admin/hotel_features/helpers/list/list_header.tpl rename to modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/list/list_header.tpl From 347b2ee715f9c8045ed14d007b127e57e4d5ecf4 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 24 Jun 2025 12:17:10 +0530 Subject: [PATCH 29/39] Fixed: the click events for total rooms and total products KPIs in the order view page --- .../default/template/controllers/orders/helpers/view/view.tpl | 2 +- controllers/admin/AdminOrdersController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index 0bf76f7fe..6327e9f76 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -826,7 +826,7 @@
{hook h="displayAdminOrder" id_order=$order->id} -
+
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 41070e81b..23c370a5c 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2865,7 +2865,7 @@ 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_rooms'; + $helper->href = '#start_products'; $helper->value = $numRooms; $this->kpis[] = $helper; From 1f6c5019e4995027c0282572a5263d314323c10b Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 24 Jun 2025 12:35:46 +0530 Subject: [PATCH 30/39] Added: order customer guest detail table in the cleaner --- modules/qlocleaner/qlocleaner.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/qlocleaner/qlocleaner.php b/modules/qlocleaner/qlocleaner.php index f953ef1cb..03b6e8204 100644 --- a/modules/qlocleaner/qlocleaner.php +++ b/modules/qlocleaner/qlocleaner.php @@ -882,6 +882,7 @@ class QloCleaner extends Module 'htl_booking_demands_tax', 'service_product_order_detail', 'service_product_cart_detail', + 'order_customer_guest_detail', 'customer_guest_detail', 'cart_customer_guest' ); From af34805ed0d3777cb1f897982da0f08171dbc209 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 24 Jun 2025 12:52:34 +0530 Subject: [PATCH 31/39] Added: validation and description for goole map id --- .../admin/AdminHotelGeneralSettingsController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index 9cc4d589a..286459efd 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -398,9 +398,10 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'type' => 'text', ), 'PS_MAP_ID' => array( - 'title' => $this->l('Google Maps Id'), + 'title' => $this->l('Google Map ID'), 'hint' => $this->l('Map Id for Google Maps.'), - 'type' => 'text' + 'type' => 'text', + 'desc' => $this->l('Google Maps API Key and Google Map ID is required to display Google Maps.') ), 'WK_GOOGLE_ACTIVE_MAP' => array( 'title' => $this->l('Display Google Maps For Hotel Location'), @@ -605,6 +606,9 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController if (!Tools::getValue('PS_API_KEY')) { $this->errors[] = $this->l('Please enter Google API key.'); } + if (!Tools::getValue('PS_MAP_ID')) { + $this->errors[] = $this->l('Please enter Google Map Id.'); + } } if (!trim(Tools::getValue('PS_SHOP_NAME'))) { $this->errors[] = $this->l('Website name field is required'); From 67942d576807eadbbe84cbe3884b0de40e8e5e69 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 24 Jun 2025 13:23:44 +0530 Subject: [PATCH 32/39] Fixed: design issues, text issues and optimized the changes --- controllers/front/ProductController.php | 6 +++++- .../hotel-reservation-theme/_partials/booking-form.tpl | 8 ++++---- themes/hotel-reservation-theme/js/product.js | 10 ++++++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index d265cba75..5823f3f72 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -497,11 +497,15 @@ class ProductControllerCore extends FrontController } } else { if ($this->product->allow_multiple_quantity) { + $this->product->cart_quantity = 0; if ($products = $this->context->cart->getProducts()) { $products = array_column($products, 'cart_quantity', 'id_product'); if (isset($products[$this->product->id])) { - $this->product->quantity -= $products[$this->product->id]; + $this->product->cart_quantity = $products[$this->product->id]; $this->product->max_quantity -= $products[$this->product->id]; + if (!$this->product->isAvailableWhenOutOfStock((int) $this->product->out_of_stock)) { + $this->product->quantity -= $products[$this->product->id]; + } } } } diff --git a/themes/hotel-reservation-theme/_partials/booking-form.tpl b/themes/hotel-reservation-theme/_partials/booking-form.tpl index adc6d7f2c..206c3ed0a 100644 --- a/themes/hotel-reservation-theme/_partials/booking-form.tpl +++ b/themes/hotel-reservation-theme/_partials/booking-form.tpl @@ -262,8 +262,8 @@ {/block} *}
- - + +
{if isset($quantity)}{$quantity|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}
@@ -275,7 +275,7 @@
- {if !$is_out_of_stock || !$max_qty_reached} + {if !$is_out_of_stock && !$max_qty_reached}
{/if} {else} @@ -316,7 +316,7 @@
{else if $max_qty_reached}
- {l s='Max quantity reached!'} + {l s='Max. quantity reached for cart!'}
{else} {block name='booking_form_book_now_button'} diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js index 8e54f23d4..27420c733 100644 --- a/themes/hotel-reservation-theme/js/product.js +++ b/themes/hotel-reservation-theme/js/product.js @@ -1209,17 +1209,23 @@ $(document).ready(function() { let hasStockError = false; if (parseInt($('#product_page_booking_product').val()) == 0) { let stockQty = parseInt($(this).closest('.qty_container').find('.stock_qty').data('stock_quantity')); - if (stockQty < newQuantity) { + let allow_oosp = parseInt($(this).closest('.qty_container').find('.stock_qty').data('allow_oosp')); + if (!allow_oosp && (stockQty < newQuantity)) { showErrorMessage(out_of_stock_text); newQuantity = stockQty; + hasStockError = true; } } if (!hasStockError) { if (qtyfield.data('max_quantity') && qtyfield.data('max_quantity') < newQuantity) { // if max quantity is reached newQuantity = qtyfield.data('max_quantity'); + let cartQty = parseInt(qtyfield.data('cart_quantity')); + if (isNaN(cartQty)) { + cartQty = 0; + } - showErrorMessage(max_service_product_qty_txt+' '+qtyfield.data('max_quantity')); + showErrorMessage(max_service_product_qty_txt+' '+ (parseInt(qtyfield.data('max_quantity')) + cartQty)); } $(this).closest('.qty_container').find('.qty_count span').text(newQuantity); } From 3ec9356ae48f96780eb104175b4c54a0bee06030 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 25 Jun 2025 13:25:30 +0530 Subject: [PATCH 33/39] Optimized the category controller --- controllers/front/CategoryController.php | 179 +++++++---------------- 1 file changed, 55 insertions(+), 124 deletions(-) diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 5513488fa..582344f7d 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -169,8 +169,23 @@ class CategoryControllerCore extends FrontController } } - $id_cart = $this->context->cart->id; - $id_guest = $this->context->cookie->id_guest; + $sort_by = Tools::getValue('sort_by'); + $sort_value = Tools::getValue('sort_value'); + $filter_data = Tools::getValue('filter_data'); + $amenities = []; + $price = []; + if (!empty($filter_data)) { + foreach ($filter_data as $key => $value) { + if ($key == 'amenities') { + foreach ($value as $a_k => $a_v) { + $amenities[] = $a_v; + } + } elseif ($key == 'price') { + $price['from'] = $value[0]; + $price['to'] = $value[1]; + } + } + } $objBookingDetail = new HotelBookingDetail(); $bookingParams = array( @@ -179,20 +194,36 @@ class CategoryControllerCore extends FrontController 'occupancy' => $occupancy, 'hotel_id' => $id_hotel, 'get_total_rooms' => 0, - 'id_cart' => $id_cart, - 'id_guest' => $id_guest, + 'id_cart' => $this->context->cart->id, + 'id_guest' => $this->context->cookie->id_guest, + 'amenities' => $amenities, + 'price' => $price, ); if ($displayAllRoomsTypes) { $bookingParams['get_all_room_types'] = 1; } - $booking_data = $objBookingDetail->dataForFrontSearch($bookingParams); + if ($booking_data = $objBookingDetail->dataForFrontSearch($bookingParams)) { + $booking_data['rm_data'] = array_values($booking_data['rm_data']); + if ($sort_by && $sort_value) { + $indi_arr = array(); + + if ($sort_value == 1) { + $direction = SORT_ASC; + } elseif ($sort_value == 2) { + $direction = SORT_DESC; + } + foreach ($booking_data['rm_data'] as $s_k => $s_v) { + $indi_arr[$s_k] = $s_v['price']; + } + + array_multisort($indi_arr, $direction, $booking_data['rm_data']); + } + } $num_days = HotelHelper::getNumberOfDays($date_from, $date_to); - $warning_num = Configuration::get('WK_ROOM_LEFT_WARNING_NUMBER'); - /*Max date of ordering for order restrict*/ $order_date_restrict = false; $max_order_date = HotelOrderRestrictDate::getMaxOrderDate($id_hotel); @@ -204,8 +235,9 @@ class CategoryControllerCore extends FrontController $order_date_restrict = true; } } - /*End*/ + $feat_img_dir = _PS_IMG_.'rf/'; + $ratting_img = _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png'; $this->context->smarty->assign(array( 'warning_num' => $warning_num, 'num_days' => $num_days, @@ -214,23 +246,25 @@ class CategoryControllerCore extends FrontController 'booking_data' => $booking_data, 'max_order_date' => $max_order_date, 'order_date_restrict' => $order_date_restrict, - 'display_all_room_types' => $displayAllRoomsTypes + 'display_all_room_types' => $displayAllRoomsTypes, + 'id_hotel' => $id_hotel, + 'currency' => $currency, + 'feat_img_dir' => $feat_img_dir, + 'ratting_img' => $ratting_img, )); + + $action = Tools::toCamelCase(Tools::getValue('action'), true); + if ($this->ajax && $action == 'Filterresults') { + $response = array( + 'status' => true, + 'html_room_type_list' => $this->context->smarty->fetch('_partials/room_type_list.tpl') + ); + $this->ajaxDie(json_encode($response)); + } } else { Tools::redirect($this->context->link->getPageLink('pagenotfound')); } - - $feat_img_dir = _PS_IMG_.'rf/'; - $ratting_img = _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png'; - - $this->context->smarty->assign(array( - 'id_hotel' => $id_hotel, - 'currency' => $currency, - 'feat_img_dir' => $feat_img_dir, - 'ratting_img' => $ratting_img, - )); - - + /*End*/ /*if (isset($this->context->cookie->id_compare)) $this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare)); @@ -262,109 +296,6 @@ class CategoryControllerCore extends FrontController ));*/ } - public function displayAjaxFilterResults() - { - $response = array('status' => false); - - $this->display_header = false; - $this->display_footer = false; - - $displayAllRoomsTypes = false; - if (!($date_from = Tools::getValue('date_from'))) { - $date_from = date('Y-m-d H:i:s'); - $date_to = date('Y-m-d H:i:s', strtotime($date_from) + 86400); - $displayAllRoomsTypes = true; - } - - if (!($date_to = Tools::getValue('date_to'))) { - $date_to = date('Y-m-d H:i:s', strtotime($date_from) + 86400); - $displayAllRoomsTypes = true; - } - - $htl_id_category = Tools::getValue('id_category'); - - // occupancy of the search - $occupancy = Tools::getValue('occupancy'); - if (!Validate::isOccupancy($occupancy)) { - $occupancy = array(); - } - $sort_by = Tools::getValue('sort_by'); - $sort_value = Tools::getValue('sort_value'); - $filter_data = Tools::getValue('filter_data'); - - $adults = 0; - $children = 0; - $amenities = 0; - $price = 0; - - if (!empty($filter_data)) { - foreach ($filter_data as $key => $value) { - if ($key == 'adults') { - $adults = min($value); - } elseif ($key == 'children') { - $children = min($value); - } elseif ($key == 'amenities') { - $amenities = array(); - foreach ($value as $a_k => $a_v) { - $amenities[] = $a_v; - } - } elseif ($key == 'price') { - $price = array(); - $price['from'] = $value[0]; - $price['to'] = $value[1]; - } - } - } - - if (Module::isInstalled('hotelreservationsystem')) { - require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; - - $id_hotel = HotelBranchInformation::getHotelIdByIdCategory($htl_id_category); - - $objBookingDetail = new HotelBookingDetail(); - - $bookingParams = array( - 'date_from' => $date_from, - 'date_to' => $date_to, - 'hotel_id' => $id_hotel, - 'occupancy' => $occupancy, - 'amenities' => $amenities, - 'price' => $price, - 'get_total_rooms' => 0, - 'id_cart' => $this->context->cart->id, - 'id_guest' => $this->context->cookie->id_guest, - ); - - if ($displayAllRoomsTypes) { - $bookingParams['get_all_room_types'] = 1; - } - - $booking_data = $objBookingDetail->dataForFrontSearch($bookingParams); - // reset array keys from 0 - $booking_data['rm_data'] = array_values($booking_data['rm_data']); - if ($sort_by && $sort_value) { - $indi_arr = array(); - - if ($sort_value == 1) { - $direction = SORT_ASC; - } elseif ($sort_value == 2) { - $direction = SORT_DESC; - } - foreach ($booking_data['rm_data'] as $s_k => $s_v) { - $indi_arr[$s_k] = $s_v['price']; - } - - array_multisort($indi_arr, $direction, $booking_data['rm_data']); - } - - $this->context->smarty->assign(array('booking_data' => $booking_data)); - $html = $this->context->smarty->fetch('_partials/room_type_list.tpl'); - $response['status'] = true; - $response['html_room_type_list'] = $html; - } - $this->ajaxDie(json_encode($response)); - } - /** * Assigns scenes template variables */ From 1e74c4c1c3982dcbab53105c10f3549d9fde6f31 Mon Sep 17 00:00:00 2001 From: Aman deep sharma Date: Thu, 26 Jun 2025 11:46:48 +0530 Subject: [PATCH 34/39] Fixed: Wrong function call and syntax error --- classes/order/OrderDetail.php | 13 ++++++++----- classes/tax/TaxRulesGroup.php | 4 ++++ .../classes/ServiceProductOrderDetail.php | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/classes/order/OrderDetail.php b/classes/order/OrderDetail.php index 32aaaad93..01e9b32da 100644 --- a/classes/order/OrderDetail.php +++ b/classes/order/OrderDetail.php @@ -388,11 +388,14 @@ class OrderDetailCore extends ObjectModel * Calculate tax rule groups for the service product based on each associated room type. */ if (!$this->is_booking_product && $this->selling_preference_type == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) { + if ($this->product_auto_add && $this->product_price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM) { + return true; + } // Get all associated room type IDs for this service product and cart $associatedRoomTypes = Db::getInstance()->executeS( - 'SELECT hcbd.`id_product` + 'SELECT hcbd.`id_product` FROM `'._DB_PREFIX_.'htl_cart_booking_data` hcbd - INNER JOIN `'._DB_PREFIX_.'service_product_cart_detail` spcd + INNER JOIN `'._DB_PREFIX_.'service_product_cart_detail` spcd ON spcd.`htl_cart_booking_id` = hcbd.`id` WHERE spcd.`id_product` = '.(int)$this->product_id.' AND spcd.`id_cart` = '.(int)$idCart @@ -401,9 +404,9 @@ class OrderDetailCore extends ObjectModel if (!empty($associatedRoomTypes)) { $associatedRoomTypeIds = array_column($associatedRoomTypes, 'id_product'); $taxGroupInfoList = array(); - + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); foreach ($associatedRoomTypeIds as $idRoomType) { - if ($serviceProductPriceRoomInfo = RoomTypeServiceProductPrice::getProductRoomTypePriceAndTax( + if ($serviceProductPriceRoomInfo = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( $this->product_id, $idRoomType, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE @@ -417,7 +420,7 @@ class OrderDetailCore extends ObjectModel // Use default tax rule group for the service product $taxGroupInfoList[] = array( 'id_room_type' => $idRoomType, - 'id_tax_rules_group' => $objOrderDetail->id_tax_rules_group + 'id_tax_rules_group' => $this->id_tax_rules_group ); } } diff --git a/classes/tax/TaxRulesGroup.php b/classes/tax/TaxRulesGroup.php index fda98ba26..c37d6367a 100644 --- a/classes/tax/TaxRulesGroup.php +++ b/classes/tax/TaxRulesGroup.php @@ -101,6 +101,10 @@ class TaxRulesGroupCore extends ObjectModel UPDATE '._DB_PREFIX_.'product SET id_tax_rules_group='.(int)$tax_rules_group->id.' WHERE id_tax_rules_group='.(int)$this->id) && + Db::getInstance()->execute(' + UPDATE '._DB_PREFIX_.'htl_room_type_service_product_price + SET id_tax_rules_group='.(int)$tax_rules_group->id.' + WHERE id_tax_rules_group='.(int)$this->id) && Db::getInstance()->execute(' UPDATE '._DB_PREFIX_.'product_shop SET id_tax_rules_group='.(int)$tax_rules_group->id.' diff --git a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php index 6802a6700..33202537b 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php @@ -90,7 +90,8 @@ class ServiceProductOrderDetail extends ObjectModel $this->id_tax_rules_group = $objRoomTypeProduct->id_tax_rules_group; } } else { - if ($serviceProductPriceRoomInfo = RoomTypeServiceProductPrice::getProductRoomTypePriceAndTax( + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + if ($serviceProductPriceRoomInfo = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( $this->id_product, $idRoomType, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE From 25285d67b63d439932bd5bac6eac5196b3b228be Mon Sep 17 00:00:00 2001 From: Aman deep sharma Date: Thu, 26 Jun 2025 16:01:48 +0530 Subject: [PATCH 35/39] Fixed tax issues on order edit --- classes/order/OrderDetail.php | 68 +++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/classes/order/OrderDetail.php b/classes/order/OrderDetail.php index 01e9b32da..c13878059 100644 --- a/classes/order/OrderDetail.php +++ b/classes/order/OrderDetail.php @@ -382,7 +382,10 @@ class OrderDetailCore extends ObjectModel } $values = ''; - $idCart = $order->id_cart; + $idCart = $this->context->cart->id ?? $order->id_cart; + if (empty($this->vat_address)) { + $this->vat_address = new Address((int)$order->id_address_tax); + } /** * Calculate tax rule groups for the service product based on each associated room type. @@ -406,19 +409,20 @@ class OrderDetailCore extends ObjectModel $taxGroupInfoList = array(); $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); foreach ($associatedRoomTypeIds as $idRoomType) { + $key = $this->product_id.'_'.$idRoomType; if ($serviceProductPriceRoomInfo = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( $this->product_id, $idRoomType, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE )) { //Special tax rule group for the Service product accroding to Room type - $taxGroupInfoList[] = array( + $taxGroupInfoList[$key] = array( 'id_room_type' => $idRoomType, 'id_tax_rules_group' => $serviceProductPriceRoomInfo['id_tax_rules_group'] ); } else { // Use default tax rule group for the service product - $taxGroupInfoList[] = array( + $taxGroupInfoList[$key] = array( 'id_room_type' => $idRoomType, 'id_tax_rules_group' => $this->id_tax_rules_group ); @@ -433,6 +437,7 @@ class OrderDetailCore extends ObjectModel */ if (!$this->is_booking_product && isset($taxGroupInfoList) && $taxGroupInfoList) { $objServiceProductCartDetail = new ServiceProductCartDetail(); + $objServiceProductOrderDetail = new ServiceProductOrderDetail(); // Saving tax details according to the service product tax groups for different rooms foreach ($taxGroupInfoList as $taxGroupInfo) { $tax_manager = TaxManagerFactory::getManager($this->vat_address, (int)$taxGroupInfo['id_tax_rules_group']); @@ -450,29 +455,46 @@ class OrderDetailCore extends ObjectModel continue; } - $serviceProductCartData = $objServiceProductCartDetail->getServiceProductsInCart( - $idCart, - array(), - null, - null, - $taxGroupInfo['id_room_type'], - $this->product_id - ); - $total_price_tax_excl = array_reduce($serviceProductCartData, function ($totalPriceTaxExcl, $item) { - return $totalPriceTaxExcl + (isset($item['total_price_tax_excl']) ? $item['total_price_tax_excl'] : 0); - }, 0); + if ($serviceProductData = $objServiceProductOrderDetail->getRoomTypeServiceProducts( + $this->id_order, + $this->product_id, + 0, + $taxGroupInfo['id_room_type'], + )) { + $total_price_tax_excl = array_reduce($serviceProductData, function ($totalPriceTaxExcl, $item) { + return $totalPriceTaxExcl + (isset($item['total_price_tax_excl']) ? $item['total_price_tax_excl'] : 0); + }, 0); - $quantity = array_reduce($serviceProductCartData, function ($totalQty, $item) { - return $totalQty + (isset($item['quantity']) ? $item['quantity'] : 0); - }, 0); + $serviceProductData = array_shift($serviceProductData); - $unit_price_tax_excl = $total_price_tax_excl / $quantity; + $quantity = array_reduce($serviceProductData['additional_services'], function ($totalQty, $item) { + return $totalQty + (isset($item['quantity']) ? $item['quantity'] : 0); + }, 0); + } elseif ($serviceProductData = $objServiceProductCartDetail->getServiceProductsInCart( + $idCart, + array(), + null, + null, + $taxGroupInfo['id_room_type'], + $this->product_id + )) { + $total_price_tax_excl = array_reduce($serviceProductData, function ($totalPriceTaxExcl, $item) { + return $totalPriceTaxExcl + (isset($item['total_price_tax_excl']) ? $item['total_price_tax_excl'] : 0); + }, 0); + + $quantity = array_reduce($serviceProductData, function ($totalQty, $item) { + return $totalQty + (isset($item['quantity']) ? $item['quantity'] : 0); + }, 0); + } - foreach ($this->tax_calculator->getTaxesAmount($unit_price_tax_excl) as $id_tax => $amount) { - - $total_amount = Tools::processPriceRounding($amount, $quantity, $order->round_type, $order->round_mode); - - $values .= '('.(int)$this->id.','.(int)$id_tax.','.(float)$amount.','.(float)$total_amount.'),'; + if (isset($quantity) && isset($total_price_tax_excl)) { + $unit_price_tax_excl = $total_price_tax_excl / $quantity; + foreach ($this->tax_calculator->getTaxesAmount($unit_price_tax_excl) as $id_tax => $amount) { + + $total_amount = Tools::processPriceRounding($amount, $quantity, $order->round_type, $order->round_mode); + + $values .= '('.(int)$this->id.','.(int)$id_tax.','.(float)$amount.','.(float)$total_amount.'),'; + } } } } else { From 1d57c006c66c54a6b213fc76b7b14098baac4b95 Mon Sep 17 00:00:00 2001 From: Aman deep sharma Date: Thu, 26 Jun 2025 16:43:49 +0530 Subject: [PATCH 36/39] Fixed worng base price in invoice tax breakdown --- classes/order/Order.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/classes/order/Order.php b/classes/order/Order.php index 775ddac36..3268193c2 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -2564,10 +2564,6 @@ class OrderCore extends ObjectModel $totalTaxBase = Tools::processPriceRounding($unit_price_tax_excl, $quantity); if (!$order_detail['is_booking_product']) { $objServiceProductOrderDetail = new ServiceProductOrderDetail(); - $serviceProductDetail = $objServiceProductOrderDetail->getServiceProductsInOrder( - $order_detail['id_order'], - $id_order_detail - ); if ($serviceProductDetail = $objServiceProductOrderDetail->getServiceProductsInOrder( $order_detail['id_order'], $id_order_detail @@ -2575,7 +2571,7 @@ class OrderCore extends ObjectModel $totals = array_reduce($serviceProductDetail, function ($carry, $item) { if (!empty($item['id_tax_rules_group'])) { $qty = isset($item['quantity']) ? $item['quantity'] : 0; - $price = isset($item['unit_price_tax_excl']) ? $item['unit_price_tax_excl'] : 0; + $price = isset($item['total_price_tax_excl']) ? $item['total_price_tax_excl'] : 0; $carry['quantity'] += $qty; $carry['total_price_tax_excl'] += $price; From a54eac9403a4270b8a171cc8026b9548f243bda0 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Fri, 27 Jun 2025 12:04:27 +0530 Subject: [PATCH 37/39] Fixed: Issues in standard product price and quantity calculations --- classes/Cart.php | 8 +- controllers/admin/AdminOrdersController.php | 4 +- .../admin/AdminPPreferencesController.php | 148 +++++++++--------- modules/blockcart/ajax-cart.js | 2 +- .../js/modules/blockcart/ajax-cart.js | 2 +- 5 files changed, 82 insertions(+), 82 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index b1e132d31..b5d1eb461 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1816,15 +1816,15 @@ class CartCore extends ObjectModel if ($servicePorducts) { foreach ($servicePorducts as $servicePorduct) { if ($with_taxes) { - $priceAdd = $servicePorduct['unit_price_tax_incl']; + $priceAdd = $servicePorduct['total_price_tax_incl']; } else { - $priceAdd = $servicePorduct['unit_price_tax_excl']; + $priceAdd = $servicePorduct['total_price_tax_excl']; } if ($ps_round_type == Order::ROUND_TOTAL) { - $products_total[$id_tax_rules_group.'_'.$id_address] += Tools::processPriceRounding($priceAdd, (int)$servicePorduct['quantity']); + $products_total[$id_tax_rules_group.'_'.$id_address] += $priceAdd; } else { - $products_total[$id_tax_rules_group] += Tools::processPriceRounding($priceAdd, (int)$servicePorduct['quantity']); + $products_total[$id_tax_rules_group] += $priceAdd; } } } diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index ad992ba1d..a97598697 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -6139,7 +6139,7 @@ class AdminOrdersControllerCore extends AdminController $product_quantity = $editProductInfo['product_quantity']; if ($updateQty = (int)($product_quantity - $objServiceProductOrderDetail->quantity)) { - $this->checkStockAvailable($objOrderDetail, ($product_quantity - $objOrderDetail->product_quantity)); + $this->checkStockAvailable($objOrderDetail, $updateQty); } $taxRate = $objServiceProductOrderDetail->unit_price_tax_incl / $objServiceProductOrderDetail->unit_price_tax_excl; @@ -6207,7 +6207,7 @@ class AdminOrdersControllerCore extends AdminController // Update product available quantity if ($updateQty) { - $result &= StockAvailable::updateQuantity($objOrderDetail->product_id, $objOrderDetail->product_attribute_id, $updateQty, $objOrder->id_shop); + $result &= StockAvailable::updateQuantity($objOrderDetail->product_id, $objOrderDetail->product_attribute_id, -(int)$updateQty, $objOrder->id_shop); } if (!$result) { diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php index c5bd1dfbb..4794c1f9a 100644 --- a/controllers/admin/AdminPPreferencesController.php +++ b/controllers/admin/AdminPPreferencesController.php @@ -331,80 +331,80 @@ class AdminPPreferencesControllerCore extends AdminController ), 'submit' => array('title' => $this->l('Save')) ), - 'stock' => array( - 'title' => $this->l('Products stock'), - 'fields' => array( - 'PS_ORDER_OUT_OF_STOCK' => array( - 'title' => $this->l('Allow ordering of out-of-stock products'), - 'hint' => $this->l('By default, the Add to Cart button is hidden when a product is unavailable. You can choose to have it displayed in all cases.'), - 'validation' => 'isBool', - 'cast' => 'intval', - 'required' => false, - 'type' => 'bool' - ), - 'PS_STOCK_MANAGEMENT' => array( - 'title' => $this->l('Enable stock management'), - 'validation' => 'isBool', - 'cast' => 'intval', - 'required' => false, - 'type' => 'bool', - 'js' => array( - 'on' => 'onchange="stockManagementActivationAuthorization()"', - 'off' => 'onchange="stockManagementActivationAuthorization()"' - ) - ), - // 'PS_ADVANCED_STOCK_MANAGEMENT' => array( - // 'title' => $this->l('Enable advanced stock management'), - // 'hint' => $this->l('Allows you to manage physical stock, warehouses and supply orders in a new Stock menu.'), - // 'validation' => 'isBool', - // 'cast' => 'intval', - // 'required' => false, - // 'type' => 'bool', - // 'visibility' => Shop::CONTEXT_ALL, - // 'js' => array( - // 'on' => 'onchange="advancedStockManagementActivationAuthorization()"', - // 'off' => 'onchange="advancedStockManagementActivationAuthorization()"' - // ) - // ), - // 'PS_FORCE_ASM_NEW_PRODUCT' => array( - // 'title' => $this->l('New products use advanced stock management'), - // 'hint' => $this->l('New products will automatically use advanced stock management and depends on stock, but no warehouse will be selected'), - // 'validation' => 'isBool', - // 'cast' => 'intval', - // 'required' => false, - // 'type' => 'bool', - // 'visibility' => Shop::CONTEXT_ALL, - // ), - // 'PS_DEFAULT_WAREHOUSE_NEW_PRODUCT' => array( - // 'title' => $this->l('Default warehouse on new products'), - // 'hint' => $this->l('Automatically set a default warehouse when new product is created'), - // 'type' => 'select', - // 'list' => $warehouse_list, - // 'identifier' => 'id_warehouse' - // ), - // 'PS_PACK_STOCK_TYPE' => array( - // 'title' => $this->l('Default pack stock management'), - // 'type' => 'select', - // 'list' =>array( - // array( - // 'pack_stock' => 0, - // 'name' => $this->l('Decrement pack only.') - // ), - // array( - // 'pack_stock' => 1, - // 'name' => $this->l('Decrement products in pack only.') - // ), - // array( - // 'pack_stock' => 2, - // 'name' => $this->l('Decrement both.') - // ), - // ), - // 'identifier' => 'pack_stock', - // ), - ), - // 'bottom' => '', - 'submit' => array('title' => $this->l('Save')) - ), + // 'stock' => array( + // 'title' => $this->l('Products stock'), + // 'fields' => array( + // 'PS_ORDER_OUT_OF_STOCK' => array( + // 'title' => $this->l('Allow ordering of out-of-stock products'), + // 'hint' => $this->l('By default, the Add to Cart button is hidden when a product is unavailable. You can choose to have it displayed in all cases.'), + // 'validation' => 'isBool', + // 'cast' => 'intval', + // 'required' => false, + // 'type' => 'bool' + // ), + // 'PS_STOCK_MANAGEMENT' => array( + // 'title' => $this->l('Enable stock management'), + // 'validation' => 'isBool', + // 'cast' => 'intval', + // 'required' => false, + // 'type' => 'bool', + // 'js' => array( + // 'on' => 'onchange="stockManagementActivationAuthorization()"', + // 'off' => 'onchange="stockManagementActivationAuthorization()"' + // ) + // ), + // // 'PS_ADVANCED_STOCK_MANAGEMENT' => array( + // // 'title' => $this->l('Enable advanced stock management'), + // // 'hint' => $this->l('Allows you to manage physical stock, warehouses and supply orders in a new Stock menu.'), + // // 'validation' => 'isBool', + // // 'cast' => 'intval', + // // 'required' => false, + // // 'type' => 'bool', + // // 'visibility' => Shop::CONTEXT_ALL, + // // 'js' => array( + // // 'on' => 'onchange="advancedStockManagementActivationAuthorization()"', + // // 'off' => 'onchange="advancedStockManagementActivationAuthorization()"' + // // ) + // // ), + // // 'PS_FORCE_ASM_NEW_PRODUCT' => array( + // // 'title' => $this->l('New products use advanced stock management'), + // // 'hint' => $this->l('New products will automatically use advanced stock management and depends on stock, but no warehouse will be selected'), + // // 'validation' => 'isBool', + // // 'cast' => 'intval', + // // 'required' => false, + // // 'type' => 'bool', + // // 'visibility' => Shop::CONTEXT_ALL, + // // ), + // // 'PS_DEFAULT_WAREHOUSE_NEW_PRODUCT' => array( + // // 'title' => $this->l('Default warehouse on new products'), + // // 'hint' => $this->l('Automatically set a default warehouse when new product is created'), + // // 'type' => 'select', + // // 'list' => $warehouse_list, + // // 'identifier' => 'id_warehouse' + // // ), + // // 'PS_PACK_STOCK_TYPE' => array( + // // 'title' => $this->l('Default pack stock management'), + // // 'type' => 'select', + // // 'list' =>array( + // // array( + // // 'pack_stock' => 0, + // // 'name' => $this->l('Decrement pack only.') + // // ), + // // array( + // // 'pack_stock' => 1, + // // 'name' => $this->l('Decrement products in pack only.') + // // ), + // // array( + // // 'pack_stock' => 2, + // // 'name' => $this->l('Decrement both.') + // // ), + // // ), + // // 'identifier' => 'pack_stock', + // // ), + // ), + // // 'bottom' => '', + // 'submit' => array('title' => $this->l('Save')) + // ), ); } diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index 0c25d3a45..e3e4ac26f 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -878,7 +878,7 @@ var ajaxCart = { content += '
'; if ((parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE || parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE) - && (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.length) + && (typeof(hotel_wise_data) != 'undefined' && typeof(hotel_wise_data.hotel_name) != 'undefined') ) { content += '
' + hotel_wise_data.hotel_name + '
'; } diff --git a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js index 0c25d3a45..e3e4ac26f 100644 --- a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js +++ b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js @@ -878,7 +878,7 @@ var ajaxCart = { content += '
'; if ((parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE || parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE) - && (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.length) + && (typeof(hotel_wise_data) != 'undefined' && typeof(hotel_wise_data.hotel_name) != 'undefined') ) { content += '
' + hotel_wise_data.hotel_name + '
'; } From a376efc10d5ae0a61504eebd43866b30a6095ba9 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 27 Jun 2025 12:45:15 +0530 Subject: [PATCH 38/39] Updated: QloApps installation URL length 64 => 256 --- classes/shop/ShopUrl.php | 4 ++-- install/data/db_structure.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/shop/ShopUrl.php b/classes/shop/ShopUrl.php index 5e43b1aee..94d62f51f 100644 --- a/classes/shop/ShopUrl.php +++ b/classes/shop/ShopUrl.php @@ -49,8 +49,8 @@ class ShopUrlCore extends ObjectModel 'domain' => array('type' => self::TYPE_STRING, 'required' => true, 'size' => 255, 'validate' => 'isCleanHtml'), 'domain_ssl' => array('type' => self::TYPE_STRING, 'size' => 255, 'validate' => 'isCleanHtml'), 'id_shop' => array('type' => self::TYPE_INT, 'required' => true), - 'physical_uri' => array('type' => self::TYPE_STRING, 'size' => 64), - 'virtual_uri' => array('type' => self::TYPE_STRING, 'size' => 64), + 'physical_uri' => array('type' => self::TYPE_STRING, 'size' => 256), + 'virtual_uri' => array('type' => self::TYPE_STRING, 'size' => 256), ), ); diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index 0afb0273e..079d3e928 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -2175,8 +2175,8 @@ CREATE TABLE IF NOT EXISTS `PREFIX_shop_url` ( `id_shop` int(11) unsigned NOT NULL, `domain` varchar(150) NOT NULL, `domain_ssl` varchar(150) NOT NULL, - `physical_uri` varchar(64) NOT NULL, - `virtual_uri` varchar(64) NOT NULL, + `physical_uri` varchar(256) NOT NULL, + `virtual_uri` varchar(256) NOT NULL, `main` TINYINT(1) NOT NULL, `active` TINYINT(1) NOT NULL, PRIMARY KEY (`id_shop_url`), From dcb99c21464c918994205d0f4f0c2ed7dc915a5f Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Fri, 27 Jun 2025 14:39:10 +0530 Subject: [PATCH 39/39] Fixed: Price issue with multiple autoadd services with a room --- .../classes/HotelRoomTypeFeaturePricing.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index ca621a1fd..0e668ccbd 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -389,9 +389,10 @@ class HotelRoomTypeFeaturePricing extends ObjectModel 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM )) { - $selectedServices = array_shift($roomServicesServices); - $totalPrice['total_price_tax_incl'] += $selectedServices['total_price_tax_incl']; - $totalPrice['total_price_tax_excl'] += $selectedServices['total_price_tax_excl']; + foreach($roomServicesServices as $selectedService) { + $totalPrice['total_price_tax_incl'] += $selectedService['total_price_tax_incl']; + $totalPrice['total_price_tax_excl'] += $selectedService['total_price_tax_excl']; + } } }