From 28854e91f49a8fef5fed9f2e1cb6f290b4a18d79 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 6 Apr 2023 16:07:10 +0530 Subject: [PATCH] updated order summary in block cart popup and dropdown --- modules/blockcart/ajax-cart.js | 16 ++-- modules/blockcart/blockcart.css | 81 +++++++++---------- modules/blockcart/blockcart.php | 12 +-- modules/blockcart/blockcart.tpl | 20 ++--- .../css/modules/blockcart/blockcart.css | 2 +- .../js/modules/blockcart/ajax-cart.js | 16 ++-- .../modules/blockcart/blockcart.tpl | 20 ++--- 7 files changed, 84 insertions(+), 83 deletions(-) diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index b23f26b68..bf5b7f96b 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -912,7 +912,7 @@ var ajaxCart = { content += ''; content += '' + $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v.data_form)) + ' - ' + $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v.data_to)) + ''; content += '' + date_diff_v.num_rm + ''; - content += '' + formatCurrency(parseFloat(date_diff_v.amount), currency_format, currency_sign, currency_blank) + ''; + content += '' + formatCurrency(parseFloat(date_diff_v.amount) + parseFloat(date_diff_v.demand_price), currency_format, currency_sign, currency_blank) + ''; content += ''; content += ''; content += ''; @@ -949,7 +949,7 @@ var ajaxCart = { booking_dates_content += ''; booking_dates_content += '' + $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v1.data_form)) + ' - ' + $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v1.data_to)) + ''; booking_dates_content += '' + date_diff_v1.num_rm + ''; - booking_dates_content += '' + formatCurrency(parseFloat(date_diff_v1.amount), currency_format, currency_sign, currency_blank) + ''; + booking_dates_content += '' + formatCurrency(parseFloat(date_diff_v1.amount) + parseFloat(date_diff_v1.demand_price), currency_format, currency_sign, currency_blank) + ''; booking_dates_content += ''; booking_dates_content += ''; booking_dates_content += ''; @@ -1154,16 +1154,20 @@ var ajaxCart = { if (hasDeliveryAddress) $('.ajax_cart_shipping_cost').parent().find('.unvisible').show(); - $('.ajax_cart_tax_cost').text(jsonData.taxCost); + $('.ajax_cart_tax_cost').text(jsonData.tax_cost); $('.cart_block_wrapping_cost').text(jsonData.wrapping_cost); $('.ajax_block_cart_total').text(jsonData.total); $('.ajax_block_cart_total').attr('total_cart_price', jsonData.totalToPay); - $('.ajax_block_products_total').text(jsonData.product_total); - $('.ajax_block_room_total').text(jsonData.roomTotal); + $('.ajax_block_room_total').text(jsonData.room_total); $('.ajax_block_nornal_products_total').text(jsonData.normalProductsTotal); - $('.ajax_cart_extra_demands_cost').text(jsonData.total_extra_services_format); + $('.ajax_cart_convenience_fee').text(jsonData.total_convenience_fee_format); + if (jsonData.total_convenience_fee) { + $('.ajax_cart_convenience_fee').parent().show(); + } else { + $('.ajax_cart_convenience_fee').parent().hide(); + } $('.ajax_total_price_wt').text(jsonData.total_price_wt); if (parseFloat(jsonData.free_shipping_float) > 0) { diff --git a/modules/blockcart/blockcart.css b/modules/blockcart/blockcart.css index fa6ae376e..35e18d341 100644 --- a/modules/blockcart/blockcart.css +++ b/modules/blockcart/blockcart.css @@ -1,39 +1,38 @@ -/******************************************************************* - Cart Block Styles -********************************************************************/ -#header .shopping_cart { - position: relative; - float: right; - /*margin-bottom: 20px;*/ - /*padding-top: 5px;*/ } - #header .shopping_cart > a:first-child:after { - content: "\f0d7"; - font-family: "FontAwesome"; - display: inline-block; - float: right; - font-size: 11px; - color: #FFFFFF; - padding: 6px 0 0 0; } - #header .shopping_cart > a:first-child:hover:after { - content: "\f0d8"; - padding: 4px 0px 0px 0px; } +/** +* 2010-2022 Webkul. +* +* NOTICE OF LICENSE +* +* All right is reserved, +* Please go through LICENSE.txt file inside our module +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to newer +* versions in the future. If you wish to customize this module for your +* needs please refer to CustomizationPolicy.txt file inside our module for more information. +* +* @author Webkul IN +* @copyright 2010-2022 Webkul IN +* @license LICENSE.txt +*/ -.shopping_cart { - width: 34px; } - @media (max-width: 480px) { - /*.shopping_cart { - padding-top: 20px; }*/ } - @media (max-width: 1200px) { - .shopping_cart { - margin: 0 auto; - float: none;} } +#header .shopping_cart > a:first-child:after { + content: "\f0d7"; + font-family: "FontAwesome"; + font-size: 12px; + padding: 0 2px; + position: relative; + top: -1px; + color: #fff; } +#header .shopping_cart > a:first-child:hover::after { + content: "\f0d8"; + top: -2px; } .shopping_cart > a:first-child { - /*padding: 7px 10px;*/ - padding-top: 7px; - /*background-color: #BF9958;*/ display: block; font-weight: bold; - color: #777777; + font-size: 20px; + color: #777; text-shadow: 1px 1px rgba(0, 0, 0, 0.2); overflow: hidden; } @media (min-width: 768px) and (max-width: 991px) { @@ -49,15 +48,8 @@ .shopping_cart > a:first-child:before { content: "\f07a"; font-family: "FontAwesome"; - display: inline-block; - font-size: 20px; - line-height: 23px; color: #fff; - top: 9px; - left: 0px; - z-index: 100; - position: absolute; - padding-right: 5px; } + z-index: 100; } .shopping_cart .ajax_cart_total { display: none !important; } .shopping_cart .block_cart_expand:after, .shopping_cart .block_cart_collapse:after { @@ -234,7 +226,7 @@ .cart_block .cart_block_tax_cost, .cart_block .cart_block_total, .cart_block .cart_block_wrapping_cost, -.cart_block .cart_block_additional_facilities_cost { +.cart_block .cart_block_convenience_fee { float: right; } .cart_block table.vouchers { @@ -487,11 +479,10 @@ .remove_rooms_from_cart_link:hover { color: #515151; } -.badge_style -{ +.badge_style { left: 13px; position: absolute; - top: 2px; + top: -8px; z-index: 200; } @@ -547,4 +538,4 @@ { border: none; } -} \ No newline at end of file +} diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index 35eb65e97..17d01b341 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -267,7 +267,10 @@ class Blockcart extends Module unset($this->context->cookie->currentAddedProduct); } - $totalAdditionalServicesPrice = $this->context->cart->getOrderTotal(false, Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD); + $totalAdditionalServicesWithoutAutoAddPrice = $params['cart']->getOrderTotal($useTax, Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD); + $totalAdditionalServicesWithAutoAddPrice = $params['cart']->getOrderTotal($useTax, Cart::ONLY_ROOM_SERVICES); + $totalConvenienceFee = $params['cart']->getOrderTotal($useTax, Cart::ONLY_CONVENIENCE_FEE); + $totalRoomsPrice = $params['cart']->getOrderTotal($useTax, Cart::ONLY_ROOMS); $response = array( 'products' => $products, @@ -285,11 +288,10 @@ class Blockcart extends Module 'tax_cost' => $tax_cost, 'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency), 'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_PRODUCTS), $currency), - 'room_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_ROOMS), $currency), - // 'normal_products_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_NORMAL_PRODUCTS), $currency), + 'room_total' => Tools::displayPrice($totalRoomsPrice + $totalDemandsPrice + $totalAdditionalServicesWithAutoAddPrice - $totalConvenienceFee), 'totalToPay' => $totalToPay, - 'total_extra_services' => $totalDemandsPrice + $totalAdditionalServicesPrice, - 'total_extra_services_format' => Tools::displayPrice(($totalDemandsPrice + $totalAdditionalServicesPrice), $currency), + 'total_convenience_fee' => $totalConvenienceFee, + 'total_convenience_fee_format' => Tools::displayPrice(($totalConvenienceFee), $currency), 'total' => Tools::displayPrice($totalToPay, $currency), 'order_process' => $orderProcess, 'ajax_allowed' => (int) (Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false, diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl index 6c64c9c3b..bbeb68201 100644 --- a/modules/blockcart/blockcart.tpl +++ b/modules/blockcart/blockcart.tpl @@ -124,7 +124,7 @@ {$data_v['data_form']|date_format:"%d-%m-%Y"} - {$data_v['data_to']|date_format:"%d-%m-%Y"} {$data_v['num_rm']} - {convertPrice price=$data_v['amount']} + {convertPrice price=($data_v['amount'] + $data_v['demand_price'])} {/foreach} @@ -222,10 +222,10 @@ {l s='Tax' mod='blockcart'} {/if} - {if isset($total_extra_services)} + {if isset($total_convenience_fee)}
- {convertPrice price=$total_extra_services} - {l s='Extra Services Cost' mod='blockcart'} + {convertPrice price=$total_convenience_fee} + {l s='Convenience Fees' mod='blockcart'}
{/if}
@@ -314,7 +314,7 @@ {/if} {/if} - + {if $cart_qties > 0} {convertPrice price=$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS)} {/if} @@ -354,16 +354,16 @@ {/if}
--> - {if isset($total_extra_services)} + {if isset($total_convenience_fee)}
- {l s='Total Extra Services Cost' mod='blockcart'} - {convertPrice price=$total_extra_services} + {l s='Convenience Fees' mod='blockcart'} + {convertPrice price=$total_convenience_fee}
{/if} {if $show_tax && $use_tax}
{l s='Tax' mod='blockcart'} - {$tax_cost} + {$tax_cost}
{/if}
@@ -377,7 +377,7 @@ {/if} {/if} - + {if $cart_qties > 0} {if $priceDisplay == 1} {convertPrice price=$cart->getOrderTotal(false)} diff --git a/themes/hotel-reservation-theme/css/modules/blockcart/blockcart.css b/themes/hotel-reservation-theme/css/modules/blockcart/blockcart.css index f4fc05baa..35e18d341 100644 --- a/themes/hotel-reservation-theme/css/modules/blockcart/blockcart.css +++ b/themes/hotel-reservation-theme/css/modules/blockcart/blockcart.css @@ -226,7 +226,7 @@ .cart_block .cart_block_tax_cost, .cart_block .cart_block_total, .cart_block .cart_block_wrapping_cost, -.cart_block .cart_block_additional_facilities_cost { +.cart_block .cart_block_convenience_fee { float: right; } .cart_block table.vouchers { 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 b23f26b68..bf5b7f96b 100644 --- a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js +++ b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js @@ -912,7 +912,7 @@ var ajaxCart = { content += ''; content += '' + $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v.data_form)) + ' - ' + $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v.data_to)) + ''; content += '' + date_diff_v.num_rm + ''; - content += '' + formatCurrency(parseFloat(date_diff_v.amount), currency_format, currency_sign, currency_blank) + ''; + content += '' + formatCurrency(parseFloat(date_diff_v.amount) + parseFloat(date_diff_v.demand_price), currency_format, currency_sign, currency_blank) + ''; content += ''; content += ''; content += ''; @@ -949,7 +949,7 @@ var ajaxCart = { booking_dates_content += ''; booking_dates_content += '' + $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v1.data_form)) + ' - ' + $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v1.data_to)) + ''; booking_dates_content += '' + date_diff_v1.num_rm + ''; - booking_dates_content += '' + formatCurrency(parseFloat(date_diff_v1.amount), currency_format, currency_sign, currency_blank) + ''; + booking_dates_content += '' + formatCurrency(parseFloat(date_diff_v1.amount) + parseFloat(date_diff_v1.demand_price), currency_format, currency_sign, currency_blank) + ''; booking_dates_content += ''; booking_dates_content += ''; booking_dates_content += ''; @@ -1154,16 +1154,20 @@ var ajaxCart = { if (hasDeliveryAddress) $('.ajax_cart_shipping_cost').parent().find('.unvisible').show(); - $('.ajax_cart_tax_cost').text(jsonData.taxCost); + $('.ajax_cart_tax_cost').text(jsonData.tax_cost); $('.cart_block_wrapping_cost').text(jsonData.wrapping_cost); $('.ajax_block_cart_total').text(jsonData.total); $('.ajax_block_cart_total').attr('total_cart_price', jsonData.totalToPay); - $('.ajax_block_products_total').text(jsonData.product_total); - $('.ajax_block_room_total').text(jsonData.roomTotal); + $('.ajax_block_room_total').text(jsonData.room_total); $('.ajax_block_nornal_products_total').text(jsonData.normalProductsTotal); - $('.ajax_cart_extra_demands_cost').text(jsonData.total_extra_services_format); + $('.ajax_cart_convenience_fee').text(jsonData.total_convenience_fee_format); + if (jsonData.total_convenience_fee) { + $('.ajax_cart_convenience_fee').parent().show(); + } else { + $('.ajax_cart_convenience_fee').parent().hide(); + } $('.ajax_total_price_wt').text(jsonData.total_price_wt); if (parseFloat(jsonData.free_shipping_float) > 0) { diff --git a/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl b/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl index 6c64c9c3b..bbeb68201 100644 --- a/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl +++ b/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl @@ -124,7 +124,7 @@ {$data_v['data_form']|date_format:"%d-%m-%Y"} - {$data_v['data_to']|date_format:"%d-%m-%Y"} {$data_v['num_rm']} - {convertPrice price=$data_v['amount']} + {convertPrice price=($data_v['amount'] + $data_v['demand_price'])} {/foreach} @@ -222,10 +222,10 @@ {l s='Tax' mod='blockcart'}
{/if} - {if isset($total_extra_services)} + {if isset($total_convenience_fee)}
- {convertPrice price=$total_extra_services} - {l s='Extra Services Cost' mod='blockcart'} + {convertPrice price=$total_convenience_fee} + {l s='Convenience Fees' mod='blockcart'}
{/if}
@@ -314,7 +314,7 @@ {/if} {/if} - + {if $cart_qties > 0} {convertPrice price=$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS)} {/if} @@ -354,16 +354,16 @@ {/if}
--> - {if isset($total_extra_services)} + {if isset($total_convenience_fee)}
- {l s='Total Extra Services Cost' mod='blockcart'} - {convertPrice price=$total_extra_services} + {l s='Convenience Fees' mod='blockcart'} + {convertPrice price=$total_convenience_fee}
{/if} {if $show_tax && $use_tax}
{l s='Tax' mod='blockcart'} - {$tax_cost} + {$tax_cost}
{/if}
@@ -377,7 +377,7 @@ {/if} {/if} - + {if $cart_qties > 0} {if $priceDisplay == 1} {convertPrice price=$cart->getOrderTotal(false)}