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 221396a35..41ba5ca70 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/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 556c2226a..0c8e1a446 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/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/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 030d17942..45e846505 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 4c04053b5..3b943c6d9 100644 --- a/themes/hotel-reservation-theme/shopping-cart.tpl +++ b/themes/hotel-reservation-theme/shopping-cart.tpl @@ -150,6 +150,17 @@ {displayPrice price=($rm_v['amount'])} + {if (($rm_v['amount'] - $rm_v['amount_without_auto_add']) > 0) && (in_array($data_v['id_product'], $discounted_products) || $PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN)} + + + + + {/if} {if (isset($data_v['extra_demands']) && $data_v['extra_demands']) || (isset($data_v['service_products']) && $data_v['service_products'])} +