From 1bfa256d1e20071e47328c05862f9398d4e52f17 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Mon, 13 Mar 2023 11:13:20 +0530 Subject: [PATCH 1/7] show service cost seprate from room cost --- .../classes/HotelCartBookingData.php | 28 +++++++++++++++++++ .../hotel-reservation-theme/shopping-cart.tpl | 8 +++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 3afd75fac..15fc9489b 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1331,12 +1331,26 @@ class HotelCartBookingData extends ObjectModel $data_v['date_from'], $data_v['date_to'] ); + $roomTypeDateRangePriceWithoutAutoAdd = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( + $product['id_product'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 0, + 0, + 0, + 0, + 0 + ); if (!$price_tax) { $amount = $roomTypeDateRangePrice['total_price_tax_excl']; + $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_excl']; } else { $amount = $roomTypeDateRangePrice['total_price_tax_incl']; + $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl']; } $cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount * $varQty; + $cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] = $amountWithoutAutoAdd * $varQty; } else { $cartHotelData[$prodKey]['date_diff'][$dateJoin]['demand_price'] = $totalAdditionalServicePrice; $numDays = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']); @@ -1359,12 +1373,26 @@ class HotelCartBookingData extends ObjectModel $data_v['date_from'], $data_v['date_to'] ); + $roomTypeDateRangePriceWithoutAutoAdd = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( + $product['id_product'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 0, + 0, + 0, + 0, + 0 + ); if (!$price_tax) { $amount = $roomTypeDateRangePrice['total_price_tax_excl']; + $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_excl']; } else { $amount = $roomTypeDateRangePrice['total_price_tax_incl']; + $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl']; } $cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount; + $cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] = $amountWithoutAutoAdd; $cartHotelData[$prodKey]['date_diff'][$dateJoin]['link'] = $context->link->getPageLink( 'order-opc', null, diff --git a/themes/hotel-reservation-theme/shopping-cart.tpl b/themes/hotel-reservation-theme/shopping-cart.tpl index 4c04053b5..48867d4b6 100644 --- a/themes/hotel-reservation-theme/shopping-cart.tpl +++ b/themes/hotel-reservation-theme/shopping-cart.tpl @@ -148,8 +148,14 @@

- {displayPrice price=($rm_v['amount'])} + {displayPrice price=($rm_v['amount_without_auto_add'])} +
+ {if ($rm_v['amount'] - $rm_v['amount_without_auto_add']) > 0} + + + {displayPrice price=($rm_v['amount'] - $rm_v['amount_without_auto_add'])} + + {/if} {if (isset($data_v['extra_demands']) && $data_v['extra_demands']) || (isset($data_v['service_products']) && $data_v['service_products'])} + From 967b4385aef812efdf648b3d31b95b92149b694f Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 24 Mar 2023 10:54:51 +0530 Subject: [PATCH 2/7] added room price info on checkout page --- classes/Cart.php | 14 +++++++ classes/controller/FrontController.php | 1 + controllers/front/OrderOpcController.php | 1 + controllers/front/ProductController.php | 2 - themes/hotel-reservation-theme/css/global.css | 8 ++++ .../hotel-reservation-theme/js/order-opc.js | 37 +++++++++++++++++++ .../hotel-reservation-theme/shopping-cart.tpl | 15 +++++--- 7 files changed, 71 insertions(+), 7 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index fe5e5a1a1..06130a302 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -3785,7 +3785,20 @@ class CartCore extends ObjectModel } } + $discountedProducts = array(); foreach ($cart_rules as $key => &$cart_rule) { + $product_rule_groups = $cart_rule['obj']->getProductRuleGroups(); + foreach ($product_rule_groups as $id_product_rule_group => $product_rule_group) { + if (isset($product_rule_group['product_rules']) && $product_rule_group['product_rules']) { + foreach($product_rule_group['product_rules'] as $rule_products) { + if ($rule_products['type'] == 'products') { + $discountedProducts = array_merge($discountedProducts, $rule_products['values']); + } + } + + } + } + if (((float)$cart_rule['value_real'] == 0 && (int)$cart_rule['free_shipping'] == 0)) { unset($cart_rules[$key]); } @@ -3825,6 +3838,7 @@ class CartCore extends ObjectModel 'total_price' => $base_total_tax_inc, 'total_tax' => $total_tax, 'total_price_without_tax' => $base_total_tax_exc, + 'discounted_products' => $discountedProducts, 'is_multi_address_delivery' => $this->isMultiAddressDelivery() || ((int)Tools::getValue('multi-shipping') == 1), 'free_ship' =>!$total_shipping && !count($this->getDeliveryAddressesWithoutCarriers(true, $errors)), 'carrier' => new Carrier($this->id_carrier, $id_lang), diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index cdd22e7a8..012fe6d17 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -1083,6 +1083,7 @@ class FrontControllerCore extends Controller $this->addjqueryPlugin('fancybox'); $this->addJS(_PS_JS_DIR_.'hookLiveEdit.js'); } + $this->addJqueryUI('ui.tooltip', 'base', true); if (Configuration::get('PS_QUICK_VIEW')) { $this->addjqueryPlugin('fancybox'); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index f787834b5..a08bd1cae 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -557,6 +557,7 @@ class OrderOpcControllerCore extends ParentOrderController if (!empty($cartProducts)) { if ($cartBookingInfo = HotelCartBookingData::getHotelCartBookingData()) { + // ddd($cartBookingInfo); $this->context->smarty->assign('cart_htl_data', $cartBookingInfo); } $objHotelServiceProductCartDetail = new HotelServiceProductCartDetail(); diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 74f8030fc..c20dc67c0 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -62,8 +62,6 @@ class ProductControllerCore extends FrontController $this->addCSS(_THEME_CSS_DIR_.'occupancy.css'); $this->addJS(_THEME_JS_DIR_.'occupancy.js'); - $this->addJqueryUI('ui.tooltip', 'base', true); - if (Configuration::get('PS_DISPLAY_JQZOOM') == 1) { $this->addJqueryPlugin('jqzoom'); } diff --git a/themes/hotel-reservation-theme/css/global.css b/themes/hotel-reservation-theme/css/global.css index b04c0d762..16eec4358 100644 --- a/themes/hotel-reservation-theme/css/global.css +++ b/themes/hotel-reservation-theme/css/global.css @@ -8505,6 +8505,14 @@ div.star.star_hover:after { content: "\f057"; font-family: "FontAwesome"; } +body .ui-tooltip { + box-shadow: 0 2px 6px 0 rgb(0 0 0 / 20%); + background: #FFFFFF; + border: unset; + color: #333; + padding: 10px 15px; +} + #facebook_block, #cmsinfo_block { overflow: hidden; diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js index 23d5f7e26..2180e2bb9 100644 --- a/themes/hotel-reservation-theme/js/order-opc.js +++ b/themes/hotel-reservation-theme/js/order-opc.js @@ -33,6 +33,43 @@ $(document).ready(function() $(this).closest('.card').find('.step-edit').addClass('hidden'); }); + // room price details tooltip + if ($('.room_price_detail_block .room-price-detail').length) { + $('.room_price_detail_block .room-price-detail img').tooltip({ + content: $('.room_price_detail_block .room-price-detail-container').html(), + items: "span", + trigger : 'hover', + tooltipClass: "room-price-detail-tooltip", + open: function(event, ui) + { + if (typeof(event.originalEvent) === 'undefined') + { + return false; + } + + var $id = $(ui.tooltip).attr('id'); + + if ($('div.ui-tooltip').not('#' + $id).length) { + return false; + } + }, + close: function(event, ui) + { + ui.tooltip.hover(function() + { + $(this).stop(true).fadeTo(400, 1); + }, + function() + { + $(this).fadeOut('400', function() + { + $(this).remove(); + }); + }); + } + }); + } + // BY WEBKUL // FOR ADVANCED PAYMENT var payment_type = $(".payment_type:checked").val(); diff --git a/themes/hotel-reservation-theme/shopping-cart.tpl b/themes/hotel-reservation-theme/shopping-cart.tpl index 48867d4b6..a750fc5b9 100644 --- a/themes/hotel-reservation-theme/shopping-cart.tpl +++ b/themes/hotel-reservation-theme/shopping-cart.tpl @@ -148,13 +148,18 @@

- {displayPrice price=($rm_v['amount_without_auto_add'])} + {displayPrice price=($rm_v['amount'])} -
- {if ($rm_v['amount'] - $rm_v['amount_without_auto_add']) > 0} - - + {displayPrice price=($rm_v['amount'] - $rm_v['amount_without_auto_add'])} + {if (($rm_v['amount'] - $rm_v['amount_without_auto_add']) > 0) && in_array($data_v['id_product'], $discounted_products)} + + +

{/if} {if (isset($data_v['extra_demands']) && $data_v['extra_demands']) || (isset($data_v['service_products']) && $data_v['service_products'])} From fd10852401d265951973456946e28a09e642c4cc Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Sat, 25 Mar 2023 14:41:49 +0530 Subject: [PATCH 3/7] added configuration for room price breakdown oncheckout page --- controllers/admin/AdminOrderPreferencesController.php | 8 +++++++- controllers/front/OrderOpcController.php | 1 + themes/hotel-reservation-theme/shopping-cart.tpl | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index e1c53fd2d..b60938251 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -151,7 +151,13 @@ class AdminOrderPreferencesControllerCore extends AdminController 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval' - ) + ), + 'PS_AUTO_ADD_SERVICE_BREAKDOWN' => array( + 'title' => $this->l('Show room price breakdown'), + 'desc' => $this->l('Show a summary for prices of the auto added service add with room on shopping cart list.'), + 'cast' => 'intval', + 'type' => 'bool' + ), ), 'submit' => array('title' => $this->l('Save')) ), diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index a08bd1cae..9d8cf3173 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -467,6 +467,7 @@ class OrderOpcControllerCore extends ParentOrderController // 'defaultcurrencySign' => $objCurrency->sign, 'THEME_DIR' => _THEME_DIR_, 'PS_CUSTOMER_ADDRESS_CREATION' => Configuration::get('PS_CUSTOMER_ADDRESS_CREATION'), + 'PS_AUTO_ADD_SERVICE_BREAKDOWN' => Configuration::get('PS_AUTO_ADD_SERVICE_BREAKDOWN'), 'free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, diff --git a/themes/hotel-reservation-theme/shopping-cart.tpl b/themes/hotel-reservation-theme/shopping-cart.tpl index a750fc5b9..1a979f43e 100644 --- a/themes/hotel-reservation-theme/shopping-cart.tpl +++ b/themes/hotel-reservation-theme/shopping-cart.tpl @@ -150,7 +150,7 @@ {displayPrice price=($rm_v['amount'])} - {if (($rm_v['amount'] - $rm_v['amount_without_auto_add']) > 0) && in_array($data_v['id_product'], $discounted_products)} + {if (($rm_v['amount'] - $rm_v['amount_without_auto_add']) > 0) && (in_array($data_v['id_product'], $discounted_products) || $PS_AUTO_ADD_SERVICE_BREAKDOWN)} From 61c9ac203a2c5cd8d56940011458573c96c51b47 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Tue, 28 Mar 2023 12:07:42 +0530 Subject: [PATCH 4/7] updated breakdown button description --- controllers/admin/AdminOrderPreferencesController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index b60938251..ea709c2ea 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -154,7 +154,8 @@ class AdminOrderPreferencesControllerCore extends AdminController ), 'PS_AUTO_ADD_SERVICE_BREAKDOWN' => array( 'title' => $this->l('Show room price breakdown'), - 'desc' => $this->l('Show a summary for prices of the auto added service add with room on shopping cart list.'), + 'hint' => $this->l('Show a summary for prices of the auto added service add with room on shopping cart list.'), + 'desc' => $this->l('This breakdown is always visible on room that have cart rule applied for that specific room.'), 'cast' => 'intval', 'type' => 'bool' ), From 9887aa5a028334a1e308dc69080fad92b7f225a8 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Tue, 28 Mar 2023 13:03:00 +0530 Subject: [PATCH 5/7] updated additional facilities panel in admin room type page --- .../products/additionalfacilities.tpl | 159 +++++++++++------- .../controllers/products/serviceproduct.tpl | 84 +++++---- controllers/admin/AdminProductsController.php | 11 ++ .../helpers/form/form.tpl | 133 +++++++-------- 4 files changed, 226 insertions(+), 161 deletions(-) diff --git a/admin/themes/default/template/controllers/products/additionalfacilities.tpl b/admin/themes/default/template/controllers/products/additionalfacilities.tpl index f3f6ee91f..896c9f6bf 100644 --- a/admin/themes/default/template/controllers/products/additionalfacilities.tpl +++ b/admin/themes/default/template/controllers/products/additionalfacilities.tpl @@ -27,70 +27,105 @@ {l s='To create new Additional facilities'} {l s='click here.'}
{if isset($allDemands) && $allDemands} -
- {foreach $allDemands as $key => $demand} -
- - - {$demand['name']|escape:'html':'UTF-8'} - -
- {if isset($demand['adv_option']) && count($demand['adv_option'])} - - {else} -
- -
-
- {$defaultcurrencySign|escape:'html':'UTF-8'} - -
-
-
- {/if} + +
+ + + + + + + + + + + + + {foreach $allDemands as $key => $demand} + {assign var="rowcount" value=0} {if isset($demand['adv_option']) && $demand['adv_option']} -
- -
-
-
+ {l s='Name'} + + {l s='Option'} + + {l s='Price'} + + {l s='Tax rate'} + + {l s='Per day price calculation'} +
- - - - - - - {foreach from=$demand['adv_option'] key=key item=info} - - - - - {/foreach} -
- {l s='Option Name'} - - {l s='Price'} -
- {$info['name']|escape:'html':'UTF-8'} - -
- {$defaultcurrencySign|escape:'html':'UTF-8'} - -
-
-
-
-
+ {assign var="rowspan" value=$demand['adv_option']|count} + {assign var="adv_option" value=$demand['adv_option']} + {else} + {assign var="rowspan" value=1} + {assign var="adv_option" value=[]} {/if} -
-
- {/foreach} + {foreach $adv_option as $option} + {assign var="rowcount" value=$rowcount + 1} + + {if $rowcount <= 1} + + + + + + {$demand['name']|escape:'html':'UTF-8'} + + {/if} + + {$option['name']|escape:'html':'UTF-8'} + + +
+ {$defaultcurrencySign|escape:'html':'UTF-8'} + +
+ + {if $rowcount == 1} + + {$demand['default_tax_rules_group_name']} + + + {if $demand['price_calc_method'] == 1} + {l s='Yes'} + {else} + {l s='No'} + {/if} + + {/if} + + {foreachelse} + + + + + + {$demand['name']|escape:'html':'UTF-8'} + + + + +
+ {$defaultcurrencySign|escape:'html':'UTF-8'} + +
+ + + {$demand['default_tax_rules_group_name']} + + + {if $demand['price_calc_method'] == 1} + {l s='Yes'} + {else} + {l s='No'} + {/if} + + + {/foreach} + {/foreach} + + + + {else} +
+ {l s='No services are attached with this room type'} +
+ {/if} {/if} \ No newline at end of file diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index cb73e6fa6..c2ca8ec52 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -3270,6 +3270,17 @@ class AdminProductsControllerCore extends AdminController if ($obj->id) { $objGlobalDemand = new HotelRoomTypeGlobalDemand(); $allDemands = $objGlobalDemand->getAllDemands(); + foreach($allDemands as &$demand) { + if ($demand['id_tax_rules_group'] == 0) { + $demand['default_tax_rules_group_name'] = 'No tax'; + } else { + $objTaxRuleGroup = new TaxRulesGroup( + $demand['id_tax_rules_group'], + $this->context->language->id + ); + $demand['default_tax_rules_group_name'] = $objTaxRuleGroup->name; + } + } $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); // get room type additional facilities diff --git a/modules/hotelreservationsystem/views/templates/admin/room_type_global_demand/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/room_type_global_demand/helpers/form/form.tpl index b654a6b5e..3c0448dbc 100644 --- a/modules/hotelreservationsystem/views/templates/admin/room_type_global_demand/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/room_type_global_demand/helpers/form/form.tpl @@ -68,72 +68,6 @@ {/foreach} -
- -
-
- {$defaultcurrencySign} - -
-
-
- {if isset($taxRuleGroups)} -
- -
- -
-
- {/if} -
- -
- - - - - - - -
-
-
-
-
- {l s='Enable ("Per day price calculation"), if you want to add the price of this facility for each day in the booking. Disable, If you want to add price of the facility for entire date range of the booking.' mod='hotelreservationsystem'} -
-
-
+
+ +
+
+ {$defaultcurrencySign} + +
+
+
+ {if isset($taxRuleGroups)} +
+ +
+ +
+
+ {/if} +
+ +
+ + + + + + + +
+
+
+
+
+ {l s='Enable ("Per day price calculation"), if you want to add the price of this facility for each day in the booking. Disable, If you want to add price of the facility for entire date range of the booking.' mod='hotelreservationsystem'} +
+
+
+