Merge pull request #1669 from shazar-webkul/gli-2785
Updated: Quantity-based pricing for room services
This commit is contained in:
@@ -134,7 +134,12 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="col-xs-10">
|
||||
<p>{$product['name']|escape:'html':'UTF-8'}</p>
|
||||
<div>{$product['name']|escape:'html':'UTF-8'}</div>
|
||||
{if $product.price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY}
|
||||
<div class="price-per-night">
|
||||
{if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)}{if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if}{/if}{l s='/night'}
|
||||
</div>
|
||||
{/if}
|
||||
{if $product.allow_multiple_quantity}
|
||||
<div class="qty_container">
|
||||
<input type="text" class="form-control qty" id="qty_{$product.id_product}" name="room_service_product_qty_{$product.id_product}" data-id-product="{$product.id_product}" data-max_quantity="{$product.max_quantity}" value="{if $serviceSelected}{$cartRoom['selected_service'][$product['id_product']]['quantity']}{else}1{/if}">
|
||||
@@ -150,7 +155,21 @@
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
{if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)}
|
||||
<span class="pull-right">{if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if}{if $product.price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY}{l s='/Night'}{/if}</span>
|
||||
<span class="room-service-product-value pull-right" data-unit_price="{if !$priceDisplay}{$product.price_tax_incl}{else}{$product.price_tax_exc}{/if}" data-currency_sign="{$currency->sign}">
|
||||
{if !$priceDisplay}
|
||||
{if $serviceSelected}
|
||||
{convertPrice price=$cartRoom['selected_service'][$product['id_product']]['total_price_tax_incl']}
|
||||
{else}
|
||||
{convertPrice price=$product.price_tax_incl}
|
||||
{/if}
|
||||
{else}
|
||||
{if $serviceSelected}
|
||||
{convertPrice price=$cartRoom['selected_service'][$product['id_product']]['total_price_tax_excl']}
|
||||
{else}
|
||||
{convertPrice price=$product.price_tax_exc}
|
||||
{/if}
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -9052,6 +9052,11 @@ a.open_rooms_extra_services_panel {
|
||||
border-radius: 0 0 4px 0;
|
||||
box-shadow: 0 1px 0 0 rgb(0 0 0 / 13%);
|
||||
}
|
||||
#rooms_extra_services .price-per-night {
|
||||
font-size: 12px;
|
||||
color: #777;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
|
||||
/* fancybox changes */
|
||||
|
||||
@@ -638,6 +638,9 @@ $(document).ready(function()
|
||||
$(document).on('click', '#rooms_extra_services .qty_up', function(e) {
|
||||
e.preventDefault();
|
||||
qtyfield = $(this).closest('.qty_container').find('input.qty');
|
||||
roomServiceProductValue = $(this).closest('.room_demand_block').find('.room-service-product-value');
|
||||
roomServiceProductUnitPrice = roomServiceProductValue.data('unit_price');
|
||||
roomServiceProductCurrencySign = roomServiceProductValue.data('currency_sign');
|
||||
var newQuantity = parseInt(qtyfield.val()) + 1;
|
||||
if (qtyfield.data('max_quantity') && qtyfield.data('max_quantity') < newQuantity) {
|
||||
newQuantity = qtyfield.data('max_quantity');
|
||||
@@ -647,6 +650,8 @@ $(document).ready(function()
|
||||
showErrorMessage(txtMaxQuantityAdded);
|
||||
}
|
||||
} else {
|
||||
roomServiceProductTotalPriceQtyUp = newQuantity*roomServiceProductUnitPrice;
|
||||
roomServiceProductValue.text(roomServiceProductCurrencySign + roomServiceProductTotalPriceQtyUp.toFixed(priceDisplayPrecision))
|
||||
qtyfield.val(newQuantity).trigger('focusout');
|
||||
}
|
||||
});
|
||||
@@ -654,9 +659,15 @@ $(document).ready(function()
|
||||
$(document).on('click', '#rooms_extra_services .qty_down', function(e) {
|
||||
e.preventDefault();
|
||||
qtyfield = $(this).closest('.qty_container').find('input.qty');
|
||||
roomServiceProductValue = $(this).closest('.room_demand_block').find('.room-service-product-value');
|
||||
roomServiceProductUnitPrice = roomServiceProductValue.data('unit_price');
|
||||
roomServiceProductCurrencySign = roomServiceProductValue.data('currency_sign');
|
||||
var currentVal = parseInt(qtyfield.val());
|
||||
if (!isNaN(currentVal) && currentVal > 1) {
|
||||
qtyfield.val(currentVal - 1).trigger('focusout');
|
||||
roomServiceProductTotalPriceQtyDown = qtyfield.val()*roomServiceProductUnitPrice;
|
||||
roomServiceProductValue.text(roomServiceProductCurrencySign + roomServiceProductTotalPriceQtyDown.toFixed(priceDisplayPrecision))
|
||||
|
||||
} else {
|
||||
qtyfield.val(1);
|
||||
if (currentVal != 1) {
|
||||
@@ -667,12 +678,20 @@ $(document).ready(function()
|
||||
|
||||
$(document).on('focusout', '#rooms_extra_services .qty', function(e) {
|
||||
var qty_wntd = $(this).val();
|
||||
if (qty_wntd == '' || !$.isNumeric(qty_wntd)) {
|
||||
roomServiceProductValue = $(this).closest('.room_demand_block').find('.room-service-product-value');
|
||||
roomServiceProductUnitPrice = roomServiceProductValue.data('unit_price');
|
||||
roomServiceProductCurrencySign = roomServiceProductValue.data('currency_sign');
|
||||
|
||||
if (qty_wntd == '' || !$.isNumeric(qty_wntd) || qty_wntd < 1) {
|
||||
$(this).val(1);
|
||||
}
|
||||
if ($(this).data('max_quantity') && $(this).data('max_quantity') < qty_wntd) {
|
||||
$(this).val(qtyfield.data('max_quantity'));
|
||||
}
|
||||
|
||||
roomServiceProductTotalPriceQty = $(this).val()*roomServiceProductUnitPrice;
|
||||
roomServiceProductValue.text(roomServiceProductCurrencySign + roomServiceProductTotalPriceQty.toFixed(priceDisplayPrecision))
|
||||
|
||||
if ($(this).closest('.room_demand_block').find('.change_room_type_service_product').is(':checked')) {
|
||||
updateServiceProducts($(this).closest('.room_demand_block').find('.change_room_type_service_product'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user