diff --git a/admin/themes/default/template/controllers/carts/helpers/view/view.tpl b/admin/themes/default/template/controllers/carts/helpers/view/view.tpl index 2962f9e3e..7b8f5d90e 100644 --- a/admin/themes/default/template/controllers/carts/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/carts/helpers/view/view.tpl @@ -98,36 +98,141 @@ {foreach from=$cart_htl_data item='room'} - - - - - {$room.room_type} + + + + + {$room['room_type']} + + + {$room['room_type_info'].hotel_name} + {dateFormat date=$room['date_from']} - {dateFormat date=$room['date_to']} + + + {if $room['adults']}{$room['adults']}{/if} {if $room['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$room['children']}}, {$room['children']} {if $room['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if} + + + {displayWtPriceWithCurrency price=$room['feature_price_tax_excl'] currency=$currency} + + {if (isset($room['extra_demands']) && $room['extra_demands']) || (isset($room['additional_service']) && $room['additional_service'])} + + {displayWtPriceWithCurrency price=($room['demand_price'] + $room['additional_service_price'] + $room['additional_services_auto_add_price'])|escape:'html':'UTF-8' currency=$currency} - - {$room.room_type_info.hotel_name} - {dateFormat date=$room.date_from} - {dateFormat date=$room.date_to} - - - {if $room['adults']}{$room['adults']}{/if} {if $room['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$room['children']}}, {$room['children']} {if $room['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if} - - - {displayWtPriceWithCurrency price=$room.feature_price_tax_excl currency=$currency} - - {if (isset($room.extra_demands) && $room.extra_demands) || (isset($room.additional_service) && $room.additional_service)} - {displayWtPriceWithCurrency price=($room.demand_price + $room.additional_service_price + $room.additional_services_auto_add_price)|escape:'html':'UTF-8' currency=$currency} - {else} - {displayWtPriceWithCurrency price=0 currency=$currency} - {/if} - - - {if (isset($room.extra_demands) && $room.extra_demands) || (isset($room.additional_service) && $room.additional_service)} - {displayWtPriceWithCurrency price=($room.amt_with_qty + $room.additional_services_auto_add_price + $room.demand_price + $room.additional_service_price)|escape:'html':'UTF-8' currency=$currency} - {else} - {displayWtPriceWithCurrency price=$room.amt_with_qty|escape:'html':'UTF-8' currency=$currency} - {/if} - - + {else} + {displayWtPriceWithCurrency price=0 currency=$currency} + {/if} + + + {if (isset($room['extra_demands']) && $room['extra_demands']) || (isset($room['additional_service']) && $room['additional_service'])} + {displayWtPriceWithCurrency price=($room['amt_with_qty'] + $room['additional_services_auto_add_price'] + $room['demand_price'] + $room['additional_service_price'])|escape:'html':'UTF-8' currency=$currency} + {else} + {displayWtPriceWithCurrency price=$room['amt_with_qty']|escape:'html':'UTF-8' currency=$currency} + {/if} + + + {/foreach} diff --git a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl index 240b54e55..51dab43c8 100644 --- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl +++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl @@ -103,57 +103,54 @@
{assign var=roomCount value=1} - {foreach $selectedRoomServiceProduct as $cartRoom} -
-
- - - {if isset($cartRoom['room_num']) && $cartRoom['room_num']} - {l s='Room'} {$cartRoom['room_num']|escape:'html':'UTF-8'} - {else} - {l s='Room'} {$roomCount|escape:'html':'UTF-8'} - {/if} - -
-
- {if isset($roomTypeServiceProducts) && $roomTypeServiceProducts} - {foreach $roomTypeServiceProducts as $product} -
-
-
-
- -
-
-

{$product['name']|escape:'html':'UTF-8'}

- {if $product.allow_multiple_quantity} -
- -
- {/if} -
+
+
+ + + {if isset($selectedRoomServiceProduct['room_num']) && $selectedRoomServiceProduct['room_num']} + {l s='Room'} {$selectedRoomServiceProduct['room_num']|escape:'html':'UTF-8'} + {else} + {l s='Room'} {$roomCount|escape:'html':'UTF-8'} + {/if} + +
+
+ {if isset($roomTypeServiceProducts) && $roomTypeServiceProducts} + {foreach $roomTypeServiceProducts as $product} +
+
+
+
+ +
+
+

{$product['name']|escape:'html':'UTF-8'}

+ {if $product.allow_multiple_quantity} +
+ +
+ {/if}
-
- {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} - {l s='Convenience fee'} - {/if} - {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} - {l s='Auto added'} - {/if} -
-
- {if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)} - {convertPrice price=$product.price_tax_exc} - {/if} -
- {/foreach} - {/if} -
+
+ {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} + {l s='Convenience fee'} + {/if} + {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} + {l s='Auto added'} + {/if} +
+
+ {if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)} + {convertPrice price=$product.price_tax_exc} + {/if} +
+
+ {/foreach} + {/if}
- {assign var=roomCount value=1} - {/foreach} +
{/if} diff --git a/classes/Cart.php b/classes/Cart.php index fe5e5a1a1..b80b8fbaf 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -792,8 +792,9 @@ class CartCore extends ObjectModel } } else if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $row['service_product_type']) { $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); - $totalPriceByProductTaxIncl = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart($this->id, (int)$row['id_product'], 0, 0, 0, 0, 0, 1, true, null); - $totalPriceByProductTaxExcl = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart($this->id, (int)$row['id_product'], 0, 0, 0, 0, 0, 1, false, null); + $totalPriceByProductTaxIncl = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart($this->id, (int)$row['id_product'], 0, 0, 0, 0, 0, true, null); + $totalPriceByProductTaxExcl = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart($this->id, (int)$row['id_product'], 0, 0, 0, 0, 0, false, null); + switch (Configuration::get('PS_ROUND_TYPE')) { case Order::ROUND_TOTAL: @@ -1795,7 +1796,7 @@ class CartCore extends ObjectModel } else if (!$product['booking_product'] && Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type']) { $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); - $totalPriceByProduct = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart( + $totalPriceByProduct = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart( $this->id, (int)$product['id_product'], isset($product['id_hotel']) ? $product['id_hotel'] : 0, @@ -1803,7 +1804,6 @@ class CartCore extends ObjectModel 0, 0, 0, - 1, $with_taxes, null ); diff --git a/classes/Customer.php b/classes/Customer.php index 519b96b23..663f28bbc 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -585,7 +585,7 @@ class CustomerCore extends ObjectModel WHERE c.`id_customer` = '.(int)$this->id); $result['last_visit'] = $result2['last_visit']; - $result['age'] = ($result3['age'] != date('Y') ? $result3['age'] : '--'); + $result['age'] = isset($result3['age']) && ($result3['age'] != date('Y') ? $result3['age'] : '--'); return $result; } diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index d4c0d592d..c08254aa4 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -295,7 +295,6 @@ class AdminCartsControllerCore extends AdminController } } //end - ddd($cartHtlData); $this->tpl_view_vars = array( 'cart_htl_data' => $cartHtlData,//by webkul hotel rooms in order data 'kpi' => $kpi, @@ -1054,6 +1053,27 @@ class AdminCartsControllerCore extends AdminController $this->context->smarty->assign('selectedRoomDemands', $selectedRoomDemands); } } + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + $roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null); + if ($selectedRoomServiceProduct = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange( + $idCart, + $idProduct, + $dateFrom, + $dateTo, + $idRoom + )) { + $selectedRoomServiceProduct['selected_service'] = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts( + $selectedRoomServiceProduct['id'], + 0, + null, + null + ); + } + $this->context->smarty->assign(array( + 'roomTypeServiceProducts' => $roomTypeServiceProducts, + 'selectedRoomServiceProduct' => $selectedRoomServiceProduct + )); $htlCartBoookingata = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange( $idCart, $idProduct, @@ -1061,35 +1081,6 @@ class AdminCartsControllerCore extends AdminController $dateTo, $idRoom ); - - $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); - if ($selectedRoomServiceProduct = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart( - $idCart, - 0, - 0, - $idProduct, - $dateFrom, - $dateTo, - $htlCartBoookingata['id'], - 0, - null, - null - )) { - $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - $roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null); - foreach ($selectedRoomServiceProduct as $key => $selectedProducts) { - $objRoom = new HotelRoomInformation($selectedProducts['id_room']); - $selectedRoomServiceProduct[$key]['room_num'] = $objRoom->room_num; - foreach ($selectedProducts['selected_products_info'] as $product) { - $selectedRoomServiceProduct[$key]['selected_products'][] = $product['id_product']; - } - } - - $this->context->smarty->assign(array( - 'roomTypeServiceProducts' => $roomTypeServiceProducts, - 'selectedRoomServiceProduct' => $selectedRoomServiceProduct - )); - } } } $response['status'] = true; diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index f5a5bec2b..3e9fa4a73 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -985,31 +985,21 @@ class OrderOpcControllerCore extends ParentOrderController } } $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); - if ($selectedRoomServiceProduct = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart( - $this->context->cart->id, - 0, - 0, - $idProduct, - $dateFrom, - $dateTo, - 0, - 0, - null, - null - )) { - $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - $roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, true, 1); - foreach ($selectedRoomServiceProduct as $key => $selectedProducts) { - foreach ($selectedProducts['selected_products_info'] as $product) { - $selectedRoomServiceProduct[$key]['selected_products'][] = $product['id_product']; - } - } - $this->context->smarty->assign(array( - 'roomTypeServiceProducts' => $roomTypeServiceProducts, - 'selectedRoomServiceProduct' => $selectedRoomServiceProduct - )); + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, true, 1); + $cartRooms = $objCartBookingData->getHotelCartRoomsInfoByRoomType($this->context->cart->id, $idProduct,$dateFrom, $dateTo); + foreach($cartRooms as &$room) { + $room['selected_service'] = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts( + $room['id'], + 0, + null, + null + ); } - + $this->context->smarty->assign(array( + 'roomTypeServiceProducts' => $roomTypeServiceProducts, + 'cartRooms' => $cartRooms + )); } } $response['extra_demands'] = $this->context->smarty->fetch( diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index e5806d008..b49665deb 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -968,16 +968,13 @@ class HotelCartBookingData extends ObjectModel ); $cart_detail_data[$key]['additional_service'] = $objRoomTypeServiceProduct->getServiceProductsData($value['id_product']); - $cart_detail_data[$key]['selected_additional_service'] = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart( - $id_cart, + $cart_detail_data[$key]['selected_services'] = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts( + $value['id'], 0, - 0, - $value['id_product'], - $value['date_from'], - $value['date_to'], - $value['id'] + null, + null ); - $cart_detail_data[$key]['additional_service_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart( + $cart_detail_data[$key]['additional_service_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart( $id_cart, 0, 0, @@ -985,10 +982,9 @@ class HotelCartBookingData extends ObjectModel $value['date_from'], $value['date_to'], $value['id'], - true, false ); - $cart_detail_data[$key]['additional_services_auto_add_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart( + $cart_detail_data[$key]['additional_services_auto_add_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart( $id_cart, 0, 0, @@ -996,7 +992,6 @@ class HotelCartBookingData extends ObjectModel $value['date_from'], $value['date_to'], $value['id'], - true, false, 1 ); @@ -1304,15 +1299,14 @@ class HotelCartBookingData extends ObjectModel $data_v['date_to'], 1 ); - $serviceProductPrice = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart( + $serviceProductPrice = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart( $context->cart->id, 0, $data_v['id_hotel'], $data_v['id_product'], $data_v['date_from'], $data_v['date_to'], - $data_v['id'], - true + $data_v['id'] ); $totalAdditionalServicePrice = $demandPrice + $serviceProductPrice; diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php index eafa043bb..d3b3a4a8e 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php @@ -90,6 +90,189 @@ class RoomTypeServiceProductCartDetail extends ObjectModel return true; } + public function getServiceProductsTotalInCart( + $idCart, + $idProduct = 0, + $idHotel = 0, + $roomTypeIdProduct = 0, + $dateFrom = 0, + $dateTo = 0, + $htlCartBookingId = 0, + $useTax = null, + $autoAddToCart = 0, + $id_address = null, + $priceAdditionType = null + ) { + if ($useTax === null) + $useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true; + + $sql = 'SELECT rscd.`id_product`, rscd.`quantity`, cbd.`id_product` as `room_type_id_product` + FROM `'._DB_PREFIX_.'htl_cart_booking_data` cbd + LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail` rscd ON(rscd.`htl_cart_booking_id` = cbd.`id`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rscd.`id_product`) + WHERE 1'; + + if (!is_null($autoAddToCart)) { + $sql .= ' AND p.`auto_add_to_cart` = '. (int)$autoAddToCart; + if ($autoAddToCart == 1 && !is_null($priceAdditionType)) { + $sql .= ' AND p.`price_addition_type` = '.$priceAdditionType; + } + } + if ($idCart) { + $sql .= ' AND cbd.`id_cart`='.(int) $idCart; + } + if ($idProduct) { + $sql .= ' AND rscd.`id_product`='.(int) $idProduct; + } + if ($idHotel) { + $sql .= ' AND cbd.`id_hotel`='.(int) $idHotel; + } + if ($roomTypeIdProduct) { + $sql .= ' AND cbd.`id_product`='.(int) $roomTypeIdProduct; + } + if ($dateFrom && $dateTo) { + $sql .= ' AND cbd.`date_from` = \''.pSQL($dateFrom).'\' AND cbd.`date_to` = \''.pSQL($dateTo).'\''; + } + if ($htlCartBookingId) { + $sql .= ' AND cbd.`id`='.(int) $htlCartBookingId; + } + $sql .= ' ORDER BY cbd.`id`'; + $totalPrice = 0; + + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + if ($serviceProducts = Db::getInstance()->executeS($sql)) { + foreach ($serviceProducts as $product) { + $qty = $product['quantity'] ? (int)$product['quantity'] : 1; + $totalPrice += $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + $qty, + $useTax, + false, + $id_address + ); + } + } + return $totalPrice; + } + + public function getRoomServiceProducts( + $htlCartBookingId, + $idLang = 0, + $useTax = null, + $autoAddToCart = 0, + $id_address = null, + $priceAdditionType = null + ) { + if ($useTax === null) + $useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true; + + if (!$idLang) { + $idLang = Context::getContext()->language->id; + } + + $sql = 'SELECT rscd.`id_product`, rscd.`quantity`, cbd.`id_cart`, p.`auto_add_to_cart`, p.`allow_multiple_quantity`, cbd.`id` as `htl_cart_booking_id`, + p.`price_addition_type`, cbd.`id_product` as `room_type_id_product`, pl.`name` + FROM `'._DB_PREFIX_.'htl_cart_booking_data` cbd + LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail` rscd ON(rscd.`htl_cart_booking_id` = cbd.`id`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rscd.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$idLang.') + WHERE 1'; + + if (!is_null($autoAddToCart)) { + $sql .= ' AND p.`auto_add_to_cart` = '. (int)$autoAddToCart; + if ($autoAddToCart == 1 && !is_null($priceAdditionType)) { + $sql .= ' AND p.`price_addition_type` = '.$priceAdditionType; + } + } + if ($htlCartBookingId) { + $sql .= ' AND cbd.`id`='.(int) $htlCartBookingId; + } + $sql .= ' ORDER BY cbd.`id`'; + + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $selectedServiceProducts = array(); + + if ($serviceProducts = Db::getInstance()->executeS($sql)) { + foreach ($serviceProducts as $product) { + $qty = $product['quantity'] ? (int)$product['quantity'] : 1; + if (isset($selectedServiceProducts[$product['id_product']])) { + $selectedServiceProducts[$product['id_product']]['quantity'] += $product['quantity']; + $selectedServiceProducts[$product['id_product']]['total_price'] += $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + $qty, + $useTax, + false, + $id_address + ); + $selectedServiceProducts[$product['id_product']]['total_price_tax_excl'] += $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + $qty, + false, + false, + $id_address + ); + $selectedServiceProducts[$product['id_product']]['total_price_tax_incl'] += $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + $qty, + true, + false, + $id_address + ); + } else { + $selectedServiceProducts[$product['id_product']] = $product; + + $selectedServiceProducts[$product['id_product']]['unit_price_tax_excl'] = $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + 1, + false, + false, + $id_address + ); + $selectedServiceProducts[$product['id_product']]['unit_price_tax_incl'] = $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + 1, + true, + false, + $id_address + ); + $selectedServiceProducts[$product['id_product']]['total_price'] = $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + $qty, + $useTax, + false, + $id_address + ); + $selectedServiceProducts[$product['id_product']]['total_price_tax_excl'] = $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + $qty, + false, + false, + $id_address + ); + $selectedServiceProducts[$product['id_product']]['total_price_tax_incl'] = $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + $qty, + true, + false, + $id_address + ); + } + } + + } + + return $selectedServiceProducts; + } + public function getServiceProductsInCart( $idCart, $idProduct = 0, @@ -168,18 +351,31 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($product['room_type_id_product']); $qty = $product['quantity'] ? (int)$product['quantity'] : 1; if (isset($selectedServiceProducts[$product['htl_cart_booking_id']])) { - if ($product['id_product']) { - if ($idProduct) { - $selectedServiceProducts[$product['htl_cart_booking_id']]['quantity'] += $product['quantity']; - - } else { - $selectedServiceProducts[$product['htl_cart_booking_id']]['selected_products_info'][$product['id_product']] = array( - 'id_product' => $product['id_product'], - 'auto_add_to_cart' => $product['auto_add_to_cart'], - 'price_addition_type' => $product['price_addition_type'], - 'quantity' => $product['quantity'], - ); - } + if ($idProduct) { + $selectedServiceProducts[$product['htl_cart_booking_id']]['quantity'] += $product['quantity']; + } else { + $selectedServiceProducts[$product['htl_cart_booking_id']]['selected_products_info'][$product['id_product']] = array( + 'id_product' => $product['id_product'], + 'quantity' => $product['quantity'], + 'auto_add_to_cart' => $product['auto_add_to_cart'], + 'price_addition_type' => $product['price_addition_type'], + 'unit_price_tax_excl' => $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + 1, + false, + false, + $id_address + ), + 'unit_price_tax_incl' => $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + 1, + true, + false, + $id_address + ), + ); } $selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] += $objRoomTypeServiceProductPrice->getProductPrice( (int)$product['id_product'], @@ -240,30 +436,28 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $id_address ); } else { - $selectedServiceProducts[$product['htl_cart_booking_id']]['selected_products_info'] = ($product['id_product']) ? array( - $product['id_product'] => array( - 'id_product' => $product['id_product'], - 'quantity' => $product['quantity'], - 'auto_add_to_cart' => $product['auto_add_to_cart'], - 'price_addition_type' => $product['price_addition_type'], - 'unit_price_tax_excl' => $objRoomTypeServiceProductPrice->getProductPrice( - (int)$product['id_product'], - (int)$product['room_type_id_product'], - 1, - false, - false, - $id_address - ), - 'unit_price_tax_incl' => $objRoomTypeServiceProductPrice->getProductPrice( - (int)$product['id_product'], - (int)$product['room_type_id_product'], - 1, - true, - false, - $id_address - ), - ) - ): array(); + $selectedServiceProducts[$product['htl_cart_booking_id']]['selected_products_info'][$product['id_product']] = array( + 'id_product' => $product['id_product'], + 'quantity' => $product['quantity'], + 'auto_add_to_cart' => $product['auto_add_to_cart'], + 'price_addition_type' => $product['price_addition_type'], + 'unit_price_tax_excl' => $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + 1, + false, + false, + $id_address + ), + 'unit_price_tax_incl' => $objRoomTypeServiceProductPrice->getProductPrice( + (int)$product['id_product'], + (int)$product['room_type_id_product'], + 1, + true, + false, + $id_address + ), + ); } $selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] = $objRoomTypeServiceProductPrice->getProductPrice( diff --git a/themes/hotel-reservation-theme/_partials/cart_booking_demands.tpl b/themes/hotel-reservation-theme/_partials/cart_booking_demands.tpl index 788ef2cb0..2fd403f43 100644 --- a/themes/hotel-reservation-theme/_partials/cart_booking_demands.tpl +++ b/themes/hotel-reservation-theme/_partials/cart_booking_demands.tpl @@ -92,7 +92,7 @@

{l s='Add below services to the rooms for better hotel experience'}

{assign var=roomCount value=1} - {foreach $selectedRoomServiceProduct as $key => $cartRoom} + {foreach $cartRooms as $key => $cartRoom}
@@ -110,7 +110,7 @@
{if $product.available_for_order}

- +

{/if}
@@ -118,7 +118,7 @@

{$product['name']|escape:'html':'UTF-8'}

{if $product.allow_multiple_quantity}
- +