Fix incorrect room price in booking popup and cart dropdown
This commit is contained in:
@@ -869,21 +869,14 @@ var ajaxCart = {
|
||||
content += '<a href="' + this.link + '" title="' + this.name + '" class="cart_block_product_name">' + name + '</a>';
|
||||
content += '</div>';
|
||||
|
||||
if (this.booking_product) {
|
||||
content += '<div class="room-capacity cart-info-sec">';
|
||||
content += '<span class="product_info_label">' + capacity_txt + ':</span>';
|
||||
content += '<span class="product_info_data"> ' + this.bookingData.adults + ' ' + adults_txt + ' & ' + this.bookingData.children + ' ' + children_txt + '</span>'
|
||||
content += '</div>';
|
||||
}
|
||||
|
||||
if (this.hasAttributes)
|
||||
content += '<div class="product-atributes"><a href="' + this.link + '" title="' + this.name + '">' + this.attributes + '</a></div>';
|
||||
|
||||
if (typeof(freeProductTranslation) != 'undefined') {
|
||||
if (typeof(freeProductTranslation) != 'undefined') {
|
||||
content += '<div class="cart-info-sec rm_product_info_' + productId + '">';
|
||||
content += '<span class="product_info_label">Price:</span>';
|
||||
content += '<span class="price product_info_data" ttl_prod_price="' + this.total_product_price + '">';
|
||||
content += (parseFloat(this.price_float) > 0 ? this.priceByLine : freeProductTranslation);
|
||||
content += '<span class="price product_info_data" ttl_prod_price="' + this.bookingData.total_room_type_amount + '"> ';
|
||||
content += formatCurrency(parseFloat(this.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank);
|
||||
content += '</span>';
|
||||
content += '</div>';
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@
|
||||
{/if}
|
||||
<div class="cart-info-sec rm_product_info_{$product.id_product}">
|
||||
<span class="product_info_label">{l s='Price' mod='blockcart'}:</span>
|
||||
<span class="price product_info_data" ttl_prod_price={if $priceDisplay == $smarty.const.PS_TAX_EXC}{$product.total}{else}{$product.total_wt}{/if}>
|
||||
<span class="price product_info_data" ttl_prod_price="{$product.bookingData.total_room_type_amount}">
|
||||
{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`"}
|
||||
<div id="hookDisplayProductPriceBlock-price">
|
||||
{hook h="displayProductPriceBlock" product=$product type="price" from="blockcart"}
|
||||
</div>
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -869,21 +869,14 @@ var ajaxCart = {
|
||||
content += '<a href="' + this.link + '" title="' + this.name + '" class="cart_block_product_name">' + name + '</a>';
|
||||
content += '</div>';
|
||||
|
||||
if (this.booking_product) {
|
||||
content += '<div class="room-capacity cart-info-sec">';
|
||||
content += '<span class="product_info_label">' + capacity_txt + ':</span>';
|
||||
content += '<span class="product_info_data"> ' + this.bookingData.adults + ' ' + adults_txt + ' & ' + this.bookingData.children + ' ' + children_txt + '</span>'
|
||||
content += '</div>';
|
||||
}
|
||||
|
||||
if (this.hasAttributes)
|
||||
content += '<div class="product-atributes"><a href="' + this.link + '" title="' + this.name + '">' + this.attributes + '</a></div>';
|
||||
|
||||
if (typeof(freeProductTranslation) != 'undefined') {
|
||||
if (typeof(freeProductTranslation) != 'undefined') {
|
||||
content += '<div class="cart-info-sec rm_product_info_' + productId + '">';
|
||||
content += '<span class="product_info_label">Price:</span>';
|
||||
content += '<span class="price product_info_data" ttl_prod_price="' + this.total_product_price + '">';
|
||||
content += (parseFloat(this.price_float) > 0 ? this.priceByLine : freeProductTranslation);
|
||||
content += '<span class="price product_info_data" ttl_prod_price="' + this.bookingData.total_room_type_amount + '"> ';
|
||||
content += formatCurrency(parseFloat(this.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank);
|
||||
content += '</span>';
|
||||
content += '</div>';
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@
|
||||
{/if}
|
||||
<div class="cart-info-sec rm_product_info_{$product.id_product}">
|
||||
<span class="product_info_label">{l s='Price' mod='blockcart'}:</span>
|
||||
<span class="price product_info_data" ttl_prod_price={if $priceDisplay == $smarty.const.PS_TAX_EXC}{$product.total}{else}{$product.total_wt}{/if}>
|
||||
<span class="price product_info_data" ttl_prod_price="{$product.bookingData.total_room_type_amount}">
|
||||
{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`"}
|
||||
<div id="hookDisplayProductPriceBlock-price">
|
||||
{hook h="displayProductPriceBlock" product=$product type="price" from="blockcart"}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user