diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index c2b6f45d5..9183228dc 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -869,21 +869,14 @@ var ajaxCart = { content += '' + name + ''; content += ''; - if (this.booking_product) { - content += '
'; - content += '' + capacity_txt + ':'; - content += ' ' + this.bookingData.adults + ' ' + adults_txt + ' & ' + this.bookingData.children + ' ' + children_txt + '' - content += '
'; - } - if (this.hasAttributes) content += '
' + this.attributes + '
'; - if (typeof(freeProductTranslation) != 'undefined') { + if (typeof(freeProductTranslation) != 'undefined') { content += '
'; content += 'Price:'; - content += ''; - content += (parseFloat(this.price_float) > 0 ? this.priceByLine : freeProductTranslation); + content += ' '; + content += formatCurrency(parseFloat(this.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank); content += ''; content += '
'; } @@ -979,8 +972,8 @@ var ajaxCart = { if ($.trim($('dt[data-id="cart_block_product_' + domIdProduct + '"] .quantity').html()) != jsonProduct.quantity || $.trim($('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').html()) != jsonProduct.priceByLine) { // Usual product if (!this.is_gift) { - $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').text(jsonProduct.priceByLine); - $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').attr('ttl_prod_price', jsonProduct.total_product_price); + $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').text(formatCurrency(parseFloat(this.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank)); + $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').attr('ttl_prod_price', this.bookingData.total_room_type_amount); } else $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').html(freeProductTranslation); diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl index bbeb68201..aef6ac631 100644 --- a/modules/blockcart/blockcart.tpl +++ b/modules/blockcart/blockcart.tpl @@ -78,9 +78,9 @@ {/if}
{l s='Price' mod='blockcart'}: - + {if !isset($product.is_gift) || !$product.is_gift} - {if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total`"}{else}{displayWtPrice p="`$product.total_wt`"}{/if} + {displayWtPrice p="`$product.bookingData.total_room_type_amount`"}
{hook h="displayProductPriceBlock" product=$product type="price" from="blockcart"}
diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 11ae5e14c..6c8904be8 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1235,6 +1235,7 @@ class HotelCartBookingData extends ObjectModel $cartHotelData[$prodKey]['name'] = $objProduct->name; $cartHotelData[$prodKey]['unit_price'] = $unitPrice; $cartHotelData[$prodKey]['unit_price_without_reduction'] = $unitPriceWithoutReduction; + $cartHotelData[$prodKey]['total_room_type_amount'] = 0; // get cover image link $coverImageArr = $objProduct->getCover($product['id_product']); @@ -1432,6 +1433,7 @@ class HotelCartBookingData extends ObjectModel $cartHotelData[$prodKey]['date_diff'][$dateJoin]['feature_price_diff'] = $feature_price_diff; } + $cartHotelData[$prodKey]['total_room_type_amount'] = array_sum(array_column($cartHotelData[$prodKey]['date_diff'], 'amount')); $cartHotelData[$prodKey]['total_num_rooms'] = array_sum(array_column($cartHotelData[$prodKey]['date_diff'], 'num_rm')); } } diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index 76b77a65c..887baf3cf 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -701,21 +701,11 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $priceWithFeatureTI = 0; $priceWithFeatureTE = 0; } - if ($quantity) { - $totalPrice['total_price_tax_incl'] += $priceWithFeatureTI * $quantity; - $totalPrice['total_price_tax_excl'] += $priceWithFeatureTE * $quantity; - } else { - $totalPrice['total_price_tax_incl'] += $priceWithFeatureTI; - $totalPrice['total_price_tax_excl'] += $priceWithFeatureTE; - } + $totalPrice['total_price_tax_incl'] += $priceWithFeatureTI; + $totalPrice['total_price_tax_excl'] += $priceWithFeatureTE; } else { - if ($quantity) { - $totalPrice['total_price_tax_incl'] += $productPriceTI * $quantity; - $totalPrice['total_price_tax_excl'] += $productPriceTE * $quantity; - } else { - $totalPrice['total_price_tax_incl'] += $productPriceTI; - $totalPrice['total_price_tax_excl'] += $productPriceTE; - } + $totalPrice['total_price_tax_incl'] += $productPriceTI; + $totalPrice['total_price_tax_excl'] += $productPriceTE; } } if ($with_auto_room_services) { @@ -729,7 +719,11 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $totalPrice['total_price_tax_excl'] += $service['price']; } } - } + } + if ($quantity) { + $totalPrice['total_price_tax_incl'] = $totalPrice['total_price_tax_incl'] * $quantity; + $totalPrice['total_price_tax_excl'] = $totalPrice['total_price_tax_excl'] * $quantity; + } return $totalPrice; } 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 c2b6f45d5..9183228dc 100644 --- a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js +++ b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js @@ -869,21 +869,14 @@ var ajaxCart = { content += '' + name + ''; content += '
'; - if (this.booking_product) { - content += '
'; - content += '' + capacity_txt + ':'; - content += ' ' + this.bookingData.adults + ' ' + adults_txt + ' & ' + this.bookingData.children + ' ' + children_txt + '' - content += '
'; - } - if (this.hasAttributes) content += '
' + this.attributes + '
'; - if (typeof(freeProductTranslation) != 'undefined') { + if (typeof(freeProductTranslation) != 'undefined') { content += '
'; content += 'Price:'; - content += ''; - content += (parseFloat(this.price_float) > 0 ? this.priceByLine : freeProductTranslation); + content += ' '; + content += formatCurrency(parseFloat(this.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank); content += ''; content += '
'; } @@ -979,8 +972,8 @@ var ajaxCart = { if ($.trim($('dt[data-id="cart_block_product_' + domIdProduct + '"] .quantity').html()) != jsonProduct.quantity || $.trim($('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').html()) != jsonProduct.priceByLine) { // Usual product if (!this.is_gift) { - $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').text(jsonProduct.priceByLine); - $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').attr('ttl_prod_price', jsonProduct.total_product_price); + $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').text(formatCurrency(parseFloat(this.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank)); + $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').attr('ttl_prod_price', this.bookingData.total_room_type_amount); } else $('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').html(freeProductTranslation); diff --git a/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl b/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl index bbeb68201..aef6ac631 100644 --- a/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl +++ b/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl @@ -78,9 +78,9 @@ {/if}
{l s='Price' mod='blockcart'}: - + {if !isset($product.is_gift) || !$product.is_gift} - {if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total`"}{else}{displayWtPrice p="`$product.total_wt`"}{/if} + {displayWtPrice p="`$product.bookingData.total_room_type_amount`"}
{hook h="displayProductPriceBlock" product=$product type="price" from="blockcart"}