diff --git a/admin/themes/default/template/controllers/products/additionalfacilities.tpl b/admin/themes/default/template/controllers/products/additionalfacilities.tpl index f3f6ee91f..5939c795a 100644 --- a/admin/themes/default/template/controllers/products/additionalfacilities.tpl +++ b/admin/themes/default/template/controllers/products/additionalfacilities.tpl @@ -27,70 +27,112 @@ {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'} + +
+
+ {displayPrice price={$option['price']|escape:'html':'UTF-8'} currency=$module->id_currency} +
+ + + {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'} + +
+
+ {displayPrice price={$demand['price']|escape:'html':'UTF-8'} currency=$module->id_currency} +
+ + + {$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/classes/Cart.php b/classes/Cart.php index 3e6443968..296fe755d 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -3783,7 +3783,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]); } @@ -3823,6 +3836,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 f21c15870..2f19b9f61 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/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index e1c53fd2d..21b31f6a7 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -151,7 +151,14 @@ class AdminOrderPreferencesControllerCore extends AdminController 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval' - ) + ), + 'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => array( + 'title' => $this->l('Show room price breakdown'), + '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' + ), ), 'submit' => array('title' => $this->l('Save')) ), diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index cfa986cc8..88df3cd66 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -3276,15 +3276,26 @@ 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 $objRoomDemand = new HotelRoomTypeDemand(); - $roomDemandPrices = $objRoomDemand->getRoomTypeDemands($obj->id, 0, 0); + $selectedDemands = $objRoomDemand->getRoomTypeDemands($obj->id, 0, 0); $data->assign(array( 'product' => $obj, - 'roomDemandPrices' => $roomDemandPrices, + 'selectedDemands' => $selectedDemands, 'allDemands' => $allDemands, 'defaultcurrencySign' => $objCurrency->sign, )); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index d29ae9f9c..17ef02dcb 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -466,6 +466,7 @@ class OrderOpcControllerCore extends ParentOrderController // 'defaultcurrencySign' => $objCurrency->sign, 'THEME_DIR' => _THEME_DIR_, 'PS_CUSTOMER_ADDRESS_CREATION' => Configuration::get('PS_CUSTOMER_ADDRESS_CREATION'), + 'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => Configuration::get('PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN'), 'free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, @@ -556,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 ec4be6647..9bb0ba5f0 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/js/admin/products.js b/js/admin/products.js index 5c9c7bd38..34863cfa9 100644 --- a/js/admin/products.js +++ b/js/admin/products.js @@ -654,6 +654,21 @@ product_tabs['Features'] = new function(){ displayFlags(languages, id_language, allowEmployeeFormLang); } } +product_tabs['AdditionalFacilities'] = new function(){ + this.onReady = function(){ + $('#demands_table .selected_demand').on('click', function() { + let input_block = $('#demands_table').find('.demand_price_'+$(this).val()); + if ($(this).is(':checked')) { + $(input_block).find('.price_input').show(); + $(input_block).find('.price_display').hide(); + } else { + $(input_block).find('.price_input'); + $(input_block).find('.price_input').hide(); + $(input_block).find('.price_display').show(); + } + }); + } +} /** * Update the product image list position buttons diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 2b0902d10..afae39dcb 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1335,12 +1335,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']); @@ -1363,12 +1377,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/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'} +
+
+
+