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 c5831912d..e802993eb 100644
--- a/admin/themes/default/template/controllers/carts/helpers/view/view.tpl
+++ b/admin/themes/default/template/controllers/carts/helpers/view/view.tpl
@@ -115,7 +115,7 @@
{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}
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 51dab43c8..05e5861e0 100644
--- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl
+++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl
@@ -83,7 +83,14 @@
- {if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $demand['price']|escape:'html':'UTF-8'}{/if}
+
+
+ {if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $demand['price']|escape:'html':'UTF-8'}{/if}
+
+ {if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
+ {l s='/ day'}
+ {/if}
+
{/foreach}
@@ -121,7 +128,7 @@
|
- {if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $demand['price']|escape:'html':'UTF-8'}{/if}
+
+ {if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $demand['price']|escape:'html':'UTF-8'}{/if}
+
+ {if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
+ {l s='/ day'}
+ {/if}
|
{/foreach}
@@ -115,14 +127,21 @@
| {l s='Name'} |
- {l s='Price'} |
+ {l s='Unit price'} |
+ {l s='Total price'} |
{foreach $roomDemand['extra_demands'] as $demand}
| {$demand['name']} |
- {displayPrice price=$demand['total_price_tax_excl'] currency=$orderCurrency} |
+
+ {displayPrice price=$demand['unit_price_tax_excl'] currency=$orderCurrency}
+ {if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
+ {l s='/ day'}
+ {/if}
+ |
+ {displayPrice price=$demand['total_price_tax_excl'] currency=$orderCurrency} |
{/foreach}
diff --git a/admin/themes/default/template/controllers/orders/_room_services_block.tpl b/admin/themes/default/template/controllers/orders/_room_services_block.tpl
index 8087843c4..eec75f15b 100644
--- a/admin/themes/default/template/controllers/orders/_room_services_block.tpl
+++ b/admin/themes/default/template/controllers/orders/_room_services_block.tpl
@@ -31,9 +31,9 @@
| {l s='Name'} |
- {l s='Quantity'} |
+ |
+ {l s='Quantity'} |
{l s='Price'} |
- {l s='Options'} |
{l s='Action'} |
@@ -44,22 +44,24 @@
{$service['name']|escape:'html':'UTF-8'}
|
+
+ {if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
+ {l s='Auto added'}
+ {/if}
+ {if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT}
+ {l s='Convenience fee'}
+ {/if}
+ |
{if $service['allow_multiple_quantity']}
+ {else}
+ --
{/if}
|
{displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency} |
-
- {if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT}
- {l s='Convenience fee'}
- {/if}
- {if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
- {l s='Auto added'}
- {/if}
- |
|
{/foreach}
@@ -81,7 +83,8 @@
|
{l s='Name'} |
- {l s='Quantity'} |
+ |
+ {l s='Quantity'} |
{l s='Price'} |
@@ -94,6 +97,14 @@
{$product['name']|escape:'html':'UTF-8'}
|
+
+ {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
+ {l s='Auto added'}
+ {/if}
+ {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT}
+ {l s='Convenience fee'}
+ {/if}
+ |
{if $product.allow_multiple_quantity}
@@ -124,8 +135,8 @@
|
| {l s='ID'} |
{l s='Name'} |
- {l s='Options'} |
- {l s='Price'} |
+ |
+ {l s='Total Price'} |
@@ -143,7 +154,7 @@
{l s='Auto added'}
{/if}
-
+ |
{displayPrice price=$service['total_price_tax_excl'] currency=$orderCurrency}
|
diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl
index 3501cdb00..6bac2c7e5 100644
--- a/admin/themes/default/template/controllers/orders/form.tpl
+++ b/admin/themes/default/template/controllers/orders/form.tpl
@@ -1525,37 +1525,39 @@
extra_demand_price = formatCurrency(extra_demand_price, currency_format, currency_sign, currency_blank);
$(this).closest('.room_demand_block').find('.extra_demand_option_price').text(extra_demand_price);
var roomDemands = [];
- // get the selected extra demands by customer
- $(this).closest('.room_demand_detail').find('input:checkbox.id_room_type_demand:checked').each(function () {
- roomDemands.push({
- 'id_global_demand':$(this).val(),
- 'id_option': $(this).closest('.room_demand_block').find('.id_option').val()
+ if ($(this).closest('.room_demand_block').find('input:checkbox.id_room_type_demand').is(':checked')) {
+ // get the selected extra demands by customer
+ $(this).closest('.room_demand_detail').find('input:checkbox.id_room_type_demand:checked').each(function () {
+ roomDemands.push({
+ 'id_global_demand':$(this).val(),
+ 'id_option': $(this).closest('.room_demand_block').find('.id_option').val()
+ });
});
- });
- var idBookingCart = $(this).closest('.room_demand_block').find('.id_room_type_demand').attr('id_cart_booking');
- $.ajax({
- type: 'POST',
- dataType: 'JSON',
- headers: {
- "cache-control": "no-cache"
- },
- url: "{$link->getAdminLink('AdminCarts')|addslashes}",
- dataType: 'JSON',
- cache: false,
- data: {
- id_cart_booking: idBookingCart,
- room_demands: JSON.stringify(roomDemands),
- action: 'changeRoomDemands',
- ajax: true
- },
- success: function(response) {
- if (response.status) {
- showSuccessMessage(txtExtraDemandSucc);
- } else {
- showErrorMessage(txtExtraDemandErr);
+ var idBookingCart = $(this).closest('.room_demand_block').find('.id_room_type_demand').attr('id_cart_booking');
+ $.ajax({
+ type: 'POST',
+ dataType: 'JSON',
+ headers: {
+ "cache-control": "no-cache"
+ },
+ url: "{$link->getAdminLink('AdminCarts')|addslashes}",
+ dataType: 'JSON',
+ cache: false,
+ data: {
+ id_cart_booking: idBookingCart,
+ room_demands: JSON.stringify(roomDemands),
+ action: 'changeRoomDemands',
+ ajax: true
+ },
+ success: function(response) {
+ if (response.status) {
+ showSuccessMessage(txtExtraDemandSucc);
+ } else {
+ showErrorMessage(txtExtraDemandErr);
+ }
}
- }
- });
+ });
+ }
});
$(document).on('click', '.change_room_type_service_product', function() {
diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl
index c324689d9..cb757e317 100644
--- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl
+++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl
@@ -1754,7 +1754,7 @@
if (qty_wntd == '' || !$.isNumeric(qty_wntd) || qty_wntd < 1) {
$(this).val(1);
}
- updateServiceProducts($(this));
+ updateAdditionalServices($(this));
});
$(document).on('focusout', '#rooms_type_extra_demands #add_room_services_form .qty', function(e) {
@@ -1764,7 +1764,7 @@
}
});
- function updateServiceProducts(element)
+ function updateAdditionalServices(element)
{
var id_room_type_service_product_order_detail = $(element).data('id_room_type_service_product_order_detail');
var qty = $(element).val();
@@ -1785,6 +1785,9 @@
},
success: function(jsonData) {
if (!jsonData.hasError) {
+ if (jsonData.service_panel) {
+ $('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
+ }
showSuccessMessage(txtExtraDemandSucc);
} else {
showErrorMessage(jsonData.errors);
@@ -1931,12 +1934,14 @@
},
success: function(jsonData) {
if (!jsonData.hasError) {
- $('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
- showSuccessMessage(txtExtraDemandSucc);
- } else {
- showErrorMessage(jsonData.errors);
+ if (jsonData.service_panel) {
+ $('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
+ }
+ showSuccessMessage(txtExtraDemandSucc);
+ } else {
+ showErrorMessage(jsonData.errors);
- }
+ }
}
});
} else {
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index 2a410f0ea..de4b0ae32 100644
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -4692,7 +4692,7 @@ class AdminOrdersControllerCore extends AdminController
// get room type additional demands
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
- if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct)) {
+ if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null)) {
foreach ($roomTypeServiceProducts as $key => $product) {
if (in_array($product['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) {
unset($roomTypeServiceProducts[$key]);
@@ -4702,7 +4702,6 @@ class AdminOrdersControllerCore extends AdminController
}
}
$this->context->smarty->assign($smartyVars);
-
}
$extraDemandsTpl = $this->context->smarty->fetch(
@@ -4740,7 +4739,7 @@ class AdminOrdersControllerCore extends AdminController
// get room type additional demands
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
- if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct)) {
+ if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null)) {
foreach ($roomTypeServiceProducts as $key => $product) {
if (in_array($product['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) {
unset($roomTypeServiceProducts[$key]);
@@ -4756,7 +4755,6 @@ class AdminOrdersControllerCore extends AdminController
_PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_room_services_block.tpl'
);
return $servicesTpl;
-
}
public function processRenderFacilitiesBlock($idOrder, $idProduct, $dateFrom, $dateTo, $idRoom, $orderEdit)
@@ -4859,6 +4857,15 @@ class AdminOrdersControllerCore extends AdminController
$response['hasError'] = true;
$response['errors'] = $this->l('cannot order multiple quanitity for this service');
}
+ $objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail);
+ $response['service_panel']= $servicesBlock = $this->processRenderServicesPanel(
+ $objOrderDetail->id_order,
+ $objHotelBookingDetail->id_product,
+ $objHotelBookingDetail->date_from,
+ $objHotelBookingDetail->date_to,
+ $objHotelBookingDetail->id_room,
+ true
+ );
} else {
$response['hasError'] = true;
$response['errors'] = $this->l('Additional service not found');
diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js
index 23d5f7e26..030d17942 100644
--- a/themes/hotel-reservation-theme/js/order-opc.js
+++ b/themes/hotel-reservation-theme/js/order-opc.js
@@ -422,7 +422,6 @@ $(document).ready(function()
});
$(document).on('change', '.demand_adv_option_block .id_option', function(e) {
- debugger
var option_selected = $(this).find('option:selected');
var extra_demand_price = option_selected.attr("optionPrice")
extra_demand_price = parseFloat(extra_demand_price);