Added: New variables in cart summary to display the price more correctly

This commit is contained in:
vishalsingh.qlo325
2024-10-03 19:28:11 +05:30
parent cc5a1d4cac
commit ab59b310a0
3 changed files with 20 additions and 10 deletions

View File

@@ -387,7 +387,6 @@
let haserror = false
if ($(this).hasClass('num_children')) {
max_child_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_children').val();
console.log(no_children_allowed_txt);
if (elementVal > max_child_in_room) {
$(this).val(max_child_in_room);
if (elementVal == 1) {
@@ -705,13 +704,12 @@
}
function updateCartSummaryData(jsonSummary) {
var totalRooms = jsonSummary.summary.total_rooms + jsonSummary.summary.total_extra_demands + jsonSummary.summary.total_additional_services + jsonSummary.summary.total_additional_services_auto_add;
$('#total_rooms').html(formatCurrency(parseFloat(totalRooms), currency_format, currency_sign, currency_blank));
$('#total_rooms').html(formatCurrency(parseFloat(jsonSummary.summary.total_rooms_services_tax_excl_without_discount), currency_format, currency_sign, currency_blank));
$('#total_vouchers').html(formatCurrency(parseFloat(jsonSummary.summary.total_discounts), currency_format, currency_sign, currency_blank));
$('#total_convenience_fees').html(formatCurrency(parseFloat(jsonSummary.summary.convenience_fee), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(formatCurrency(parseFloat(totalRooms + jsonSummary.summary.convenience_fee), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax_excl_without_discount), currency_format, currency_sign, currency_blank));
// $('#total_service_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_service_products), currency_format, currency_sign, currency_blank));
$('#total_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax), currency_format, currency_sign, currency_blank));
$('#total_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax_without_discount), currency_format, currency_sign, currency_blank));
$('#total_with_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price), currency_format, currency_sign, currency_blank));
$('#payment_amount').val(jsonSummary.summary.total_price);
@@ -1212,12 +1210,11 @@
shipping_price_selected_carrier = jsonSummary.summary.total_shipping;
var totalRooms = jsonSummary.summary.total_rooms + jsonSummary.summary.total_extra_demands + jsonSummary.summary.total_additional_services + jsonSummary.summary.total_additional_services_auto_add;
$('#total_vouchers').html(formatCurrency(parseFloat(jsonSummary.summary.total_discounts), currency_format, currency_sign, currency_blank));
$('#total_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(formatCurrency(parseFloat(totalRooms + jsonSummary.summary.convenience_fee), currency_format, currency_sign, currency_blank));
$('#total_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax_without_discount), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax_excl_without_discount), currency_format, currency_sign, currency_blank));
$('#total_with_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price), currency_format, currency_sign, currency_blank));
$('#total_rooms').html(formatCurrency(parseFloat(totalRooms), currency_format, currency_sign, currency_blank));
$('#total_rooms').html(formatCurrency(parseFloat(jsonSummary.summary.total_rooms_services_tax_excl_without_discount), currency_format, currency_sign, currency_blank));
$('#total_convenience_fees').html(formatCurrency(parseFloat(jsonSummary.summary.convenience_fee), currency_format, currency_sign, currency_blank));
// $('#total_service_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_service_products), currency_format, currency_sign, currency_blank));

View File

@@ -3772,6 +3772,14 @@ class CartCore extends ObjectModel
}
$objHotelAdvancedPayment = new HotelAdvancedPayment();
$total_rooms_services_tax_excl_without_discount = $total_rooms + $total_demands + $total_additional_services + $total_additional_services_auto_add;
$total_rooms_services_tax_incl_without_discount = $total_rooms_wt + $total_demands_wt + $total_additional_services_wt + $total_additional_services_auto_add_wt;
$total_tax_excl_without_discount = $total_rooms_services_tax_excl_without_discount + $convenience_fee;
$total_tax_incl_without_discount = $total_rooms_services_tax_incl_without_discount + $convenience_fee_wt;
$total_tax_without_discount = $total_tax_incl_without_discount - $total_tax_excl_without_discount;
if ($total_tax_without_discount < 0) {
$total_tax_without_discount = 0;
}
$summary = array(
'delivery' => $delivery,
@@ -3814,6 +3822,11 @@ class CartCore extends ObjectModel
'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),
'total_rooms_services_tax_excl_without_discount' => $total_rooms_services_tax_excl_without_discount,
'total_rooms_services_tax_incl_without_discount' => $total_rooms_services_tax_incl_without_discount,
'total_tax_excl_without_discount' => $total_tax_excl_without_discount,
'total_tax_incl_without_discount' => $total_tax_incl_without_discount,
'total_tax_without_discount' => $total_tax_without_discount
);
$hook = Hook::exec('actionCartSummary', $summary, null, true);

View File

@@ -301,7 +301,7 @@
{if $show_taxes}
<p class="cart_total_tax">
<span>{l s='Total tax'}</span>
<span class="cart_total_values">{displayPrice price=($total_tax)}</span>
<span class="cart_total_values">{displayPrice price=($total_tax_without_discount)}</span>
</p>
{/if}
<p class="total_discount_block {if $total_discounts == 0}unvisible{/if}">