From 26fbe1c5151a997f7ae420d1fc044dbf33192098 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 1 Mar 2024 19:21:09 +0530 Subject: [PATCH] Fixed Convenience fees not added in cart summary in admin book now page --- .../classes/HotelCartBookingData.php | 26 +++++++++++++++++++ .../AdminHotelRoomsBookingController.php | 10 +++---- .../helpers/view/_partials/booking-cart.tpl | 6 ++--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 11ae5e14c..12c306081 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1011,6 +1011,32 @@ class HotelCartBookingData extends ObjectModel false, 1 ); + $cart_detail_data[$key]['additional_services_auto_add_with_room_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart( + $id_cart, + 0, + 0, + $value['id_product'], + $value['date_from'], + $value['date_to'], + $value['id'], + false, + 1, + null, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ); + $cart_detail_data[$key]['additional_services_auto_add_independent_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart( + $id_cart, + 0, + 0, + $value['id_product'], + $value['date_from'], + $value['date_to'], + $value['id'], + false, + 1, + null, + Product::PRICE_ADDITION_TYPE_INDEPENDENT + ); // By webkul New way to calculate product prices with feature Prices $roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $value['id_product'], diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index 0166e41c0..1d5bf5b78 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -355,10 +355,8 @@ class AdminHotelRoomsBookingController extends ModuleAdminController $objHotelServiceProductCartDetail = new HotelServiceProductCartDetail(); if ($cartProducts = $this->context->cart->getProducts()) { - if ($cart_bdata = $objHotelCartBookingData->getCartBookingDetailsByIdCartIdGuest( - $this->context->cart->id, - $this->context->cookie->id_guest, - $this->context->employee->id_lang + if ($cart_bdata = $objHotelCartBookingData->getCartFormatedBookinInfoByIdCart( + $this->context->cart->id )) { $smartyVars['cart_bdata'] = $cart_bdata; } @@ -371,7 +369,9 @@ class AdminHotelRoomsBookingController extends ModuleAdminController $smartyVars['rms_in_cart'] = $objHotelCartBookingData->getCountRoomsInCart($this->id_cart, $this->id_guest); $smartyVars['products_in_cart'] = $products_in_cart; $smartyVars['total_products_in_cart'] = (int)$rms_in_cart + (int)$products_in_cart; - $smartyVars['cart_tamount'] = $this->context->cart->getOrderTotal(); + $cartAmountTotal = $this->context->cart->getOrderTotal(false); + $cartAmountConvenienceFee = $this->context->cart->getOrderTotal(false, cart::ONLY_CONVENIENCE_FEE); + $smartyVars['cart_tamount'] = $cartAmountTotal - $cartAmountConvenienceFee; $this->context->smarty->assign($smartyVars); } diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-cart.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-cart.tpl index c408bbf6c..fdb65447e 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-cart.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-cart.tpl @@ -27,7 +27,7 @@ {$cart_data['room_num']|escape:'htmlall':'UTF-8'} {$cart_data['room_type']|escape:'htmlall':'UTF-8'} {dateFormat date=$cart_data['date_from']} - {dateFormat date=$cart_data['date_to']} - {convertPrice price=$cart_data['amt_with_qty']} + {convertPrice price=($cart_data['amt_with_qty'] + $cart_data['additional_services_auto_add_with_room_price'] + $cart_data['additional_service_price'] + $cart_data['demand_price'])} {/foreach} @@ -54,7 +54,7 @@ {$cart_data['name']|escape:'htmlall':'UTF-8'} {$cart_data['hotel_name']|escape:'htmlall':'UTF-8'} {$cart_data['quantity']|escape:'htmlall':'UTF-8'} - {convertPrice price=$cart_data['total_price_tax_incl']} + {convertPrice price=$cart_data['total_price_tax_excl']} {/foreach} @@ -69,7 +69,7 @@
- +
{l s='Total Amount (Tax incl.):' mod='hotelreservationsystem'}{l s='Total Amount (Tax excl.):' mod='hotelreservationsystem'} {if isset($cart_tamount)}{convertPrice price=$cart_tamount}{else}{convertPrice price=0}{/if}