Added: Standard product flow in QloApps

Added: Standard product flow in QloApps
This commit is contained in:
Rohit Jain
2025-05-22 19:49:19 +05:30
committed by GitHub
173 changed files with 13204 additions and 8252 deletions

View File

@@ -79,8 +79,10 @@
var product_type_virtual = {Product::PTYPE_VIRTUAL|intval};
var product_type_simple = {Product::PTYPE_SIMPLE|intval};
var with_room_type = {Product::SERVICE_PRODUCT_WITH_ROOMTYPE|intval};
var without_room_type = {Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE|intval};
var SELLING_PREFERENCE_WITH_ROOM_TYPE = {Product::SELLING_PREFERENCE_WITH_ROOM_TYPE|intval};
var SELLING_PREFERENCE_HOTEL_STANDALONE = {Product::SELLING_PREFERENCE_HOTEL_STANDALONE|intval};
var SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE = {Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE|intval};
var SELLING_PREFERENCE_STANDALONE = {Product::SELLING_PREFERENCE_STANDALONE|intval};
var price_addition_type_with_room = {Product::PRICE_ADDITION_TYPE_WITH_ROOM|intval};
var price_addition_type_independent = {Product::PRICE_ADDITION_TYPE_INDEPENDENT|intval};

View File

@@ -232,11 +232,27 @@
var product_name_redirected = '{$product_name_redirected|escape:'html':'UTF-8'}';
</script>
</div>
<div class="form-group" id="associated_hotel_rooms_tree" {if $product->service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE}style="display:none;"{/if}>
{* Code For Standard product working *}
{* <div class="form-group" id="global_product_type_container">
<label class="control-label col-lg-3" for="selling_preference_type">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Select whether this product will be sold with room type or as an standalone product'}">
{l s='Product selling preference'}
<span>
</label>
<div class="col-lg-4">
<select name="selling_preference_type" id="selling_preference_type">
<option value="{Product::SELLING_PREFERENCE_WITH_ROOM_TYPE}" {if $product->selling_preference_type == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE}selected="selected"{/if} >{l s='Sell with room types'}</option>
<option value="{Product::SELLING_PREFERENCE_HOTEL_STANDALONE}" {if $product->selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE}selected="selected"{/if} >{l s='Sell with hotels'}</option>
<option value="{Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE}" {if $product->selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE}selected="selected"{/if} >{l s='Sell with hotels and room types'}</option>
<option value="{Product::SELLING_PREFERENCE_STANDALONE}" {if $product->selling_preference_type == Product::SELLING_PREFERENCE_STANDALONE}selected="selected"{/if} >{l s='Sell as standalone product'}</option>
</select>
</div>
</div> *}
<div class="form-group" id="associated_hotel_tree" {if ($product->selling_preference_type != Product::SELLING_PREFERENCE_HOTEL_STANDALONE && $product->selling_preference_type != Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE)}style="display:none;"{/if}>
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="category_box" type="category_box"}</span></div>
<label class="control-label col-lg-2" for="hotel_block">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Select room type and hotels for which this service will be available.'}">
{l s='Associated Hotels and Room Types'}
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Select hotels for which this service will be available.'}">
{l s='Associated Hotels'}
</span>
</label>
<div class="col-lg-9">
@@ -245,7 +261,20 @@
</div>
</div>
</div>
<div class="form-group" id="auto_add_to_cart_container">
<div class="form-group" id="associated_hotel_rooms_tree" {if ($product->selling_preference_type != Product::SELLING_PREFERENCE_WITH_ROOM_TYPE && $product->selling_preference_type != Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE && $product->selling_preference_type != 0)}style="display:none;"{/if}>
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="category_box" type="category_box"}</span></div>
<label class="control-label col-lg-2" for="hotel_room_block">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Select room type and hotels for which this service will be available.'}">
{l s='Associated Room Types'}
</span>
</label>
<div class="col-lg-9">
<div id="hotel_room_block">
{$hotel_room_tree}
</div>
</div>
</div>
<div class="form-group" id="auto_add_to_cart_container" {if $product->selling_preference_type != Product::SELLING_PREFERENCE_WITH_ROOM_TYPE && $product->selling_preference_type != 0}style="display:none;"{/if}>
<label class="control-label col-lg-3" for="">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='When enabled, this service will be added in cart for each associated Room type or Hotel when they are added in cart. Also auto added services will not be visible to customers.'}">
{l s='Auto add to cart this product'}
@@ -268,7 +297,7 @@
<div id="price_addition_type_container" {if !$product->auto_add_to_cart || !$product->isAssociatedToShop()}style="display:none;"{/if}>
<div class="form-group">
<label class="control-label col-lg-3" for="service_product_type">
<label class="control-label col-lg-3" for="selling_preference_type">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Select whether price will be added in the base room price or as Convenience Fee'}">
{l s='Price display preference'}
<span>
@@ -294,27 +323,6 @@
</div>
</div>
</div>
{* <div class="form-group" id="global_product_type_container">
<label class="control-label col-lg-3" for="service_product_type">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Select whether this product will be sold with room type or as an independent product'}">
{l s='Product selling preference'}
<span>
</label>
<div class="col-lg-4">
<select name="service_product_type" id="service_product_type">
<option value="{Product::SERVICE_PRODUCT_WITH_ROOMTYPE}" {if $product->service_product_type == Product::SERVICE_PRODUCT_WITH_ROOMTYPE}selected="selected"{/if} >{l s='sell with room type'}</option>
<option value="{Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE}" {if $product->service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE}selected="selected"{/if} >{l s='Sell as independent product'}</option>
</select>
</div>
</div> *}
{* <div class="form-group" id="independent_product_info" {if $product->service_product_type != Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE}style="display:none"{/if}>
<div class="col-lg-6 col-lg-offset-3">
<div class="alert alert-info">
{l s='Independent products can only be bought from backoffice.'}
</div>
</div>
</div> *}
<div class="form-group" id="show_at_front_container" {if $product->auto_add_to_cart}style="display:none;"{/if}>
<label class="control-label col-lg-3" for="">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Enable if you want this product to be visible at front office of your website.'}">

View File

@@ -0,0 +1,121 @@
{*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License version 3.0
* that is bundled with this package in the file LICENSE.md
* It is also available through the world-wide-web at this URL:
* https://opensource.org/license/osl-3-0-php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to support@qloapps.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to a newer
* versions in the future. If you wish to customize this module for your needs
* please refer to https://store.webkul.com/customisation-guidelines for more information.
*
* @author Webkul IN
* @copyright Since 2010 Webkul
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*}
<div id="product-options" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Options" />
<h3 class="tab"> <i class="icon-info"></i> {l s='Options'}</h3>
<div class="table-responsive">
<table id="product_options_table" class="table table-striped">
<thead>
<th>{l s='Name'}</th>
<th>{l s='Price Impact'}</th>
<th>{l s='Action'}</th>
</thead>
<tbody>
{if $serviceProductOptions}
{foreach $serviceProductOptions as $productOption}
<tr>
<td>
<input class="form-control" type="text" name="product_option_name[]" value="{$productOption['name']}">
</td>
<td>
<div class="input-group">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input type="text" name="product_option_price[]" value="{$productOption['price_impact']}"/>
<input type="hidden" name="product_option_id[]" value="{$productOption['id_product_option']}"/>
</div>
</td>
<td>
<a href="#" class="btn btn-default delete_product_option" data-id_product_option="{$productOption['id_product_option']}"><i class="icon-trash"></i></a>
</td>
</tr>
{/foreach}
{/if}
<tr>
<td>
<input class="form-control" type="text" name="product_option_name[]">
</td>
<td>
<div class="input-group">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input type="text" name="product_option_price[]" value=""/>
<input type="hidden" name="product_option_id[]" value="0"/>
</div>
</td>
<td>
</td>
</tr>
<tr>
<td>
<input class="form-control" type="text" name="product_option_name[]">
</td>
<td>
<div class="input-group">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input type="text" name="product_option_price[]" value=""/>
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
<div class="panel-footer">
<a href="{$link->getAdminLink('AdminNormalProducts')|escape:'html':'UTF-8'}{if isset($smarty.request.page) && $smarty.request.page > 1}&amp;submitFilterproduct={$smarty.request.page|intval}{/if}" class="btn btn-default"><i class="process-icon-cancel"></i> {l s='Cancel'}</a>
<button type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i> {l s='Save'}</button>
<button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i> {l s='Save and stay'}</button>
</div>
</div>
<script>
var service_product_link = "{$link->getAdminLink('AdminNormalProducts')}";
var option_delete_success_txt = '{l s='Product option is deleted successfully' js=1}';
$(document).ready(function() {
$(document).on('click', '.delete_product_option', function(e){
e.preventDefault();
var $current = $(this);
var id_product_option = $(this).attr('data-id_product_option');
$.ajax({
url: service_product_link,
type: 'POST',
dataType: 'JSON',
data: {
ajax:true,
action:'deleteServiceProductOption',
id_product_option: id_product_option,
},
success: function (response) {
if (response.hasError) {
showErrorMessage(response.error);
} else {
$current.closest('tr').remove();
showSuccessMessage(option_delete_success_txt);
}
}
});
});
});
</script>

View File

@@ -0,0 +1,301 @@
{*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if isset($product->id)}
<div id="product-quantities" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Quantities" />
<h3>{l s='Available quantities for sale'}</h3>
{if !$ps_stock_management}
<div class="alert alert-info">{l s='The stock management is disabled'}</div>
{else}
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Quantities"}
{* <div class="alert alert-info">
{l s='This interface allows you to manage available quantities for sale for products. It also allows you to manage product combinations in the current shop.'}<br/>
{l s='You can choose whether or not to use the advanced stock management system for this product.'}<br/>
{l s='You can manually specify the quantities for the product/each product combination, or you can choose to automatically determine these quantities based on your stock (if advanced stock management is activated).'}<br/>
{l s='In this case, quantities correspond to the real-stock quantities in the warehouses connected with the current shop, or current group of shops.'}<br/>
{l s='For packs: If it has products that use advanced stock management, you have to specify a common warehouse for these products in the pack.'}<br/>
{l s='Also, please note that when a product has combinations, its default combination will be used in stock movements.'}
</div> *}
{if $show_quantities == true}
<div class="form-group" {if $product->is_virtual}style="display:none;"{/if} class="row stockForVirtualProduct">
<div class="col-lg-9 col-lg-offset-3">
<p class="checkbox">
<label for="advanced_stock_management">
<input type="checkbox" id="advanced_stock_management" name="advanced_stock_management" class="advanced_stock_management"
{if $product->advanced_stock_management == 1 && $stock_management_active == 1}
value="1" checked="checked"
{else}
value="0"
{/if}
{if $stock_management_active == 0}
disabled="disabled"
{/if}
/>
{l s='I want to use the advanced stock management system for this product.'}
</label>
</p>
{if $stock_management_active == 0 && !$product->cache_is_pack}
<p class="help-block"><i class="icon-warning-sign"></i>&nbsp;{l s='This requires you to enable advanced stock management.'}</p>
{elseif $product->cache_is_pack}
<p class="help-block">{l s='When enabling advanced stock management for a pack, please make sure it is also enabled for its product(s) – if you choose to decrement product quantities.'}</p>
{/if}
</div>
</div>
<div {if $product->is_virtual}style="display:none;"{/if} class="form-group stockForVirtualProduct">
<label class="control-label col-lg-3" for="depends_on_stock_1">{l s='Available quantities'}</label>
<div class="col-lg-9">
<p class="radio">
<label for="depends_on_stock_1">
<input type="radio" id="depends_on_stock_1" name="depends_on_stock" class="depends_on_stock" value="1"
{if $product->depends_on_stock == 1 && $stock_management_active == 1}
checked="checked"
{/if}
{if $stock_management_active == 0 || $product->advanced_stock_management == 0}
disabled="disabled"
{/if}
/>
{l s='The available quantities for the current product and its combinations are based on the stock in your warehouse (using the advanced stock management system). '}
{if ($stock_management_active == 0 || $product->advanced_stock_management == 0) && !$product->cache_is_pack} &nbsp;-&nbsp;{l s='This requires you to enable advanced stock management globally or for this product.'}
{/if}
</label>
</p>
{if $product->cache_is_pack}
<p class="help-block">
{l s='You cannot use advanced stock management for this pack if'}<br />
{l s='- advanced stock management is not enabled for these products'}<br />
{l s='- you have chosen to decrement products quantities.'}
</p>
{/if}
<p class="radio">
<label for="depends_on_stock_0" for="depends_on_stock_0">
<input type="radio" id="depends_on_stock_0" name="depends_on_stock" class="depends_on_stock" value="0"
{if $product->depends_on_stock == 0 || $stock_management_active == 0}
checked="checked"
{/if}
/>
{l s='I want to specify available quantities manually.'}
</label>
</p>
</div>
</div>
<div class="form-group" {if !$product->cache_is_pack}style="display:none"{/if}>
<label class="control-label col-lg-3">{l s='Pack quantities'}</label>
<div class="col-lg-9">
<p class="radio">
<label id="label_pack_stock_1" for="pack_stock_type_1">
<input type="radio" class="pack_stock_type" value="0" name="pack_stock_type" id="pack_stock_type_1" {if isset($product->pack_stock_type) && $product->pack_stock_type == 0} checked="checked" {/if}/>
{l s='Decrement pack only.'}
</label>
</p>
<p class="radio">
<label id="label_pack_stock_2" for="pack_stock_type_2">
<input type="radio" class="pack_stock_type" value="1" name="pack_stock_type" id="pack_stock_type_2" {if isset($product->pack_stock_type) && $product->pack_stock_type == 1} checked="checked" {/if}/>
{l s='Decrement products in pack only.'}
</label>
</p>
<p class="radio">
<label id="label_pack_stock_3" for="pack_stock_type_3">
<input type="radio" class="pack_stock_type" value="2" name="pack_stock_type" id="pack_stock_type_3" {if isset($product->pack_stock_type) && $product->pack_stock_type == 2} checked="checked" {/if}/>
{l s='Decrement both.'}
</label>
</p>
<p class="radio">
<label id="label_pack_stock_4" for="pack_stock_type_4">
<input type="radio" class="pack_stock_type" value="3" name="pack_stock_type" id="pack_stock_type_4" {if !isset($product->pack_stock_type) || $product->pack_stock_type == 3} checked="checked" {/if}/>
{l s='Default'}:
{if $pack_stock_type == 0}
{l s='Decrement pack only.'}
{elseif $pack_stock_type == 1}
{l s='Decrement products in pack only.'}
{else}
{l s='Decrement both.'}
{/if}
<a class="confirm_leave" href="index.php?tab=AdminPPreferences&amp;token={$token_preferences}">
{l s='as set in the Products Preferences page'}
</a>
</label>
</p>
</div>
</div>
{if isset($pack_quantity)}
<div class="alert alert-info">
<p>{l s='When a product has combinations, quantities will be based on the default combination.'}</p>
<p>{l s='Given the quantities of the products in this pack, the maximum quantity should be:'} {$pack_quantity}</p>
</div>
{/if}
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<table class="table">
<thead>
<tr>
<th><span class="title_box">{l s='Quantity'}</span></th>
<th><span class="title_box">{l s='Designation'}</span></th>
</tr>
</thead>
{foreach from=$attributes item=attribute}
<tr{if isset($attribute['default_on']) && $attribute['default_on']} class="highlighted"{/if}>
<td class="available_quantity" id="qty_{$attribute['id_product_attribute']}">
<span>{$available_quantity[$attribute['id_product_attribute']]}</span>
<input type="text" name="qty_{$attribute['id_product_attribute']}" class="fixed-width-sm" value="{$available_quantity[$attribute['id_product_attribute']]|htmlentities}"/>
</td>
<td>{$product_designation[$attribute['id_product_attribute']]}</td>
</tr>
{/foreach}
</table>
</div>
</div>
<div id="when_out_of_stock" class="form-group">
<label class="control-label col-lg-3">{l s='When out of stock'}</label>
<div class="col-lg-9">
<p class="radio">
<label id="label_out_of_stock_1" for="out_of_stock_1">
<input type="radio" id="out_of_stock_1" name="out_of_stock" checked="checked" value="0" class="out_of_stock" {if $product->out_of_stock == 0} checked="checked" {/if}>
{l s='Deny orders'}
</label>
</p>
<p class="radio">
<label id="label_out_of_stock_2" for="out_of_stock_2">
<input type="radio" id="out_of_stock_2" name="out_of_stock" value="1" class="out_of_stock" {if $product->out_of_stock == 1} checked="checked" {/if}>
{l s='Allow orders'}
</label>
</p>
<p class="radio">
<label id="label_out_of_stock_3" for="out_of_stock_3">
<input type="radio" id="out_of_stock_3" name="out_of_stock" value="2" class="out_of_stock" {if $product->out_of_stock == 2} checked="checked" {/if}>
{l s='Default'}:
{if $order_out_of_stock == 1}
{l s='Allow orders'}
{else}
{l s='Deny orders'}
{/if}
<a class="confirm_leave" href="index.php?tab=AdminPPreferences&amp;token={$token_preferences}">
{l s='as set in the Products Preferences page'}
</a>
</label>
</p>
</div>
</div>
{else}
<div class="alert alert-warning">
<p>{l s='It is not possible to manage quantities when:'}</p>
<ul>
<li>{l s='You are currently managing all of your shops.'}</li>
<li>{l s='You are currently managing a group of shops where quantities are not shared between every shop in this group.'}</li>
<li>{l s='You are currently managing a shop that is in a group where quantities are shared between every shop in this group.'}</li>
</ul>
</div>
{/if}
{/if}
<div class="panel-footer">
<a href="{$link->getAdminLink('AdminNormalProducts')|escape:'html':'UTF-8'}{if isset($smarty.request.page) && $smarty.request.page > 1}&amp;submitFilterproduct={$smarty.request.page|intval}{/if}" class="btn btn-default"><i class="process-icon-cancel"></i> {l s='Cancel'}</a>
<button type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i></i> {l s='Save'}</button>
<button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i> {l s='Save and stay'}</button>
</div>
</div>
{* <div class="panel">
<h3>{l s='Availability settings'}</h3>
{if !$has_attribute}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="minimal_quantity" type="default"}</span></div>
<label class="control-label col-lg-2" for="minimal_quantity">
{l s='Minimum quantity'}
</label>
<div class="col-lg-9">
<input type="text" id="minimal_quantity" name="minimal_quantity" class="form-control fixed-width-sm" maxlength="6" value="{$product->minimal_quantity|default:1}" />
<p class="help-block">{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
</div>
</div>
{/if}
{if $ps_stock_management}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="available_now" type="default" multilang="true"}</span></div>
<label class="control-label col-lg-2" for="available_now_{$default_language}">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Forbidden characters:'} &#60;&#62;;&#61;#&#123;&#125;">
{l s='Displayed text when in-stock'}
</span>
</label>
<div class="col-lg-9">
{include file="controllers/products/input_text_lang.tpl"
languages=$languages
input_value=$product->available_now
input_name='available_now'}
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="available_later" type="default" multilang="true"}</span></div>
<label class="control-label col-lg-2" for="available_later_{$default_language}">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='If empty, the message "in stock" will be displayed.'} {l s='Forbidden characters:'} &#60;&#62;;&#61;#&#123;&#125;">
{l s='Displayed text when backordering is allowed'}
</span>
</label>
<div class="col-lg-9">
{include file="controllers/products/input_text_lang.tpl"
languages=$languages
input_value=$product->available_later
input_name='available_later'}
</div>
</div>
{if !$countAttributes}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="available_date" type="default"}</span></div>
<label class="control-label col-lg-2" for="available_date">
{l s='Availability date:'}
</label>
<div class="col-lg-9">
<div class="input-group fixed-width-md">
<input id="available_date" name="available_date" value="{$product->available_date}" class="datepicker" type="text" />
<div class="input-group-addon">
<i class="icon-calendar-empty"></i>
</div>
</div>
<p class="help-block">{l s='The next date of availability for this product when it is out of stock.'}</p>
</div>
</div>
{/if}
{/if}
<div class="panel-footer">
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}{if isset($smarty.request.page) && $smarty.request.page > 1}&amp;submitFilterproduct={$smarty.request.page|intval}{/if}" class="btn btn-default"><i class="process-icon-cancel"></i> {l s='Cancel'}</a>
<button type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i> {l s='Save'}</button>
<button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i> {l s='Save and stay'}</button>
</div>
<script type="text/javascript">
var quantities_ajax_success = '{l s='Data saved' js=1}';
var quantities_ajax_waiting = '{l s='Saving data...' js=1}';
</script>
</div> *}
<script type="text/javascript">
if (tabs_manager.allow_hide_other_languages)
hideOtherLanguage({$default_form_language});
</script>
{/if}

View File

@@ -24,9 +24,92 @@
*}
{extends file="helpers/options/options.tpl"}
{block name="input"}
{if $field['type'] == 'html' && $category == 'standard_product' && $key == 'PS_STANDARD_PRODUCT_ORDER_ADDRESS'}
<div class="col-lg-9">
<div class="alert alert-info"> {l s='Please set all the required fields for the custom address below'}</div>
</div>
<div>
{if isset($countries) && $countries}
<div id="conf_service_id_country" class="form-group">
<label class="control-label required col-lg-3">{l s='Country'}</label>
<div class="col-lg-9">
<select class="form-control fixed-width-xxl " name="service_id_country" id="service_id_country">
{foreach from=$countries item=country}
<option value="{$country['id_country']}" {if isset($custom_address_details['id_country']) && $country['id_country'] == $custom_address_details['id_country']}selected{/if}>{$country['name']}</option>
{/foreach}
</select>
</div>
</div>
<div id="conf_service_id_state" class="form-group">
<label class="control-label required col-lg-3">{l s='State'}</label>
<div class="col-lg-9">
<select class="form-control fixed-width-xxl" name="service_id_state" id="service_id_state">
{if isset($custom_address_details['id_state'])}<option value="{$custom_address_details['id_state']}" selected></option>{/if}
</select>
</div>
</div>
{/if}
<div id="conf_service_city" class="form-group">
<label class="control-label required col-lg-3">{l s='City'}</label>
<div class="col-lg-9">
<input class="form-control fixed-width-xxl" type="text" name="service_city" id="service_city" {if isset($custom_address_details['city'])}value="{$custom_address_details['city']}"{/if}/>
</div>
</div>
<div id="conf_service_postcode" class="form-group">
<label class="control-label col-lg-3">{l s='Zip/postal code'}</label>
<div class="col-lg-9">
<input class="form-control fixed-width-xxl" type="text" name="service_postcode" id="service_postcode" {if isset($custom_address_details['postcode'])}value="{$custom_address_details['postcode']}"{/if}/>
</div>
</div>
</div>
{else}
{$smarty.block.parent}
{/if}
{/block}
{block name="footer"}
{$smarty.block.parent}
{if $category == 'standard_product'}
<script type="text/javascript">
function ajaxGetStates(id_state_selected) {
$.ajax({
url: "index.php",
cache: false,
data: "ajax=1&tab=AdminStates&token={getAdminToken tab='AdminStates'}&action=states&id_country="+$('#service_id_country').val() + "&id_state=" + $('#service_id_state').val(),
success: function(html)
{
if (html == 'false') {
$("#conf_service_id_state").fadeOut();
$('#service_id_state option[value=0]').attr("selected", "selected");
} else {
$("#service_id_state").html(html);
$("#conf_service_id_state").fadeIn();
$('#service_id_state option[value=' + id_state_selected + ']').attr("selected", "selected");
}
}
});
}
$(document).ready(function(){
{if isset($custom_address_details['id_state'])}
if ($('#service_id_country') && $('#service_id_state')) {
ajaxGetStates({$custom_address_details['id_state']});
$('#service_id_country').change(function() {
ajaxGetStates();
});
}
{/if}
});
</script>
{/if}
{/block}
{block name="after"}
<script type="text/javascript">
changeCMSActivationAuthorization();
changeOverbookingOrderAction();
changeStandardProductAddressType();
</script>
{/block}

View File

@@ -156,36 +156,6 @@
{/foreach}
</tbody>
{/if}
{if isset($cart_normal_data) && $cart_normal_data}
<thead>
<tr>
<th><span class="title_box">{l s='Image'}</th>
<th><span class="title_box">{l s='Name'}</span></th>
<th colspan="2"><span class="title_box">{l s='Hotel Name'}</span></th>
<th colspan="2"><span class="title_box">{l s='Unit Price (tax excl)'}</span></th>
<th><span class="title_box">{l s='Quantity'}</span></th>
<th><span class="title_box">{l s='Total Price (Tax incl.)'}</span></th>
<th></th>
</tr>
</thead>
<tbody>
{foreach $cart_normal_data as $product}
<tr>
<td><img src="{$product['cover_img']|escape:'html':'UTF-8'}" class="img-responsive" /></td>
<td><p>{$product['name']|escape:'html':'UTF-8'}</p></td>
<td colspan="2">{$product['hotel_name']}</td>
<td colspan="2">{displayPrice price=$product['unit_price_tax_incl']}</td>
<td>{$product['quantity']|escape:'htmlall':'UTF-8'}</td>
<td>{displayPrice price=$product['total_price_tax_incl']}</td>
<td>
<button class="delete_service_product btn btn-danger" data-id-hotel="{$product['id_hotel']|escape:'htmlall':'UTF-8'}" data-id_product={$product['id_product']|escape:'html':'UTF-8'} data-id_cart = {$cart->id|escape:'html':'UTF-8'}>
<i class="icon-trash"></i>&nbsp;{l s='Delete'}
</button>
</td>
</tr>
{/foreach}
</tbody>
{/if}
</table>
</div>
</div>

View File

@@ -0,0 +1,165 @@
{*
* Since 2010 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright Since 2010 Webkul IN
* @license https://store.webkul.com/license.html
*}
<div class="row">
<div class="col-lg-12">
<table class="table" id="customer_products_details">
<thead>
<tr>
<th><span class="title_box">{l s='Image'}</th>
<th><span class="title_box">{l s='Name'}</span></th>
<th><span class="title_box">{l s='Quantity'}</span></th>
<th><span class="title_box">{l s='Price (Tax excl.)'}</span></th>
<th><span class="title_box">{l s='Total Tax'}</span></th>
<th><span class="title_box">{l s='Total Price (Tax incl.)'}</span></th>
{if isset($refundReqProducts) && $refundReqProducts}
<th><span class="title_box">{l s='Refund State'}</span></th>
<th><span class="title_box">{l s='Refunded amount'}</span></th>
{/if}
{if $can_edit}
<th><span class="title_box">{l s='Actions'}</th>
{/if}
</tr>
</thead>
<tbody>
{if $hotel_service_products}
{foreach from=$hotel_service_products item=product}
{* Include product line partial *}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{assign var=product_price value=($product['unit_price_tax_excl'])}
{else}
{assign var=product_price value=$product['unit_price_tax_incl']}
{/if}
<tr class="product-line-row" data-id_product="{$product.id_product}" data-id_order_detail="{$product.id_order_detail}" data-id_service_product_order_detail="{$product.id_service_product_order_detail}" data-id_hotel="{$product.id_hotel}">
<td>
{if isset($product.image_link) && $product.image_link}
<img class="img img-responsive" src="{$product.image_link|escape:'html':'UTF-8'}" />
{/if}
</td>
<td>
<a href="{$link->getAdminLink('AdminNormalProducts')|escape:'html':'UTF-8'}&amp;id_product={$product['id_product']|intval}&amp;updateproduct">
<span class="productName">{$product['name']}{if isset($product['option_name']) && $product['option_name']} : {$product['option_name']}{/if}</span><br />
</a>
</td>
<td>
<span class="">{(int)$product['quantity']}</span>
</td>
<td class="unit_price_tax_excl">
<p>{displayPrice price=$product.total_price_tax_excl currency=$currency->id}</p>
<p class="help-block">{l s='Unit price'} : {displayPrice price=$product.unit_price_tax_excl currency=$currency->id}</p>
</td>
<td>
<span>{displayPrice price=($product.total_price_tax_incl - $product.total_price_tax_excl) currency=$currency->id}</span>
</td>
<td>
<span>{displayPrice price=$product.total_price_tax_incl currency=$currency->id}</span>
</td>
{if (isset($refundReqProducts) && $refundReqProducts)}
<td>
{if $product.id_service_product_order_detail|in_array:$refundReqProducts}
{if $product.is_cancelled}
<span class="badge badge-danger">{l s='Cancelled'}</span>
{elseif isset($product.refund_info) && (!$product.refund_info.refunded || $product.refund_info.id_customization)}
<span class="badge" style="background-color:{$product.refund_info.color|escape:'html':'UTF-8'}">{$product.refund_info.name|escape:'html':'UTF-8'}</span>
{else}
<span>--</span>
{/if}
{else}
<span>--</span>
{/if}
</td>
<td>
{if $product.is_refunded && isset($product.refund_info) && $product.refund_info}
{convertPriceWithCurrency price=$product.refund_info.refunded_amount currency=$currency->id}
{else}
--
{/if}
</td>
{/if}
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="room_invoice" style="display: none;">
{if sizeof($invoices_collection)}
<select name="product_invoice" class="edit_product_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" {*{if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}*}>
#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang, null, $order->id_shop)}{'%06d'|sprintf:$invoice->number}
</option>
{/foreach}
</select>
{else}
&nbsp;
{/if}
</td>
<td class="product_action">
{* edit/delete controls *}
<div class="btn-group">
{* <button type="button" class="btn btn-default delete_product_line">
<i class="icon-trash"></i>
{l s='Delete'}
</button> *}
<button type="button" class="btn btn-default edit_product_change_link" data-product_line_data="{$product|json_encode|escape}">
<i class="icon-pencil"></i>
{l s='Edit'}
</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#" class="delete_product_line">
<i class="icon-trash"></i>
{l s='Delete'}
</a>
</li>
</ul>
</div>
{* Update controls *}
{* <button type="button" class="btn btn-default submitProductChange" style="display: none;">
<i class="icon-ok"></i>
{l s='Update'}
</button>
<button type="button" class="btn btn-default cancel_product_change_link" style="display: none;">
<i class="icon-remove"></i>
{l s='Cancel'}
</button> *}
</td>
{/if}
</tr>
{/foreach}
{else}
<tr>
{assign var=colspan value=6}
{if isset($refundReqProducts) && $refundReqProducts}
{assign var=colspan value=($colspan+2)}
{/if}
{if ($can_edit)}
{assign var=colspan value=($colspan+1)}
{/if}
<td class="list-empty hidden-print" colspan="{$colspan}">
<div class="list-empty-msg">
<i class="icon-warning-sign list-empty-icon"></i>
{l s='No products added yet'}
</div>
</td>
</tr>
{/if}
</tbody>
</table>
</div>
</div>

View File

@@ -1,139 +0,0 @@
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{assign var=product_price value=($product['unit_price_tax_excl'] + $product['ecotax'])}
{else}
{assign var=product_price value=$product['unit_price_tax_incl']}
{/if}
<tr class="product-line-row" data-id_product="{$product.id_product}" data-id_order_detail="{$product.id_order_detail}">
{if $refund_allowed}
<td class="standard_refund_fields" style="display:none">
<input type="checkbox" name="id_htl_booking[]" value="{$product.id|escape:'html':'UTF-8'}" {if isset($refundReqBookings) && ($product.id|in_array:$refundReqBookings)}disabled{/if}/>
</td>
{/if}
{* <td class="text-center">
{$data.room_num}
</td> *}
<td class="text-center">
{if isset($product.image) && $product.image->id}{$product.image_tag}{/if}
</td>
<td class="text-center">
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}&amp;id_product={$product['product_id']|intval}&amp;updateproduct&amp;token={getAdminToken tab='AdminProducts'}">
<span class="productName">{$product['product_name']}</span><br />
{if $product.product_reference}{l s='Reference number:'} {$product.product_reference}<br />{/if}
{if $product.product_supplier_reference}{l s='Supplier reference:'} {$product.product_supplier_reference}{/if}
</a>
{* <div class="row-editing-warning" style="display:none;">
<div class="alert alert-warning">
<strong>{l s='Editing this product line will remove the reduction and base price.'}</strong>
</div>
</div> *}
</td>
<td class="text-center unit_price_tax_excl">
<span>{displayPrice price=$product.unit_price_tax_excl currency=$currency->id}</span>
</td>
<td class="text-center">
<span class="product_quantity_show{if (int)$product['product_quantity'] - (int)$product['customized_product_quantity'] > 1} badge{/if}">{(int)$product['product_quantity'] - (int)$product['customized_product_quantity']}</span>
{if $can_edit}
<span class="product_quantity_edit" style="display:none;">
<input type="text" name="product_quantity" class="edit_product_quantity" value="{$product['product_quantity']|htmlentities}"/>
</span>
{/if}
</td>
<td class="text-center">
<span class="room_price_show">{displayPrice price=$product_price * ($product['product_quantity'] - $product['customizationQuantityTotal']) currency=$currency->id}</span>
{* {if $can_edit}
<div class="room_price_edit" style="display:none;">
<input type="hidden" name="product_id_order_detail" class="edit_product_id_order_detail" value="{$product['id_order_detail']}" />
<div class="form-group">
<div class="fixed-width-xl">
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
<input type="text" name="product_price_tax_excl" class="edit_product_price_tax_excl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_excl'], 2)}"/>
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
</div>
</div>
<br/>
<div class="fixed-width-xl">
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
<input type="text" name="product_price_tax_incl" class="edit_product_price_tax_incl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_incl'], 2)}"/>
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
</div>
</div>
</div>
</div>
{/if} *}
</td>
{* {if isset($refundReqBookings) && $refundReqBookings}
<td class="text-center">
{if isset($data.refund_info) && $data.refund_info}
<span class="badge" style="background-color:{$data.refund_info.color|escape:'html':'UTF-8'}">{$data.refund_info.name|escape:'html':'UTF-8'}</span>
{/if}
</td>
<td class="text-center">
{if isset($data.refund_info) && $data.refund_info}
{convertPriceWithCurrency price=$data.refund_info.refunded_amount currency=$currency->id}
{/if}
</td>
{/if} *}
{* {if $data.booking_type == 1}
<td class="text-center">
{if isset($data.refund_info) && ($data.refund_info.refunded || $data.refund_info.denied)}
<p class="text-center">--</p>
{else}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mySwappigModal" data-id_order="{$order->id}" data-room_num='{$data.room_num}' data-date_from='{$data.date_from}' data-date_to='{$data.date_to}' data-id_room='{$data.id_room}' data-cust_name='{$data.alloted_cust_name}' data-cust_email='{$data.alloted_cust_email}' data-avail_rm_swap='{$data.avail_rooms_to_swap|@json_encode}' data-avail_rm_realloc='{$data.avail_rooms_to_realloc|@json_encode}'>
{l s='Reallocate Room' mod='hotelreservationsystem'}
</button>
{/if}
</td>
{/if} *}
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="room_invoice" style="display: none;">
{if sizeof($invoices_collection)}
<select name="product_invoice" class="edit_product_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" {*{if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}*}>
#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang, null, $order->id_shop)}{'%06d'|sprintf:$invoice->number}
</option>
{/foreach}
</select>
{else}
&nbsp;
{/if}
</td>
<td class="product_action text-right">
{* edit/delete controls *}
<div class="btn-group">
{* <button type="button" class="btn btn-default delete_product_line">
<i class="icon-trash"></i>
{l s='Delete'}
</button> *}
<button type="button" class="btn btn-default edit_product_change_link">
<i class="icon-pencil"></i>
{l s='Edit'}
</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#" class="delete_product_line">
<i class="icon-trash"></i>
{l s='Delete'}
</a>
</li>
</ul>
</div>
{* Update controls *}
<button type="button" class="btn btn-default submitProductChange" style="display: none;">
<i class="icon-ok"></i>
{l s='Update'}
</button>
<button type="button" class="btn btn-default cancel_product_change_link" style="display: none;">
<i class="icon-remove"></i>
{l s='Cancel'}
</button>
</td>
{/if}
</tr>

View File

@@ -1,60 +0,0 @@
{*
* Since 2010 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright Since 2010 Webkul IN
* @license https://store.webkul.com/license.html
*}
<div class="row">
<div class="col-lg-12">
<table class="table" id="customer_products_details" {if !$order_service_products}style="display:none"{/if}>
<thead>
<tr>
{if $refund_allowed}
<th class="standard_refund_fields" style="display:none"></th>
{/if}
{* <th class="text-center"><span class="title_box">{l s='Room No.'}</span></th> *}
<th class="text-center"><span class="title_box">{l s='Image'}</th>
<th class="text-center"><span class="title_box">{l s='Name'}</span></th>
<th class="text-center"><span class="title_box">{l s='Unit Price (Tax excl.)'}</span></th>
<th class="text-center"><span class="title_box">{l s='Quantity'}</span></th>
<th class="text-center"><span class="title_box">{l s='Total Price (Tax incl.)'}</span></th>
{* {if isset($refundReqBookings) && $refundReqBookings}
<th class="text-center"><span class="title_box">{l s='Refund State'}</span></th>
<th class="text-center"><span class="title_box">{l s='Refunded amount'}</span></th>
{/if} *}
{* <th class="text-center"><span class="title_box">{l s='Reallocate Room'}</span></th> *}
{if ($can_edit && !$order->hasBeenDelivered())}
<th class="text-right"><span class="title_box">{l s='Edit Order'}</th>
{/if}
</tr>
</thead>
<tbody>
{if $order_service_products}
{foreach from=$order_service_products item=product}
{* Include product line partial *}
{include file='controllers/orders/_service_product_line.tpl'}
{/foreach}
{else}
{* <tr>
<td>{l s='No Data Found.'}</td>
</tr> *}
{/if}
{* Include product line partial *}
{include file='controllers/orders/_new_service_product.tpl'}
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,165 @@
{*
* Since 2010 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright Since 2010 Webkul IN
* @license https://store.webkul.com/license.html
*}
<div class="row">
<div class="col-lg-12">
<table class="table" id="customer_products_details">
<thead>
<tr>
<th><span class="title_box">{l s='Image'}</th>
<th><span class="title_box">{l s='Name'}</span></th>
<th><span class="title_box">{l s='Quantity'}</span></th>
<th><span class="title_box">{l s='Price (Tax excl.)'}</span></th>
<th><span class="title_box">{l s='Total Tax'}</span></th>
<th><span class="title_box">{l s='Total Price (Tax incl.)'}</span></th>
{if isset($refundReqProducts) && $refundReqProducts}
<th><span class="title_box">{l s='Refund State'}</span></th>
<th><span class="title_box">{l s='Refunded amount'}</span></th>
{/if}
{if ($can_edit)}
<th><span class="title_box">{l s='Actions'}</th>
{/if}
</tr>
</thead>
<tbody>
{if $standalone_service_products}
{foreach from=$standalone_service_products item=product}
{* Include product line partial *}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{assign var=product_price value=($product['unit_price_tax_excl'])}
{else}
{assign var=product_price value=$product['unit_price_tax_incl']}
{/if}
<tr class="product-line-row" data-id_product="{$product.id_product}" data-id_order_detail="{$product.id_order_detail}" data-id_service_product_order_detail="{$product.id_service_product_order_detail}">
<td>
{if isset($product.image_link) && $product.image_link}
<img class="img img-responsive" src="{$product.image_link|escape:'html':'UTF-8'}" />
{/if}
</td>
<td>
<a href="{$link->getAdminLink('AdminNormalProducts')|escape:'html':'UTF-8'}&amp;id_product={$product['id_product']|intval}&amp;updateproduct">
<span class="productName">{$product['name']}{if $product['option_name']} : {$product['option_name']}{/if}</span><br />
</a>
</td>
<td>
<span class="">{(int)$product['quantity']}</span>
</td>
<td class="unit_price_tax_excl">
<p>{displayPrice price=$product.total_price_tax_excl currency=$currency->id}</p>
<p class="help-block">{l s='Unit price'} : {displayPrice price=$product.unit_price_tax_excl currency=$currency->id}</p>
</td>
<td>
<span>{displayPrice price=($product.total_price_tax_incl - $product.total_price_tax_excl) currency=$currency->id}</span>
</td>
<td>
<span>{displayPrice price=$product.total_price_tax_incl currency=$currency->id}</span>
</td>
{if (isset($refundReqProducts) && $refundReqProducts)}
<td>
{if $product.id_service_product_order_detail|in_array:$refundReqProducts}
{if $product.is_cancelled}
<span class="badge badge-danger">{l s='Cancelled'}</span>
{elseif isset($product.refund_info) && (!$product.refund_info.refunded || $product.refund_info.id_customization)}
<span class="badge" style="background-color:{$product.refund_info.color|escape:'html':'UTF-8'}">{$product.refund_info.name|escape:'html':'UTF-8'}</span>
{else}
<span>--</span>
{/if}
{else}
<span>--</span>
{/if}
</td>
<td>
{if $product.is_refunded && isset($product.refund_info) && $product.refund_info}
{convertPriceWithCurrency price=$product.refund_info.refunded_amount currency=$currency->id}
{else}
--
{/if}
</td>
{/if}
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="room_invoice" style="display: none;">
{if sizeof($invoices_collection)}
<select name="product_invoice" class="edit_product_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" {*{if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}*}>
#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang, null, $order->id_shop)}{'%06d'|sprintf:$invoice->number}
</option>
{/foreach}
</select>
{else}
&nbsp;
{/if}
</td>
<td class="product_action">
{* edit/delete controls *}
<div class="btn-group">
{* <button type="button" class="btn btn-default delete_product_line">
<i class="icon-trash"></i>
{l s='Delete'}
</button> *}
<button type="button" class="btn btn-default edit_product_change_link" data-product_line_data="{$product|json_encode|escape}">
<i class="icon-pencil"></i>
{l s='Edit'}
</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#" class="delete_product_line">
<i class="icon-trash"></i>
{l s='Delete'}
</a>
</li>
</ul>
</div>
{* Update controls *}
{* <button type="button" class="btn btn-default submitProductChange" style="display: none;">
<i class="icon-ok"></i>
{l s='Update'}
</button>
<button type="button" class="btn btn-default cancel_product_change_link" style="display: none;">
<i class="icon-remove"></i>
{l s='Cancel'}
</button> *}
</td>
{/if}
</tr>
{/foreach}
{else}
<tr>
{assign var=colspan value=6}
{if isset($refundReqProducts) && $refundReqProducts}
{assign var=colspan value=($colspan+2)}
{/if}
{if ($can_edit)}
{assign var=colspan value=($colspan+1)}
{/if}
<td class="list-empty hidden-print" colspan="{$colspan}">
<div class="list-empty-msg">
<i class="icon-warning-sign list-empty-icon"></i>
{l s='No products added yet'}
</div>
</td>
</tr>
{/if}
</tbody>
</table>
</div>
</div>

View File

@@ -283,6 +283,27 @@
};
updateProductPrice(params, cart_row);
})
$(document).on('change', '.product_quantity', function(e) {
var cart_row = $(this).closest('tr');
var qty = parseInt($(this).val());
var qtyhidden= parseInt($(this).siblings('.product_quantity_hidden').val());
var qty_to_update = qty - qtyhidden;
if ((qty_to_update) > 0) {
var opt = 'up';
} else {
var opt = 'down';
}
var params = {
id_product: parseInt($(cart_row).attr('data-id-product')),
qty: qty_to_update,
opt: opt,
id_cart: id_cart
};
updateQuantity(params, cart_row);
$(this).siblings('.product_quantity_hidden').val($(this).val())
});
$('#order_message').live('change', function(e) {
e.preventDefault();
$.ajax({
@@ -700,6 +721,26 @@
});
}
function updateQuantity(params, cart_row)
{
$.ajax({
type:"POST",
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
async: true,
dataType: "JSON",
data: {
ajax: "1",
token: "{getAdminToken tab='AdminCarts'}",
tab: "AdminCarts",
action: "updateProductQuantity",
params: params,
},
success : function(response) {
// updateCartLine(response.curr_booking_info, cart_row);
// updateCartSummaryData(response.cart_info);
}
});
}
function updateCartLine(data, cart_row) {
$(cart_row).find('.cart_line_total_rooms_price').html(data.amt_with_qty);

View File

@@ -88,89 +88,90 @@
<div class="row">
<div class="col-lg-7">
<div class="panel">
<div class="panel-heading order_status_heading">
<i class="icon-bed"></i> &nbsp;{l s='Rooms Status'}
</div>
<div class="panel-content">
<div class="row">
<div class="col-lg-12 table-responsive" id="room_status_info_wrapper">
<table class="table">
<thead>
<tr>
<th>{l s='Room'}</th>
<th>{l s='Duration'}</th>
<th>{l s='Check-In'}</th>
<th>{l s='Check-Out'}</th>
<th>{l s='Allotment'}</th>
<th>{l s='Action'}</th>
</tr>
</thead>
<tbody>
{if isset($htl_booking_order_data) && $htl_booking_order_data}
{foreach from=$htl_booking_order_data item=data}
<tr>
<td>
{$data['room_num']}<br>
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}&amp;id_product={$data['id_product']}&amp;updateproduct" target="_blank">{$data['room_type_name']|escape:'html':'UTF-8'}</a>
</td>
<td>
{assign var="is_full_date" value=($show_full_date && ($data['date_from']|date_format:'%D' == $data['date_to']|date_format:'%D'))}
{dateFormat date=$data['date_from'] full=$is_full_date} - {dateFormat date=$data['date_to'] full=$is_full_date}
</td>
<td>
{if ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']) || ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status'])}
<span class="text-danger room_status">{l s='Checked in on'}<br>{dateFormat date=$data['check_in'] full=1}</span>
{else}
--
{/if}
</td>
<td>
{if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']}
<span class="text-success room_status">{l s='Checked out on'}<br>{dateFormat date=$data['check_out'] full=1}</span>
{else}
--
{/if}
</td>
<td>
{if $data['booking_type'] == $ALLOTMENT_MANUAL}
{l s='Manual'} &nbsp;{if $data['comment'] != ''}<a class="manual_allotment_comment" href="#" data-id_hotel_booking_detail="{$data['id']}"><i class="icon-info-circle"></i></a>{/if}
{else}
{l s='Auto'}
{/if}
</td>
<td>
<a title="{l s='Upload/Check guest documents'}" class="btn btn-default" href="#" onclick="BookingDocumentsModal.init({$data.id|intval}, this); return false;">
<span class="badge badge-info">{if $data.num_checkin_documents > 0}{$data.num_checkin_documents}{else}0{/if}</span> <i class="icon-file-text"></i>
</a>
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded}
<span class="badge badge-danger">{if $data.is_cancelled}{l s='Cancelled'}{else}{l s='Refunded'}{/if}</span>
{elseif $can_edit}
<a class="open_room_status_form btn btn-default" href="#" data-id_hotel_booking_detail="{$data['id']}" data-id_order="{$data['id_order']}" data-id_status="{$data['id_status']}" data-id_room="{$data['id_room']}" data-date_from="{$data['date_from']|date_format:"%Y-%m-%d"}" data-date_to="{$data['date_to']|date_format:"%Y-%m-%d"}" data-check_in_time="{$data['check_in_time']}" data-check_out_time="{$data['check_out_time']}">
<i class="icon-pencil"></i> {l s='Edit'}
{if isset($htl_booking_order_data) && $htl_booking_order_data}
<div class="panel">
<div class="panel-heading order_status_heading">
<i class="icon-bed"></i> &nbsp;{l s='Rooms Status'}
</div>
<div class="panel-content">
<div class="row">
<div class="col-lg-12 table-responsive" id="room_status_info_wrapper">
<table class="table">
<thead>
<tr>
<th>{l s='Room'}</th>
<th>{l s='Duration'}</th>
<th>{l s='Check-In'}</th>
<th>{l s='Check-Out'}</th>
<th>{l s='Allotment'}</th>
<th>{l s='Action'}</th>
</tr>
</thead>
<tbody>
{if isset($htl_booking_order_data) && $htl_booking_order_data}
{foreach from=$htl_booking_order_data item=data}
<tr>
<td>
{$data['room_num']}<br>
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}&amp;id_product={$data['id_product']}&amp;updateproduct" target="_blank">{$data['room_type_name']|escape:'html':'UTF-8'}</a>
</td>
<td>
{assign var="is_full_date" value=($show_full_date && ($data['date_from']|date_format:'%D' == $data['date_to']|date_format:'%D'))}
{dateFormat date=$data['date_from'] full=$is_full_date} - {dateFormat date=$data['date_to'] full=$is_full_date}
</td>
<td>
{if ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']) || ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status'])}
<span class="text-danger room_status">{l s='Checked in on'}<br>{dateFormat date=$data['check_in'] full=1}</span>
{else}
--
{/if}
</td>
<td>
{if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']}
<span class="text-success room_status">{l s='Checked out on'}<br>{dateFormat date=$data['check_out'] full=1}</span>
{else}
--
{/if}
</td>
<td>
{if $data['booking_type'] == $ALLOTMENT_MANUAL}
{l s='Manual'} &nbsp;{if $data['comment'] != ''}<a class="manual_allotment_comment" href="#" data-id_hotel_booking_detail="{$data['id']}"><i class="icon-info-circle"></i></a>{/if}
{else}
{l s='Auto'}
{/if}
</td>
<td>
<a title="{l s='Upload/Check guest documents'}" class="btn btn-default" href="#" onclick="BookingDocumentsModal.init({$data.id|intval}, this); return false;">
<span class="badge badge-info">{if $data.num_checkin_documents > 0}{$data.num_checkin_documents}{else}0{/if}</span> <i class="icon-file-text"></i>
</a>
{/if}
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded}
<span class="badge badge-danger">{if $data.is_cancelled}{l s='Cancelled'}{else}{l s='Refunded'}{/if}</span>
{elseif $can_edit}
<a class="open_room_status_form btn btn-default" href="#" data-id_hotel_booking_detail="{$data['id']}" data-id_order="{$data['id_order']}" data-id_status="{$data['id_status']}" data-id_room="{$data['id_room']}" data-date_from="{$data['date_from']|date_format:"%Y-%m-%d"}" data-date_to="{$data['date_to']|date_format:"%Y-%m-%d"}" data-check_in_time="{$data['check_in_time']}" data-check_out_time="{$data['check_out_time']}">
<i class="icon-pencil"></i> {l s='Edit'}
</a>
{/if}
</td>
</tr>
{/foreach}
{else}
<tr>
<td class="list-empty hidden-print" colspan="6">
<div class="list-empty-msg">
<i class="icon-warning-sign list-empty-icon"></i>
{l s='No rooms found'}
</div>
</td>
</tr>
{/foreach}
{else}
<tr>
<td class="list-empty hidden-print" colspan="6">
<div class="list-empty-msg">
<i class="icon-warning-sign list-empty-icon"></i>
{l s='No rooms found'}
</div>
</td>
</tr>
{/if}
</tbody>
</table>
{/if}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
{/if}
<div class="panel">
<div class="panel-heading">
<i class="icon-file"></i> &nbsp;{l s='Order'}
@@ -786,31 +787,33 @@
{/if}
</div>
</div>
<div class="panel">
<div class="panel-heading">
<i class="icon-remove-sign"></i> &nbsp;{l s='Cancellation Policies'}
</div>
<div class="panel-content">
{if is_array($applicable_refund_policies) && count($applicable_refund_policies)}
<ul>
{foreach from=$applicable_refund_policies item=$applicable_refund_policy}
<li class="form-group">
<a href="{$link->getAdminLink('AdminOrderRefundRules')|escape:'html':'UTF-8'}&id_refund_rule={$applicable_refund_policy.id_refund_rule}&updatehtl_order_refund_rules" target="_blank">
{$applicable_refund_policy.name|escape:'html':'UTF-8'} &nbsp;<i class="icon icon-external-link-square"></i>
</a>
</li>
{/foreach}
</ul>
{else}
<div class="list-empty">
<div class="list-empty-msg">
<i class="icon-warning-sign list-empty-icon"></i>
{l s='No cancellation policies applicable.'}
{if is_array($applicable_refund_policies) && count($applicable_refund_policies)}
<div class="panel">
<div class="panel-heading">
<i class="icon-remove-sign"></i> &nbsp;{l s='Cancellation Policies'}
</div>
<div class="panel-content">
{if is_array($applicable_refund_policies) && count($applicable_refund_policies)}
<ul>
{foreach from=$applicable_refund_policies item=$applicable_refund_policy}
<li class="form-group">
<a href="{$link->getAdminLink('AdminOrderRefundRules')|escape:'html':'UTF-8'}&id_refund_rule={$applicable_refund_policy.id_refund_rule}&updatehtl_order_refund_rules" target="_blank">
{$applicable_refund_policy.name|escape:'html':'UTF-8'} &nbsp;<i class="icon icon-external-link-square"></i>
</a>
</li>
{/foreach}
</ul>
{else}
<div class="list-empty">
<div class="list-empty-msg">
<i class="icon-warning-sign list-empty-icon"></i>
{l s='No cancellation policies applicable.'}
</div>
</div>
</div>
{/if}
{/if}
</div>
</div>
</div>
{/if}
{hook h="displayAdminOrderRight" id_order=$order->id}
</div>
</div>
@@ -822,26 +825,66 @@
<div style="display: none">
<input type="hidden" value="{$order->getWarehouseList()|implode}" id="warehouse_list" />
</div>
<div class="panel" id="refundForm">
<div class="panel-heading">
<i class="icon-bed"></i> &nbsp;{l s='Rooms Booking Detail'} <span class="badge">{$order_detail_data|@count}</span>
{if $can_edit && (!$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED'))}
<button type="button" id="add_room" class="btn btn-primary pull-right">
<i class="icon-plus-sign"></i> {l s='Add Rooms'}
</button>
{if $hotel_booking}
<div class="panel">
<div class="panel-heading">
<i class="icon-bed"></i> &nbsp;{l s='Rooms Booking Detail'} <span class="badge">{$order_detail_data|@count}</span>
{if $can_edit && (!$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED'))}
<button type="button" id="add_room" class="btn btn-primary pull-right">
<i class="icon-plus-sign"></i> {l s='Add Rooms'}
</button>
{/if}
</div>
{* by webkul this code is added for showing rooms information on the order detail page *}
{include file='controllers/orders/_rooms_informaion_table.tpl'}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
<input type="hidden" name="TaxMethod" value="0">
{else}
<input type="hidden" name="TaxMethod" value="1">
{/if}
</div>
{* by webkul this code is added for showing rooms information on the order detail page *}
{include file='controllers/orders/_rooms_informaion_table.tpl'}
<br>
{include file='controllers/orders/_service_products_table.tpl'}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
<input type="hidden" name="TaxMethod" value="0">
{else}
<input type="hidden" name="TaxMethod" value="1">
{if $hotel_service_products || $hotelStandaloneProducts || $standaloneProducts}
<div class="panel">
<div class="panel-heading">
<i class="icon-bed"></i> &nbsp;{l s='Products Detail'} <span class="badge">{$hotel_service_products|count}</span>
{if $can_edit && (!$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED'))}
<button type="button" id="add_product" class="btn btn-primary pull-right">
<i class="icon-plus-sign"></i> {l s='Add Product'}
</button>
{/if}
</div>
{include file='controllers/orders/_hotel_service_products_table.tpl'}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
<input type="hidden" name="TaxMethod" value="0">
{else}
<input type="hidden" name="TaxMethod" value="1">
{/if}
</div>
{/if}
</div>
{else}
{if $standalone_service_products || $standaloneProducts}
<div class="panel">
<div class="panel-heading">
<i class="icon-bed"></i> &nbsp;{l s='Products Detail'} <span class="badge">{$standalone_service_products|count}</span>
{if $can_edit && (!$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED'))}
<button type="button" id="add_product" class="btn btn-primary pull-right">
<i class="icon-plus-sign"></i> {l s='Add Product'}
</button>
{/if}
</div>
{include file='controllers/orders/_standalone_service_products_table.tpl'}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
<input type="hidden" name="TaxMethod" value="0">
{else}
<input type="hidden" name="TaxMethod" value="1">
{/if}
</div>
{/if}
{/if}
</form>
</div>
</div>
@@ -873,19 +916,19 @@
{assign var=total_rooms_price_tax_incl value=$order->getTotalProductsWithTaxes(false, true)}
{* Get total extra services including convenience fees prices *}
{assign var=total_services_price_tax_excl value=$order->getTotalProductsWithoutTaxes(false, false)}
{assign var=total_services_price_tax_incl value=$order->getTotalProductsWithTaxes(false, false)}
{assign var=total_products_price_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE) + $order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE))}
{assign var=total_products_price_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE) + $order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE))}
{* Get total of extra services and extra demands prices(excluding convenience fee) *}
{assign var=total_room_services_and_demands_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTE)}
{assign var=total_room_services_and_demands_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTI)}
{assign var=total_room_services_and_demands_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) + $totalDemandsPriceTE)}
{assign var=total_room_services_and_demands_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) + $totalDemandsPriceTI)}
{* Get total of only convenience fees prices *}
{assign var=total_convenience_fee_tax_excl value=$order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
{assign var=total_convenience_fee_tax_incl value=$order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
{assign var=total_convenience_fee_tax_excl value=$order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
{assign var=total_convenience_fee_tax_incl value=$order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
{assign var=order_total_price_tax_excl value=($total_rooms_price_tax_excl + $total_services_price_tax_excl + $totalDemandsPriceTE)}
{assign var=order_total_price_tax_incl value=($total_rooms_price_tax_incl + $total_services_price_tax_incl + $totalDemandsPriceTI)}
{assign var=order_total_price_tax_excl value=($total_rooms_price_tax_excl + $total_room_services_and_demands_tax_excl + $total_products_price_tax_excl)}
{assign var=order_total_price_tax_incl value=($total_rooms_price_tax_incl + $total_room_services_and_demands_tax_incl + $total_products_price_tax_incl)}
{if $total_rooms_price_tax_excl}
<tr id="total_products">
@@ -896,6 +939,15 @@
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if $total_products_price_tax_excl > 0}
<tr id="total_products">
<td class="text-right">{l s='Total products (Tax excl.)'}</td>
<td class="amount text-right nowrap">
{displayPrice price=$total_products_price_tax_excl currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if isset($total_room_services_and_demands_tax_excl) && $total_room_services_and_demands_tax_excl > 0}
<tr id="total_products">
<td class="text-right">{l s='Total Extra services (Tax excl.)'}</td>
@@ -969,6 +1021,15 @@
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if ($total_products_price_tax_incl - $total_products_price_tax_excl) > 0}
<tr id="total_products">
<td class="text-left">{l s='Products Tax'}</td>
<td class="amount text-right nowrap">
{displayPrice price=($total_products_price_tax_incl - $total_products_price_tax_excl) currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if isset($total_convenience_fee_tax_excl) && $total_convenience_fee_tax_excl > 0}
<tr id="total_products">
<td class="text-left">{l s='Convenience Fee Tax'}</td>
@@ -1013,7 +1074,7 @@
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{if isset($refundReqBookings) && $refundReqBookings}
{if (isset($refundReqBookings) && $refundReqBookings) || (isset($refundReqProducts) && $refundReqProducts)}
<tr id="total_order">
<td class="text-right"><strong>* {l s='Refunded Amount'}</strong></td>
<td class="amount text-right nowrap">

View File

@@ -0,0 +1,92 @@
{*
* Since 2010 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright Since 2010 Webkul IN
* @license https://store.webkul.com/license.html
*}
<div class="modal-body">
<div id="new_product">
<input type="hidden" id="add_product_product_id" name="add_product[product_id]" value="0" />
<div class="form-group">
<label class="control-label">{l s='Product:'}</label>
<div class="input-group">
<input type="text" id="add_product_product_name" class="form-control" value="" placeholder="{l s='Enter the name of the product'}" />
<div class="input-group-addon">
<i class="icon-search"></i>
</div>
</div>
</div>
<div class="add_product_fields" style="display:none;">
{hook h='displayAdminOrderAddRoomFormFieldsBefore'}
<div class="row form-group">
<div class="col-sm-6">
<label class="control-label">{l s='Price (tax excl.)'}</label>
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
<input class="form-control" type="text" name="add_product[product_price_tax_excl]" id="add_product_product_price_tax_excl" value="" disabled="disabled"/>
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign}</div>{/if}
</div>
</div>
<div class="col-sm-6">
<label class="control-label">{l s='Price (tax incl.)'}</label>
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
<input class="form-control" type="text" name="add_product[product_price_tax_incl]" id="add_product_product_price_tax_incl" value="" disabled="disabled"/>
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign}</div>{/if}
</div>
</div>
</div>
<div id="standard_product_options_container">
<div class="row">
<div class="productQuantity form-group col-sm-6">
<label class="control-label">{l s='Quantity'}</label>
<input type="number" class="form-control" name="add_product[product_quantity]" id="add_product_product_quantity" value="1" disabled="disabled" min="1"/>
</div>
<div class="productOptions form-group col-sm-6" style="display: none;">
<label class="control-label">{l s='Variant'}</label>
<select name="add_product[product_option]" id="add_product_product_option">
</select>
</div>
</div>
</div>
{if sizeof($invoices_collection)}
<div class="form-group" style="display: none;">
<label class="control-label">{l s='Invoice'}</label>
<select class="form-control" name="add_product[invoice]" id="add_product_product_invoice" disabled="disabled">
<optgroup class="existing" label="{l s='Existing'}">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}">{$invoice->getInvoiceNumberFormatted($current_id_lang)}</option>
{/foreach}
</optgroup>
<optgroup label="{l s='New'}">
<option value="0">{l s='Create a new invoice'}</option>
</optgroup>
</select>
</div>
{/if}
</div>
<button type="button" class="btn btn-default" id="submitAddProduct" disabled="disabled" style="display:none;"></button>
</div>
{if isset($loaderImg) && $loaderImg}
<div class="loading_overlay">
<img src='{$loaderImg}' class="loading-img"/>
</div>
{/if}
</div>

View File

@@ -18,7 +18,7 @@
*}
<div class="modal-body">
<div id="new_product">
<div id="new_room">
<input type="hidden" id="add_product_product_id" name="add_product[product_id]" value="0" />
<div class="form-group">
<label class="control-label">{l s='Room Type:'}</label>
@@ -142,7 +142,7 @@
</div>
{/if}
</div>
<button type="button" class="btn btn-default" id="submitAddProduct" disabled="disabled" style="display:none;"></button>
<button type="button" class="btn btn-default" id="submitAddRoom" disabled="disabled" style="display:none;"></button>
</div>
{if isset($loaderImg) && $loaderImg}

View File

@@ -18,40 +18,82 @@
*}
<div class="modal-body">
{if $bookingOrderInfo|count > 0}
<form id="order_discount_form" action="{$current_index}&amp;vieworder&amp;token={$smarty.get.token|escape:'html':'UTF-8'}&amp;id_order={$order->id|intval}" method="post">
<div class="form-group">
<div class="table-responsive">
<table class="table" id="customer_cart_details">
<thead>
<tr>
<th></th>
<th>{l s='Room No.'}</th>
<th>{l s='Room Type'}</th>
<th>{l s='Hotel Name'}</th>
<th>{l s='Duration'}</th>
<th>{l s='Total Price (Tax incl.)'}</th>
</tr>
</thead>
<tbody>
{foreach from=$bookingOrderInfo item=bookingInfo}
<tr>
<td>
<input type="checkbox" name="id_htl_booking[]" value="{$bookingInfo.id|escape:'html':'UTF-8'}"/>
</td>
<td><b>{$bookingInfo.room_num|escape:'html':'UTF-8'}</b></td>
<td>{$bookingInfo.room_type_name|escape:'html':'UTF-8'}</td>
<td>{$bookingInfo.hotel_name|escape:'html':'UTF-8'}</td>
{assign var="is_full_date" value=($show_full_date && ($bookingInfo['date_from']|date_format:'%D' == $bookingInfo['date_to']|date_format:'%D'))}
<td>{dateFormat date=$bookingInfo.date_from full=$is_full_date} - {dateFormat date=$bookingInfo.date_to full=$is_full_date}</span></td>
<td>{convertPriceWithCurrency price=$bookingInfo.total_price_tax_incl currency=$currency->id}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{if $bookingOrderInfo|count > 0 || $serviceProducts|count > 0}
{if $bookingOrderInfo|count > 0 && $serviceProducts|count > 0}
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#refund_rooms_tab" role="tab" data-toggle="tab">{l s='Rooms'}</a>
</li>
<li role="presentation">
<a href="#refund_products_tab" aria-controls="products" role="tab" data-toggle="tab">{l s='Products'}</a>
</li>
</ul>
{/if}
<form id="order_refund_form" action="{$current_index}&amp;vieworder&amp;token={$smarty.get.token|escape:'html':'UTF-8'}&amp;id_order={$order->id|intval}" method="post">
{if $bookingOrderInfo|count > 0 && $serviceProducts|count > 0}
<div class="form-group tab-content clearfix">
{/if}
{if $bookingOrderInfo|count}
<div id="refund_rooms_tab" class="form-group table-responsive tab-pane active">
<table class="table" id="customer_cart_details">
<thead>
<tr>
<th></th>
<th>{l s='Room No.'}</th>
<th>{l s='Room Type'}</th>
<th>{l s='Hotel Name'}</th>
<th>{l s='Duration'}</th>
<th>{l s='Total Price (Tax incl.)'}</th>
</tr>
</thead>
<tbody>
{foreach from=$bookingOrderInfo item=bookingInfo}
<tr>
<td>
<input type="checkbox" name="id_htl_booking[]" value="{$bookingInfo.id|escape:'html':'UTF-8'}"/>
</td>
<td><b>{$bookingInfo.room_num|escape:'html':'UTF-8'}</b></td>
<td>{$bookingInfo.room_type_name|escape:'html':'UTF-8'}</td>
<td>{$bookingInfo.hotel_name|escape:'html':'UTF-8'}</td>
{assign var="is_full_date" value=($show_full_date && ($bookingInfo['date_from']|date_format:'%D' == $bookingInfo['date_to']|date_format:'%D'))}
<td>{dateFormat date=$bookingInfo.date_from full=$is_full_date} - {dateFormat date=$bookingInfo.date_to full=$is_full_date}</span></td>
<td>{convertPriceWithCurrency price=$bookingInfo.total_price_tax_incl currency=$currency->id}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/if}
{if $serviceProducts|count}
<div id="refund_products_tab" class="form-group table-responsive tab-pane">
<table class="table" id="customer_cart_product_details">
<thead>
<tr>
<th></th>
<th>{l s='Name'}</th>
<th>{l s='Quantity'}</th>
<th>{l s='Total Price (Tax incl.)'}</th>
</tr>
</thead>
<tbody>
{foreach from=$serviceProducts item=product}
<tr>
<td>
<input type="checkbox" name="id_service_product_order_detail[]" value="{$product.id_service_product_order_detail|escape:'html':'UTF-8'}"/>
</td>
<td><b>{$product.name|escape:'html':'UTF-8'}{if $product.option_name} : {$product.option_name|escape:'html':'UTF-8'}{/if}</b></td>
<td>{$product.quantity|escape:'html':'UTF-8'}</td>
<td>{convertPriceWithCurrency price=$product.total_price_tax_incl currency=$currency->id}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/if}
{if $bookingOrderInfo|count > 0 && $serviceProducts|count > 0}
</div>
{/if}
<div class="form-group">
<label class="control-label">{l s='Reason to Cancel'}</label>
<textarea rows="3" class="textarea-autosize cancellation_reason" name="cancellation_reason"></textarea>

View File

@@ -0,0 +1,60 @@
{*
* Since 2010 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright Since 2010 Webkul IN
* @license https://store.webkul.com/license.html
*}
<div class="modal-body">
<div id="edit_product">
<input type="hidden" id="edit_product_product_id" name="edit_product[product_id]" value="{$ServiceProductOrderDetail->id_product}" />
<input type="hidden" id="edit_product_id_service_product_order_detail" name="edit_product[id_service_product_order_detail]" value="{$ServiceProductOrderDetail->id}" />
<input type="hidden" id="edit_product_id_order" name="id_order" value="{$order->id}" />
<div class="edit_product_fields">
{hook h='displayAdminOrderEditProductFieldsBefore'}
<div class="row form-group">
<div class="col-sm-6">
<label class="control-label">{l s='Unit Price (tax excl.)'}</label>
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
<input class="form-control" type="text" name="edit_product[product_price_tax_excl]" id="edit_product_product_price_tax_excl" value="{$ServiceProductOrderDetail->unit_price_tax_excl}"/>
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign}</div>{/if}
</div>
</div>
<div class="productQuantity col-sm-6" {if !$objProduct->allow_multiple_quantity} style="display:none" {/if}>
<label class="control-label">{l s='Quantity'}</label>
<input type="number" class="form-control" name="edit_product[product_quantity]" id="edit_product_product_quantity" value="{$ServiceProductOrderDetail->quantity}" min="1"/>
</div>
</div>
<div class="product_invoice" style="display: none;">
<select name="product_invoice" class="edit_product_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" {if $invoice->id == $data.id_order_invoice}selected="selected"{/if}>
#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang, null, $order->id_shop)}{'%06d'|sprintf:$invoice->number}
</option>
{/foreach}
</select>
</div>
</div>
<button type="button" class="btn btn-default" id="submitAddProduct" disabled="disabled" style="display:none;"></button>
</div>
{if isset($loaderImg) && $loaderImg}
<div class="loading_overlay">
<img src='{$loaderImg}' class="loading-img"/>
</div>
{/if}
</div>

View File

@@ -47,10 +47,10 @@
<tbody>
{if isset($additionalServices) && $additionalServices}
{foreach $additionalServices['additional_services'] as $service}
<tr class="room_demand_block" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}">
<tr class="room_demand_block" data-id_service_product_order_detail="{$service['id_service_product_order_detail']}">
<td>
<div>{$service['name']|escape:'html':'UTF-8'}</div>
<input value="{$service['id_room_type_service_product_order_detail']|escape:'html':'UTF-8'}" name="id_service_product_order_detail[]" type="hidden"/>
<input value="{$service['id_service_product_order_detail']|escape:'html':'UTF-8'}" name="id_service_product_order_detail[]" type="hidden"/>
</td>
<td>
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
@@ -63,7 +63,7 @@
<td class="text-center">
{if $service['allow_multiple_quantity']}
<div class="qty_container">
<input type="number" class="form-control qty" min="1" data-id_product="{$service['id_product']|escape:'html':'UTF-8'}" value="{$service['quantity']|escape:'html':'UTF-8'}" name="service_qty[{$service['id_room_type_service_product_order_detail']|escape:'html':'UTF-8'}]">
<input type="number" class="form-control qty" min="1" data-id_product="{$service['id_product']|escape:'html':'UTF-8'}" value="{$service['quantity']|escape:'html':'UTF-8'}" name="service_qty[{$service['id_service_product_order_detail']|escape:'html':'UTF-8'}]">
{if $service['max_quantity']}
<p style="display:{if $service['quantity'] > $service['max_quantity']}block{else}none{/if}; margin-top: 4px;">
<span class="label label-warning">{l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']}</span>
@@ -77,7 +77,7 @@
<td>
<div class="input-group">
<span class="input-group-addon">{$currencySign}</span>
<input type="text" class="form-control unit_price" value="{Tools::ps_round($service['unit_price_tax_excl'], 2)}" data-id-product="{$service['id_product']}" name="service_price[{$service['id_room_type_service_product_order_detail']}]">
<input type="text" class="form-control unit_price" value="{Tools::ps_round($service['unit_price_tax_excl'], 2)}" data-id-product="{$service['id_product']}" name="service_price[{$service['id_service_product_order_detail']}]">
{if Product::PRICE_CALCULATION_METHOD_PER_DAY == $service.product_price_calculation_method}
<span class="input-group-addon">{l s='/ night'}</span>
{/if}
@@ -87,7 +87,7 @@
{/if} *}
</td>
<td>{displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency}</td>
<td class="text-right"><a class="btn btn-danger pull-right del_room_additional_service" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}" href="#"><i class="icon-trash"></i></a></td>
<td class="text-right"><a class="btn btn-danger pull-right del_room_additional_service" data-id_service_product_order_detail="{$service['id_service_product_order_detail']}" href="#"><i class="icon-trash"></i></a></td>
</tr>
{/foreach}
{else}
@@ -150,7 +150,7 @@
<div class="input-group">
<span class="input-group-addon">{$currencySign}</span>
<input type="text" class="form-control unit_price" name="service_price[{$product['id_product']|escape:'html':'UTF-8'}]" value="{$product['price_tax_exc']}" data-id-product="{$product.id_product}">
{if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['price_calculation_method']}
{if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['product_price_calculation_method']}
<span class="input-group-addon">{l s='/ night'}</span>
{/if}
</div>

View File

@@ -179,7 +179,7 @@ class CartCore extends ObjectModel
const ADVANCE_PAYMENT_ONLY_PRODUCTS = 10;
const ONLY_ROOMS = 11;
const ONLY_ROOM_SERVICES = 12;
const ONLY_SERVICE_PRODUCTS = 13;
const ONLY_STANDALONE_PRODUCTS = 13;
const ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE = 14;
const ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD = 16;
@@ -534,7 +534,7 @@ class CartCore extends ObjectModel
$sql = new DbQuery();
// Build SELECT
$sql->select('cp.`id_product_attribute`, cp.`id_product`, cp.`quantity` AS cart_quantity, cp.id_shop, pl.`name`, p.`is_virtual`, p.`booking_product`, p.`service_product_type`, p.`auto_add_to_cart`, p.`price_addition_type`, p.`show_at_front`, product_shop.`allow_multiple_quantity`, product_shop.`price_calculation_method`,
$sql->select('cp.`id_product_attribute`, cp.`id_product`, cp.`quantity` AS cart_quantity, cp.id_shop, pl.`name`, p.`is_virtual`, p.`booking_product`, p.`selling_preference_type`, p.`auto_add_to_cart`, p.`price_addition_type`, p.`show_at_front`, product_shop.`allow_multiple_quantity`, product_shop.`price_calculation_method`,
pl.`description_short`, pl.`available_now`, pl.`available_later`, product_shop.`id_category_default`, p.`id_supplier`,
p.`id_manufacturer`, product_shop.`on_sale`, product_shop.`ecotax`, product_shop.`additional_shipping_cost`,
product_shop.`available_for_order`, product_shop.`price`, product_shop.`active`, product_shop.`unity`, product_shop.`unit_price_ratio`,
@@ -636,7 +636,6 @@ class CartCore extends ObjectModel
}
$cart_shop_context = Context::getContext()->cloneContext();
foreach ($result as &$row) {
if (isset($row['ecotax_attr']) && $row['ecotax_attr'] > 0) {
$row['ecotax'] = (float)$row['ecotax_attr'];
@@ -759,38 +758,35 @@ class CartCore extends ObjectModel
$row['total'] = Tools::processPriceRounding($totalPriceByProductTaxExcl);
$row['total_wt'] = Tools::processPriceRounding($totalPriceByProductTaxIncl);
}
} else if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $row['service_product_type']) {
} else {
$row['total'] = 0;
$row['total_wt'] = 0;
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($servicesWithRoom = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$objServiceProductCartDetail = new ServiceProductCartDetail();
$price_tax_excl = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
(int)$row['id_product'],
0,
0,
0,
0,
0,
0,
[],
null,
$row['auto_add_to_cart'],
null,
null
)) {
foreach ($servicesWithRoom as $service) {
// Rounding as per configurations
$row['total'] += Tools::processPriceRounding($service['unit_price_tax_excl'], $service['quantity']);
$row['total_wt'] += Tools::processPriceRounding($service['unit_price_tax_incl'], $service['quantity']);
}
}
} else {
$objHotelServiceProductCartDetail = new HotelServiceProductCartDetail();
$unitPriceByProductTaxIncl = $objHotelServiceProductCartDetail->getHotelProductUnitPrice($this->id, (int)$row['id_product'], 0, true);
$unitPriceByProductTaxExcl = $objHotelServiceProductCartDetail->getHotelProductUnitPrice($this->id, (int)$row['id_product'], 0, false);
null,
$row['id_product'],
null,
false,
1
);
$price_tax_incl = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
null,
null,
null,
$row['id_product'],
null,
true,
1
);
// Rounding as per configurations
$row['total'] = Tools::processPriceRounding($unitPriceByProductTaxExcl, $row['cart_quantity']);
$row['total_wt'] = Tools::processPriceRounding($unitPriceByProductTaxIncl, $row['cart_quantity']);
$row['total'] += $price_tax_excl;
$row['total_wt'] += $price_tax_incl;
}
/*END*/
@@ -831,7 +827,7 @@ class CartCore extends ObjectModel
$serviceProducts = array();
$context = Context::getContext();
foreach ($productList as $key => $product) {
if (!$product['booking_product'] && (Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE == $product['service_product_type'])) {
if (!$product['booking_product'] && (Product::SELLING_PREFERENCE_STANDALONE == $product['selling_preference_type'])) {
if (Validate::isLoadedObject(
$objProduct = new Product($product['id_product'], false, $this->id_lang)
)) {
@@ -1565,7 +1561,7 @@ class CartCore extends ObjectModel
Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD,
Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE,
Cart::ONLY_CONVENIENCE_FEE,
Cart::ONLY_SERVICE_PRODUCTS,
Cart::ONLY_STANDALONE_PRODUCTS,
Cart::ONLY_DISCOUNTS,
Cart::BOTH,
Cart::BOTH_WITHOUT_SHIPPING,
@@ -1640,16 +1636,17 @@ class CartCore extends ObjectModel
if (Tax::excludeTaxeOption()) {
$with_taxes = false;
}
$products_total = array();
$ecotax_total = 0;
$totalDemandsPrice = 0;
$objCartBookingData = new HotelCartBookingData();
$objServiceProductCartDetail = new ServiceProductCartDetail();
$objAdvPayment = new HotelAdvancedPayment();
foreach ($products as $product) {
// skip products if selection os for only room or only normal products
if ($product['booking_product']) {
if ($type == Cart::ONLY_ROOM_SERVICES
|| $type == Cart::ONLY_SERVICE_PRODUCTS
|| $type == Cart::ONLY_STANDALONE_PRODUCTS
|| $type == Cart::ONLY_CONVENIENCE_FEE
|| $type == Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD
|| $type == Cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE
@@ -1662,15 +1659,16 @@ class CartCore extends ObjectModel
continue;
}
if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type']) {
if ($type == Cart::ONLY_SERVICE_PRODUCTS) {
if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product['selling_preference_type']
|| Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $product['selling_preference_type']
) {
if ($type == Cart::ONLY_STANDALONE_PRODUCTS && Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product['selling_preference_type']) {
continue;
}
if ($product['auto_add_to_cart']) {
if ($type == Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD) {
continue;
}
if (Product::PRICE_ADDITION_TYPE_WITH_ROOM == $product['price_addition_type']) {
if ($type == Cart::ONLY_CONVENIENCE_FEE) {
continue;
@@ -1690,8 +1688,15 @@ class CartCore extends ObjectModel
continue;
}
}
} else {
if ($type == Cart::ONLY_ROOM_SERVICES) {
} elseif (Product::SELLING_PREFERENCE_STANDALONE == $product['selling_preference_type']
|| Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $product['selling_preference_type']
) {
if ($type == Cart::ONLY_ROOM_SERVICES
|| $type == Cart::ONLY_CONVENIENCE_FEE
|| $type == Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD
|| $type == Cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE
|| $type == Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE
) {
continue;
}
}
@@ -1747,38 +1752,109 @@ class CartCore extends ObjectModel
} elseif (!isset($products_total[$id_tax_rules_group.'_'.$id_address])) {
$products_total[$id_tax_rules_group.'_'.$id_address] = 0;
}
if (!$product['booking_product'] && Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE == $product['service_product_type']) {
$objHotelServiceProductCartDetail = new HotelServiceProductCartDetail();
$price = $objHotelServiceProductCartDetail->getHotelProductUnitPrice($this->id, (int)$product['id_product'], 0, $with_taxes);
} else if (!$product['booking_product'] && Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type']) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($servicesWithRoom = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$this->id,
(int)$product['id_product'],
isset($product['id_hotel']) ? $product['id_hotel'] : 0,
0,
0,
0,
0,
0,
null,
$product['auto_add_to_cart'],
null,
null
)) {
foreach ($servicesWithRoom as $service) {
if ($with_taxes) {
$servicePrice = $service['total_price_tax_incl'];
} else {
$servicePrice = $service['total_price_tax_excl'];
if (!$product['booking_product']) {
if (Product::SELLING_PREFERENCE_STANDALONE == $product['selling_preference_type']) {
if ($servicePorducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
null,
null,
null,
(int)$product['id_product']
)) {
foreach ($servicePorducts as $servicePorduct) {
if ($with_taxes) {
$priceAdd = $servicePorduct['unit_price_tax_incl'];
} else {
$priceAdd = $servicePorduct['unit_price_tax_excl'];
}
if ($ps_round_type == Order::ROUND_TOTAL) {
$products_total[$id_tax_rules_group.'_'.$id_address] += Tools::processPriceRounding($priceAdd, (int)$servicePorduct['quantity']);
} else {
$products_total[$id_tax_rules_group] += Tools::processPriceRounding($priceAdd, (int)$servicePorduct['quantity']);
}
}
}
// Rounding as per configurations
if ($ps_round_type == Order::ROUND_TOTAL) {
$products_total[$id_tax_rules_group.'_'.$id_address] += $servicePrice;
} else {
$products_total[$id_tax_rules_group] += $servicePrice;
} else if (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $product['selling_preference_type']
|| Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $product['selling_preference_type']
) {
if ($type == Cart::ONLY_ROOM_SERVICES
|| $type == Cart::ONLY_CONVENIENCE_FEE
|| $type == Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD
|| $type == Cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE
|| $type == Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE
) {
$servicePorducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
0,
null,
null,
(int)$product['id_product']
);
} elseif ($type == Cart::ONLY_STANDALONE_PRODUCTS) {
$servicePorducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
null,
0,
null,
(int)$product['id_product']
);
} else {
$servicePorducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
isset($product['id_hotel']) ? $product['id_hotel'] : null,
null,
null,
(int)$product['id_product']
);
}
if ($servicePorducts) {
foreach ($servicePorducts as $servicePorduct) {
if ($with_taxes) {
$priceAdd = $servicePorduct['unit_price_tax_incl'];
} else {
$priceAdd = $servicePorduct['unit_price_tax_excl'];
}
if ($ps_round_type == Order::ROUND_TOTAL) {
$products_total[$id_tax_rules_group.'_'.$id_address] += Tools::processPriceRounding($priceAdd, (int)$servicePorduct['quantity']);
} else {
$products_total[$id_tax_rules_group] += Tools::processPriceRounding($priceAdd, (int)$servicePorduct['quantity']);
}
}
}
} else if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product['selling_preference_type']) {
if ($servicesWithRoom = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
0,
null,
null,
(int)$product['id_product'],
null,
null,
0,
(int)$product['auto_add_to_cart'],
(int)$product['price_addition_type']
)) {
foreach ($servicesWithRoom as $service) {
if ($with_taxes) {
$servicePrice = $service['total_price_tax_incl'];
} else {
$servicePrice = $service['total_price_tax_excl'];
}
// Rounding as per configurations
if ($ps_round_type == Order::ROUND_TOTAL) {
$products_total[$id_tax_rules_group.'_'.$id_address] += $servicePrice;
} else {
$products_total[$id_tax_rules_group] += $servicePrice;
}
}
}
}
@@ -1814,7 +1890,6 @@ class CartCore extends ObjectModel
// If customer has selected advance payment of the cart
if ($type == Cart::ADVANCE_PAYMENT || $type == Cart::ADVANCE_PAYMENT_ONLY_PRODUCTS) {
$objAdvPayment = new HotelAdvancedPayment();
$advProductPrice = $objAdvPayment->getProductMinAdvPaymentAmountByIdCart(
$this->id,
$cartRoomInfo['id_product'],
@@ -1841,7 +1916,6 @@ class CartCore extends ObjectModel
// price of extra demands on room type in the cart
$totalDemandsPrice += $objCartBookingData->getCartExtraDemands($this->id, $product['id_product'], 0, 0, 0, 1, 0, (int)$with_taxes);
}
foreach ($products_total as $key => $price) {
$order_total += $price;
}
@@ -1883,7 +1957,7 @@ class CartCore extends ObjectModel
Cart::ONLY_ROOMS,
Cart::ADVANCE_PAYMENT_ONLY_PRODUCTS,
Cart::ONLY_ROOM_SERVICES,
Cart::ONLY_SERVICE_PRODUCTS,
Cart::ONLY_STANDALONE_PRODUCTS,
Cart::ONLY_CONVENIENCE_FEE,
Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD,
Cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE,
@@ -2306,10 +2380,9 @@ class CartCore extends ObjectModel
// Step 6 : Break $package_list hotel wise
$orderPackage = array();
$serviceProducts = array();
$standaloneProduct = array();
$objRoomType = new HotelRoomType();
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$objHotelServiceProductCartDetail = new HotelServiceProductCartDetail();
$objServiceProductCartDetail = new ServiceProductCartDetail();
foreach ($final_package_list as $id_address => $packages) {
foreach ($packages as $id_package => $package) {
foreach ($package['product_list'] as $product) {
@@ -2339,19 +2412,32 @@ class CartCore extends ObjectModel
}
}
} else {
if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type']) {
if ($selectedServiceProducts = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart($this->id, $product['id_product'], 0, 0, 0, 0, 0, 0, null, null)) {
if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product['selling_preference_type']
|| Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $product['selling_preference_type']
) {
// get standard products which are booked for room types
// send id_hotel = 0 for standard products with room types
if ($selectedServiceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
0,
null,
null,
$product['id_product']
)) {
$array = array();
foreach($selectedServiceProducts as $selectedProduct) {
if (isset($array[$selectedProduct['id_hotel']])) {
$array[$selectedProduct['id_hotel']]['total_price_tax_excl'] += $selectedProduct['total_price_tax_excl'];
$array[$selectedProduct['id_hotel']]['total_price_tax_incl'] += $selectedProduct['total_price_tax_incl'];
if (isset($array[$selectedProduct['id_room_type_hotel']])) {
$array[$selectedProduct['id_room_type_hotel']]['total_price_tax_excl'] += $selectedProduct['total_price_tax_excl'];
$array[$selectedProduct['id_room_type_hotel']]['total_price_tax_incl'] += $selectedProduct['total_price_tax_incl'];
} else {
$array[$selectedProduct['id_hotel']] = array(
$array[$selectedProduct['id_room_type_hotel']] = array(
'quantity' => 0,
'id_hotel' => $selectedProduct['id_hotel'],
'id_hotel' => $selectedProduct['id_room_type_hotel'],
'total_price_tax_excl' => $selectedProduct['total_price_tax_excl'],
'total_price_tax_incl' => $selectedProduct['total_price_tax_incl'],
'id_room_type' => $selectedProduct['id_room_type'],
'id_hotel_cart_booking' => $selectedProduct['id_hotel_cart_booking'],
);
}
if (Product::PRICE_CALCULATION_METHOD_PER_DAY == $selectedProduct['price_calculation_method']) {
@@ -2359,9 +2445,9 @@ class CartCore extends ObjectModel
$selectedProduct['date_from'],
$selectedProduct['date_to']
);
$array[$selectedProduct['id_hotel']]['quantity'] += ($selectedProduct['quantity'] * $numDays);
$array[$selectedProduct['id_room_type_hotel']]['quantity'] += ($selectedProduct['quantity'] * $numDays);
} else {
$array[$selectedProduct['id_hotel']]['quantity'] += $selectedProduct['quantity'];
$array[$selectedProduct['id_room_type_hotel']]['quantity'] += $selectedProduct['quantity'];
}
}
@@ -2370,10 +2456,14 @@ class CartCore extends ObjectModel
$product['cart_quantity'] = $selectedProduct['quantity'];
$product['total'] = $selectedProduct['total_price_tax_excl'];
$product['total_wt'] = $selectedProduct['total_price_tax_incl'];
$product['price_wt'] = $selectedProduct['total_price_tax_incl'] / $product['cart_quantity'];
$product['price'] = $selectedProduct['total_price_tax_excl'] / $product['cart_quantity'];
$product['price_wt'] = $selectedProduct['total_price_tax_incl'] / $selectedProduct['quantity'];
$product['price'] = $selectedProduct['total_price_tax_excl'] / $selectedProduct['quantity'];
$product['id_hotel'] = $selectedProduct['id_hotel'];
$orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $product;
$product['id_room_type'] = $selectedProduct['id_room_type'];
$product['id_hotel_cart_booking'] = $selectedProduct['id_hotel_cart_booking'];
$productinfo = $product;
$productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
$orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $productinfo;
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'] = $selectedProduct['id_hotel'];
}
@@ -2395,32 +2485,83 @@ class CartCore extends ObjectModel
}
}
}
} else {
if ($selectedServiceProducts = $objHotelServiceProductCartDetail->getHotelProducts($this->id, $product
['id_product'])) {
}
if (Product::SELLING_PREFERENCE_STANDALONE == $product['selling_preference_type']) {
if (!isset($standaloneProduct[$id_address])) {
$standaloneProduct[$id_address] = array(
'product_list' => array(),
'warehouse_list' => $package['warehouse_list'],
'carrier_list' => $product['carrier_list'],
'id_warehouse' => $package['id_warehouse'],
'id_carrier' => isset($package['id_carrier']) ? $package['id_carrier'] : 0
);
}
$standaloneProduct[$id_address]['product_list'][] = $product;
}
if (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $product['selling_preference_type']
|| Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $product['selling_preference_type']
) {
if ($selectedServiceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
null,
0,
null,
(int)$product['id_product']
)) {
$array = array();
foreach($selectedServiceProducts as $hotelProduct) {
if (isset($array[$hotelProduct['id_hotel']])) {
$array[$hotelProduct['id_hotel']]['total_price_tax_excl'] += $hotelProduct['total_price_tax_excl'];
$array[$hotelProduct['id_hotel']]['total_price_tax_incl'] += $hotelProduct['total_price_tax_incl'];
$array[$hotelProduct['id_hotel']]['quantity'] += $hotelProduct['quantity'];
} else {
$array[$hotelProduct['id_hotel']] = array(
'quantity' => $hotelProduct['quantity'],
'id_hotel' => $hotelProduct['id_hotel'],
'total_price_tax_excl' => $hotelProduct['total_price_tax_excl'],
'total_price_tax_incl' => $hotelProduct['total_price_tax_incl'],
'id_room_type' => $hotelProduct['id_room_type'],
'id_hotel_cart_booking' => $hotelProduct['id_hotel_cart_booking'],
);
}
}
foreach($array as $hotelProduct) {
$serviceProduct = $product;
$serviceProduct['cart_quantity'] = $hotelProduct['quantity'];
$unitPrice = $objHotelServiceProductCartDetail->getHotelProductUnitPrice($this->id, $product['id_product'], $hotelProduct['id_hotel'], false);
$unitPriceWt = $objHotelServiceProductCartDetail->getHotelProductUnitPrice($this->id, $product['id_product'], $hotelProduct['id_hotel'], true);
$serviceProduct['total'] = $unitPrice * $hotelProduct['quantity'];
$serviceProduct['total_wt'] = $unitPriceWt * $hotelProduct['quantity'];
$serviceProduct['price'] = $unitPrice;
$serviceProduct['price_wt'] = $unitPriceWt;
$serviceProduct['id_hotel'] = $hotelProduct['id_hotel'];
$serviceProduct['total'] = $hotelProduct['total_price_tax_excl'];
$serviceProduct['total_wt'] = $hotelProduct['total_price_tax_incl'];
$serviceProduct['price'] = $hotelProduct['total_price_tax_excl'] / $hotelProduct['quantity'];
$serviceProduct['price_wt'] = $hotelProduct['total_price_tax_incl'] / $hotelProduct['quantity'];
$serviceProduct['id_room_type'] = $hotelProduct['id_room_type'];
$serviceProduct['id_hotel_cart_booking'] = $hotelProduct['id_hotel_cart_booking'];
// if (!empty($hotelProducts['products'])) {
// foreach($hotelProducts['products'] as $hotelProduct) {
$serviceProducts[$id_address][$hotelProduct['id_hotel']] = array(
'product_list' => array(
$serviceProduct
),
'id_hotel' => $hotelProduct['id_hotel'],
'warehouse_list' => $package['warehouse_list'],
'carrier_list' => $product['carrier_list'],
'id_warehouse' => $package['id_warehouse'],
'id_carrier' => isset($package['id_carrier']) ? $package['id_carrier'] : 0
);
// }
// }
$productinfo = $serviceProduct;
$productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_HOTEL_STANDALONE;
$orderPackage[$id_address][$hotelProduct['id_hotel']]['product_list'][] = $productinfo;
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'] = $hotelProduct['id_hotel'];
}
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = $product['carrier_list'];
} else {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'], $product['carrier_list']);
}
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list'];
}
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse'];
}
if (isset($package['id_carrier'])) {
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'] = $package['id_carrier'];
}
}
}
}
}
@@ -2431,13 +2572,9 @@ class CartCore extends ObjectModel
$hotelWisePackageList = array();
$numHotels = 0;
if (!empty($serviceProducts)) {
foreach ($serviceProducts as $id_address => $packagesByHotels) {
foreach ($packagesByHotels as $packageByHotel) {
$hotelWisePackageList[$id_address][] = $packageByHotel;
}
if (!empty($standaloneProduct)) {
foreach ($standaloneProduct as $id_address => $packagesByAddress) {
$hotelWisePackageList[$id_address][] = $packagesByAddress;
}
}
foreach ($orderPackage as $id_address => $packageByAddress) {
@@ -2446,39 +2583,7 @@ class CartCore extends ObjectModel
$hotelWisePackageList[$id_address][] = $package;
}
}
// add sevice products as new package if there are multiple hotels in cart
// if ($numHotels > 1 || count($serviceProducts) > 1) {
// foreach ($serviceProducts as $productsByAddress) {
// if (isset($orderPackage[$id_address])) {
// $hotelWisePackageList[$id_address][] = array(
// 'product_list' => $productsByAddress['products'],
// 'carrier_list' => $productsByAddress['carrier_list'],
// 'warehouse_list' => $productsByAddress['warehouse_list'],
// 'id_warehouse' => $productsByAddress['id_warehouse'],
// 'id_carrier' => $productsByAddress['id_carrier']
// );
// }
// }
// } else if (!empty($serviceProducts)) {
// $serviceProductsIdAddress = array_keys($serviceProducts)[0];
// $productsByAddress = array_shift($serviceProducts);
// if (isset($hotelWisePackageList[$serviceProductsIdAddress])) {
// $hotelWisePackageList[$serviceProductsIdAddress][0]['product_list'] = array_merge(
// $hotelWisePackageList[$serviceProductsIdAddress][0]['product_list'],
// $productsByAddress['products']
// );
// } else {
// $hotelWisePackageList[$id_address][] = array(
// 'product_list' => $productsByAddress['products'],
// 'carrier_list' => $productsByAddress['carrier_list'],
// 'warehouse_list' => $productsByAddress['warehouse_list'],
// 'id_warehouse' => $productsByAddress['id_warehouse'],
// 'id_carrier' => $productsByAddress['id_carrier']
// );
// }
// }
$final_package_list = $hotelWisePackageList;
// END $package_list hotel wise
$cache[$cache_key] = $final_package_list;
@@ -3011,15 +3116,49 @@ class CartCore extends ObjectModel
return $collection;
}
public static function getIdAddressForTaxCalculation($id_product, $id_hotel = false)
// Get the id_address for tax calculation of a product
public static function getIdAddressForTaxCalculation($id_product, $id_hotel = false, $id_product_room_type = false)
{
$id_address = 0;
// if the product is a booking product/Room type
if (Product::isBookingProduct($id_product)) {
return HotelRoomType::getHotelIdAddressByIdProduct($id_product);
} else if ($id_hotel) {
$addressInfo = HotelBranchInformation::getAddress($id_hotel);
return $addressInfo['id_address'];
$id_address = HotelRoomType::getHotelIdAddressByIdProduct($id_product);
} else {
// if the product is a standard product the get the address as per the selling preference
$sellingPreferenceType = Product::getSellingPreferenceType($id_product);
if ($sellingPreferenceType == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) {
if ($id_product_room_type) {
$objRoomType = new HotelRoomType();
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($id_product_room_type)) {
if ($htlAddress = HotelBranchInformation::getAddress($roomTypeInfo['id_hotel'])) {
$id_address = $htlAddress['id_address'];
}
}
}
} elseif ($sellingPreferenceType == Product::SELLING_PREFERENCE_HOTEL_STANDALONE) {
if ($htlAddress = HotelBranchInformation::getAddress($id_hotel)) {
$id_address = $htlAddress['id_address'];
}
} elseif ($sellingPreferenceType == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE) {
if ($htlAddress = HotelBranchInformation::getAddress($id_hotel)) {
$id_address = $htlAddress['id_address'];
} elseif ($id_product_room_type) {
$objRoomType = new HotelRoomType();
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($id_product_room_type)) {
if ($htlAddress = HotelBranchInformation::getAddress($roomTypeInfo['id_hotel'])) {
$id_address = $htlAddress['id_address'];
}
}
}
} elseif ($sellingPreferenceType == Product::SELLING_PREFERENCE_STANDALONE) {
if (isset($id_customer)) {
$id_address = (int)Address::getFirstCustomerAddressId($id_customer);
}
}
}
return false;
return $id_address;
}
/**
@@ -3672,8 +3811,8 @@ class CartCore extends ObjectModel
$convenience_fee_wt = $this->getOrderTotal(true, Cart::ONLY_CONVENIENCE_FEE);
$convenience_fee = $this->getOrderTotal(false, Cart::ONLY_CONVENIENCE_FEE);
$convenience_fee_tax = $convenience_fee_wt - $convenience_fee;
$total_service_products_wt = $this->getOrderTotal(true, Cart::ONLY_SERVICE_PRODUCTS);
$total_service_products = $this->getOrderTotal(false, Cart::ONLY_SERVICE_PRODUCTS);
$total_standalone_service_products_wt = $this->getOrderTotal(true, Cart::ONLY_STANDALONE_PRODUCTS);
$total_standalone_service_products = $this->getOrderTotal(false, Cart::ONLY_STANDALONE_PRODUCTS);
$total_discounts = $this->getOrderTotal(true, Cart::ONLY_DISCOUNTS);
$total_discounts_tax_exc = $this->getOrderTotal(false, Cart::ONLY_DISCOUNTS);
$objCartBookingData = new HotelCartBookingData();
@@ -3783,8 +3922,8 @@ class CartCore extends ObjectModel
}
$objHotelAdvancedPayment = new HotelAdvancedPayment();
$total_rooms_with_services_without_discount_te = $total_rooms + $total_demands + $total_additional_services + $total_additional_services_auto_add;
$total_rooms_with_services_without_discount_ti = $total_rooms_wt + $total_demands_wt + $total_additional_services_wt + $total_additional_services_auto_add_wt;
$total_rooms_with_services_without_discount_te = $total_rooms + $total_demands + $total_additional_services + $total_additional_services_auto_add + $total_standalone_service_products;
$total_rooms_with_services_without_discount_ti = $total_rooms_wt + $total_demands_wt + $total_additional_services_wt + $total_additional_services_auto_add_wt + $total_standalone_service_products_wt;
$cart_total_without_discount_te = $total_rooms_with_services_without_discount_te + $convenience_fee;
$cart_total_without_discount_ti = $total_rooms_with_services_without_discount_ti + $convenience_fee_wt;
@@ -3820,8 +3959,8 @@ class CartCore extends ObjectModel
'convenience_fee_wt' => $convenience_fee_wt,
'convenience_fee' => $convenience_fee,
'convenience_fee_tax' => $convenience_fee_tax,
'total_service_products_wt' => $total_service_products_wt,
'total_service_products' => $total_service_products,
'total_standalone_service_products_wt' => $total_standalone_service_products_wt,
'total_standalone_service_products' => $total_standalone_service_products,
'total_extra_demands_wt' => $total_demands_wt,
'total_extra_demands' => $total_demands,
'total_price' => $base_total_tax_inc,
@@ -3840,7 +3979,6 @@ class CartCore extends ObjectModel
'cart_total_without_discount_ti' => $cart_total_without_discount_ti,
'total_tax_without_discount' => $total_tax_without_discount
);
$hook = Hook::exec('actionCartSummary', $summary, null, true);
if (is_array($hook)) {
$summary = array_merge($summary, array_shift($hook));

View File

@@ -24,6 +24,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
use Twig\Node\Expression\Binary\AddBinary;
abstract class PaymentModuleCore extends Module
{
const DEBUG_MODE = false;
@@ -286,9 +288,13 @@ abstract class PaymentModuleCore extends Module
$order->id_customer = (int)$this->context->cart->id_customer;
$order->id_address_invoice = (int)$this->context->cart->id_address_invoice;
$order->id_address_delivery = (int)$id_address;
$addressInfo = HotelBranchInformation::getAddress($package['id_hotel']);
if (isset($package['id_hotel']) && $package['id_hotel']) {
$addressInfo = HotelBranchInformation::getAddress($package['id_hotel']);
$order->id_address_tax = $addressInfo['id_address'];
} else {
$order->id_address_tax = $order->id_address_invoice;
}
$order->id_address_tax = $addressInfo['id_address'];
$order->id_currency = $this->context->currency->id;
$order->id_lang = (int)$this->context->cart->id_lang;
$order->id_cart = (int)$this->context->cart->id;
@@ -495,14 +501,14 @@ abstract class PaymentModuleCore extends Module
// Make sure CartRule caches are empty
CartRule::cleanCache();
$objRoomType = new HotelRoomType();
$objMail = new Mail();
$objServiceProductCartDetail = new ServiceProductCartDetail();
$cart_rules = $this->context->cart->getCartRules();
foreach ($order_detail_list as $key => $order_detail) {
/** @var OrderDetail $order_detail */
$order = $order_list[$key];
if (!$order_creation_failed && isset($order->id)) {
// first set if_hotel as 0 and get the hotel id from room type info -> below
$idHotel = 0;
if (!$secure_key) {
$message .= '<br />'.Tools::displayError('Warning: the secure key is empty, check your payment account before validation');
}
@@ -581,13 +587,13 @@ abstract class PaymentModuleCore extends Module
if (!$product['is_virtual']) {
$virtual_product &= false;
}
// If id_hotel is not available then find id_hotel for sending mails hotel wise
if (!$idHotel) {
if ($roomDetail = $objRoomType->getRoomTypeInfoByIdProduct((int)$product['id_product'])) {
$idHotel = $roomDetail['id_hotel'];
}
}
if (!$product['booking_product'] && $product['service_product_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
if (!$product['booking_product']
&& ($product['selling_preference_type'] == Product::SELLING_PREFERENCE_STANDALONE
|| $product['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE
|| $product['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE
)
) {
$cover_image_arr = $objProduct->getCover($product['id_product']);
if (!empty($cover_image_arr)) {
@@ -596,7 +602,18 @@ abstract class PaymentModuleCore extends Module
$cover_img = $this->context->link->getImageLink($product['link_rewrite'], $this->context->language->iso_code."-default", 'small_default');
}
$product_var_tpl['cover_img'] = $cover_img;
$orderServiceProducts[] = $product_var_tpl;
$serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$order->id_cart,
[],
null,
0,
null,
$product['id_product']
);
foreach ($serviceProducts as $serviceProduct) {
$orderServiceProducts[] = array_merge($product_var_tpl, $serviceProduct);
}
}
} // end foreach ($products)
@@ -727,7 +744,11 @@ abstract class PaymentModuleCore extends Module
$maxOverbookingCount = 0;
foreach ($order->product_list as $product) {
$idProduct = $product['id_product'];
$cartBookingData = $objCartBookingData->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $idProduct);
$cartBookingData = $objCartBookingData->getOnlyCartBookingData(
$this->context->cart->id,
$this->context->cart->id_guest,
$idProduct
);
if ($cartBookingData) {
foreach ($cartBookingData as $bookingInfo) {
$objCartBookingData = new HotelCartBookingData($bookingInfo['id']);
@@ -939,45 +960,162 @@ abstract class PaymentModuleCore extends Module
$normalProducts[] = $product;
}
}
if (!empty($normalProducts)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$objServiceProductCartDetail = new ServiceProductCartDetail();
foreach($normalProducts as $product) {
$idProduct = $product['id_product'];
if ($cartAdditialServices = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
$product['id_product'],
isset($product['id_hotel']) ? $product['id_hotel'] : 0,
0,
0,
0,
0,
0,
null,
null
)) {
$idOrderDetail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id);
foreach ($cartAdditialServices as $additionalService) {
$roomBookingDetail = $objBookingDetail->getRowByIdOrderIdProductInDateRange(
$order->id,
$additionalService['room_type_id_product'],
$additionalService['date_from'],
$additionalService['date_to'],
$additionalService['id_room']
);
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objRoomTypeServiceProductOrderDetail->id_product = $idProduct;
$objRoomTypeServiceProductOrderDetail->id_order = $order->id;
$objRoomTypeServiceProductOrderDetail->id_order_detail = $idOrderDetail;
$objRoomTypeServiceProductOrderDetail->id_cart = $this->context->cart->id;
$objRoomTypeServiceProductOrderDetail->id_htl_booking_detail = $roomBookingDetail['id'];
$objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = $additionalService['unit_price_tax_excl'];
$objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = $additionalService['unit_price_tax_incl'];
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $additionalService['total_price_tax_excl'];
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $additionalService['total_price_tax_incl'];
$objRoomTypeServiceProductOrderDetail->name = $product['name'];
$objRoomTypeServiceProductOrderDetail->quantity = $additionalService['quantity'];
$objRoomTypeServiceProductOrderDetail->auto_added = $additionalService['auto_add_to_cart'];
$objRoomTypeServiceProductOrderDetail->save();
if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product['selling_preference_type']) {
if ($roomTypeServices = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[],
0,
null,
null,
$product['id_product']
)) {
$idOrderDetail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id, $product['selling_preference_type']);
foreach ($roomTypeServices as $roomTypeService) {
$roomBookingDetail = $objBookingDetail->getRowByIdOrderIdProductInDateRange(
$order->id,
$roomTypeService['id_room_type'],
$roomTypeService['date_from'],
$roomTypeService['date_to'],
$roomTypeService['id_room']
);
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objServiceProductOrderDetail->id_product = $idProduct;
$objServiceProductOrderDetail->id_order = $order->id;
$objServiceProductOrderDetail->id_order_detail = $idOrderDetail;
$objServiceProductOrderDetail->id_cart = $this->context->cart->id;
$objServiceProductOrderDetail->id_htl_booking_detail = $roomBookingDetail['id'];
$objServiceProductOrderDetail->unit_price_tax_excl = $roomTypeService['unit_price_tax_excl'];
$objServiceProductOrderDetail->unit_price_tax_incl = $roomTypeService['unit_price_tax_incl'];
$objServiceProductOrderDetail->total_price_tax_excl = $roomTypeService['total_price_tax_excl'];
$objServiceProductOrderDetail->total_price_tax_incl = $roomTypeService['total_price_tax_incl'];
$objServiceProductOrderDetail->name = $product['name'];
$objServiceProductOrderDetail->quantity = $roomTypeService['quantity'];
$objServiceProductOrderDetail->auto_added = $product['auto_add_to_cart'];
$objServiceProductOrderDetail->save();
}
}
} elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $product['selling_preference_type']) {
if ($hotelProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[],
$product['id_hotel'],
0,
null,
$product['id_product']
)) {
$idOrderDetail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id, $product['selling_preference_type']);
foreach ($hotelProducts as $hotelProduct) {
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objServiceProductOrderDetail->id_product = $idProduct;
$objServiceProductOrderDetail->id_product_option = $hotelProduct['id_product_option'];
$objServiceProductOrderDetail->id_order = $order->id;
$objServiceProductOrderDetail->id_order_detail = $idOrderDetail;
$objServiceProductOrderDetail->id_cart = $this->context->cart->id;
$objServiceProductOrderDetail->unit_price_tax_excl = $hotelProduct['unit_price_tax_excl'];
$objServiceProductOrderDetail->unit_price_tax_incl = $hotelProduct['unit_price_tax_incl'];
$objServiceProductOrderDetail->total_price_tax_excl = $hotelProduct['total_price_tax_excl'];
$objServiceProductOrderDetail->total_price_tax_incl = $hotelProduct['total_price_tax_incl'];
$objServiceProductOrderDetail->name = $hotelProduct['name'];
$objServiceProductOrderDetail->option_name = $hotelProduct['option_name'];
$objServiceProductOrderDetail->id_hotel = $product['id_hotel'];
if (Validate::isLoadedObject(
$objHotelBranch = new HotelBranchInformation($product['id_hotel'], $this->context->cart->id_lang)
)) {
$objServiceProductOrderDetail->hotel_name = $objHotelBranch->hotel_name;
}
$objServiceProductOrderDetail->quantity = $hotelProduct['quantity'];
$objServiceProductOrderDetail->save();
}
}
} elseif (Product::SELLING_PREFERENCE_STANDALONE == $product['selling_preference_type']) {
if ($standaloneProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[Product::SELLING_PREFERENCE_STANDALONE],
null,
null,
null,
$product['id_product']
)) {
$idOrderDetail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id, $product['selling_preference_type']);
foreach ($standaloneProducts as $standaloneProduct) {
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objServiceProductOrderDetail->id_product = $idProduct;
$objServiceProductOrderDetail->id_product_option = $standaloneProduct['id_product_option'];
$objServiceProductOrderDetail->id_order = $order->id;
$objServiceProductOrderDetail->id_order_detail = $idOrderDetail;
$objServiceProductOrderDetail->id_cart = $this->context->cart->id;
$objServiceProductOrderDetail->unit_price_tax_excl = $standaloneProduct['unit_price_tax_excl'];
$objServiceProductOrderDetail->unit_price_tax_incl = $standaloneProduct['unit_price_tax_incl'];
$objServiceProductOrderDetail->total_price_tax_excl = $standaloneProduct['total_price_tax_excl'];
$objServiceProductOrderDetail->total_price_tax_incl = $standaloneProduct['total_price_tax_incl'];
$objServiceProductOrderDetail->name = $standaloneProduct['name'];
$objServiceProductOrderDetail->option_name = $standaloneProduct['option_name'];
$objServiceProductOrderDetail->quantity = $standaloneProduct['quantity'];
$objServiceProductOrderDetail->save();
}
}
} elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $product['selling_preference_type']) {
$idProductRoomType = null;
$idProductHotel = null;
if (isset($product['id_room_type']) && $product['id_room_type']) {
$idProductRoomType = $product['id_room_type'];
} elseif (isset($product['id_hotel']) && $product['id_hotel']) {
$idProductHotel = $product['id_hotel'];
}
if ($serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[],
$idProductHotel,
null,
$idProductRoomType,
$product['id_product']
)) {
foreach ($serviceProducts as $serviceProduct) {
if ($serviceProduct['id_hotel']) {
$idOrderDetail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id, Product::SELLING_PREFERENCE_HOTEL_STANDALONE);
} else {
$idOrderDetail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
}
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objServiceProductOrderDetail->id_product = $idProduct;
$objServiceProductOrderDetail->id_order = $order->id;
$objServiceProductOrderDetail->id_order_detail = $idOrderDetail;
$objServiceProductOrderDetail->id_cart = $this->context->cart->id;
$objServiceProductOrderDetail->unit_price_tax_excl = $serviceProduct['unit_price_tax_excl'];
$objServiceProductOrderDetail->unit_price_tax_incl = $serviceProduct['unit_price_tax_incl'];
$objServiceProductOrderDetail->total_price_tax_excl = $serviceProduct['total_price_tax_excl'];
$objServiceProductOrderDetail->total_price_tax_incl = $serviceProduct['total_price_tax_incl'];
$objServiceProductOrderDetail->name = $product['name'];
$objServiceProductOrderDetail->quantity = $serviceProduct['quantity'];
$objServiceProductOrderDetail->id_product_option = $serviceProduct['id_product_option'];
$objServiceProductOrderDetail->option_name = $serviceProduct['option_name'];
if ($serviceProduct['id_hotel']) {
$objServiceProductOrderDetail->id_hotel = $serviceProduct['id_hotel'];
if (Validate::isLoadedObject(
$objHotelBranch = new HotelBranchInformation($serviceProduct['id_hotel'], $this->context->cart->id_lang)
)) {
$objServiceProductOrderDetail->hotel_name = $objHotelBranch->hotel_name;
}
} else {
$roomBookingDetail = $objBookingDetail->getRowByIdOrderIdProductInDateRange(
$order->id,
$serviceProduct['id_room_type'],
$serviceProduct['date_from'],
$serviceProduct['date_to'],
$serviceProduct['id_room']
);
$objServiceProductOrderDetail->id_htl_booking_detail = $roomBookingDetail['id'];
$objServiceProductOrderDetail->auto_added = $product['auto_add_to_cart'];
}
$objServiceProductOrderDetail->save();
}
}
}
}
@@ -1079,46 +1217,89 @@ abstract class PaymentModuleCore extends Module
// changing mail format
$cart_booking_data = $this->cartBookingDataForMail($order);
$cart_booking_data_text = $this->getEmailTemplateContent('hotel-booking-cart-data-text.tpl', Mail::TYPE_TEXT, $cart_booking_data['cart_htl_data']);
$cart_booking_data_html = $this->getEmailTemplateContent('hotel-booking-cart-data.tpl', Mail::TYPE_HTML, $cart_booking_data['cart_htl_data']);
$cart_booking_data_text = $this->getEmailTemplateContent('hotel_booking_cart_data_text.tpl', Mail::TYPE_TEXT, $cart_booking_data['cart_htl_data']);
$cart_booking_data_html = $this->getEmailTemplateContent('hotel_booking_cart_data.tpl', Mail::TYPE_HTML, $cart_booking_data['cart_htl_data']);
$extra_demands_details_html = $this->getEmailTemplateContent('booking_extra_demands.tpl', Mail::TYPE_HTML, $cart_booking_data['cart_htl_data']);
$extra_demands_details_text = $this->getEmailTemplateContent('booking_extra_demands_text.tpl', Mail::TYPE_HTML, $cart_booking_data['cart_htl_data']);
$extra_demands_details_text = $this->getEmailTemplateContent('booking_extra_demands_text.tpl', Mail::TYPE_TEXT, $cart_booking_data['cart_htl_data']);
$normal_products_data_html = $this->getEmailTemplateContent('hotel-service-product-data.tpl', Mail::TYPE_TEXT, $orderServiceProducts);
$normal_products_data_txt = $this->getEmailTemplateContent('hotel-service-product-data-text.tpl', Mail::TYPE_TEXT, $orderServiceProducts);
$normal_products_data_html = $this->getEmailTemplateContent('service_product_data.tpl', Mail::TYPE_HTML, $orderServiceProducts);
$normal_products_data_txt = $this->getEmailTemplateContent('service_product_data_text.tpl', Mail::TYPE_TEXT, $orderServiceProducts);
// get order total information html/txt files
// total room price
$room_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, true) + $order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
$room_price_tax_incl = $order->getTotalProductsWithTaxes(false, true) + $order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
$room_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, true) + $order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
$room_price_tax_incl = $order->getTotalProductsWithTaxes(false, true) + $order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
$room_tax = ($room_price_tax_incl - $room_price_tax_excl);
// extra services
$additional_service_price_tax_excl = ($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0) + $cart_booking_data['total_extra_demands_te']);
$additional_service_price_tax_incl = ($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0) + $cart_booking_data['total_extra_demands_ti']);
$additional_service_price_tax_excl = ($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0) + $cart_booking_data['total_extra_demands_te']);
$additional_service_price_tax_incl = ($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0) + $cart_booking_data['total_extra_demands_ti']);
$additional_service_tax = ($additional_service_price_tax_incl - $additional_service_price_tax_excl);
// convenience fee price
$total_convenience_fee_ti = $order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
$total_convenience_fee_te = $order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
$total_convenience_fee_ti = $order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
$total_convenience_fee_te = $order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
$total_convenience_fee_tax = $total_convenience_fee_ti - $total_convenience_fee_te;
// service products
// $service_products_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
// $service_products_price_tax_incl = $order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
// $service_products_tax = ($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) - $order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE));
$total_order_tax = $room_tax + $additional_service_tax + $total_convenience_fee_tax;
$standalone_products_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE);
$standalone_products_price_tax_incl = $order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE);
$hotel_standalone_products_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE);
$hotel_standalone_products_price_tax_incl = $order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE);
$idOrderHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id);
$objHotelBranchInfo = new HotelBranchInformation($idOrderHotel, $order->id_lang);
$service_products_tax = ($standalone_products_price_tax_incl + $hotel_standalone_products_price_tax_incl) - ($standalone_products_price_tax_excl + $hotel_standalone_products_price_tax_excl);
$total_order_tax = $room_tax + $additional_service_tax + $total_convenience_fee_tax + $service_products_tax;
$total_products = Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $order->total_products : $order->total_products_wt, $this->context->currency, false);
$orderTotalData = array(
'room_price_tax_excl' => Tools::displayPrice($room_price_tax_excl, $this->context->currency, false),
'room_price_tax_incl' => Tools::displayPrice($room_price_tax_incl, $this->context->currency, false),
'room_tax' => Tools::displayPrice($room_tax, $this->context->currency, false),
'additional_service_price_tax_excl' => Tools::displayPrice($additional_service_price_tax_excl, $this->context->currency, false),
'additional_service_price_tax_incl' => Tools::displayPrice($additional_service_price_tax_incl, $this->context->currency, false),
'additional_service_tax' => Tools::displayPrice($additional_service_tax, $this->context->currency, false),
'total_convenience_fee_ti' => Tools::displayPrice($total_convenience_fee_ti, $this->context->currency, false),
'total_convenience_fee_te' => Tools::displayPrice($total_convenience_fee_te, $this->context->currency, false),
'total_convenience_fee_tax' => Tools::displayPrice($total_convenience_fee_tax, $this->context->currency, false),
'service_products_price_tax_excl' => Tools::displayPrice(
($standalone_products_price_tax_excl + $hotel_standalone_products_price_tax_excl),
$this->context->currency,
false
),
'service_products_price_tax_incl' => Tools::displayPrice(
($standalone_products_price_tax_incl + $hotel_standalone_products_price_tax_incl),
$this->context->currency,
false
),
'service_products_tax' => Tools::displayPrice($service_products_tax, $this->context->currency, false),
'total_order_tax' => Tools::displayPrice($total_order_tax, $this->context->currency, false),
'total_paid' => Tools::displayPrice($order->total_paid, $this->context->currency, false),
'total_products' => Tools::displayPrice($total_products, $this->context->currency, false),
'total_discounts' => Tools::displayPrice(-$order->total_discounts, $this->context->currency, false),
'has_standalone_products' => $orderServiceProducts,
'has_room_bookings' => $cart_booking_data['cart_htl_data']
);
$order_total_info_html = $this->getEmailTemplateContent('order_conf_total_info.tpl', Mail::TYPE_HTML, $orderTotalData);
$order_total_info_txt = $this->getEmailTemplateContent('order_conf_total_info_text.tpl', Mail::TYPE_TEXT, $orderTotalData);
$hotelName = '';
if ($idOrderHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) {
$objHotelBranchInfo = new HotelBranchInformation($idOrderHotel, $order->id_lang);
$hotelName = $objHotelBranchInfo->hotel_name;
}
$data = array(
'{hotel_name}' => $objHotelBranchInfo->hotel_name,
'{cart_booking_data_html}' => $cart_booking_data_html,
'{cart_booking_data_text}' => $cart_booking_data_text,
'{extra_demands_details_html}' => $extra_demands_details_html,
'{extra_demands_details_text}' => $extra_demands_details_text,
'{normal_products_data_html}' => $normal_products_data_html,
'{normal_products_data_txt}' => $normal_products_data_txt,
'{order_total_info_html}' => $order_total_info_html,
'{order_total_info_txt}' => $order_total_info_txt,
'{total_extra_demands_te}' => Tools::displayPrice(
$cart_booking_data['total_extra_demands_te'],
$this->context->currency,
@@ -1160,8 +1341,7 @@ abstract class PaymentModuleCore extends Module
'{products_txt}' => $product_list_txt,
'{discounts}' => $cart_rules_list_html,
'{discounts_txt}' => $cart_rules_list_txt,
'{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false),
'{total_products}' => Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $order->total_products : $order->total_products_wt, $this->context->currency, false),
'{total_products}' => Tools::displayPrice($total_products, $this->context->currency, false),
'{total_discounts}' => Tools::displayPrice(-$order->total_discounts, $this->context->currency, false),
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false),
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false),
@@ -1209,6 +1389,10 @@ abstract class PaymentModuleCore extends Module
$overBookingStates = OrderState::getOverBookingStates();
$isOverBookingStatus = in_array($id_order_state, $overBookingStates);
if (Configuration::get('PS_ORDER_CONF_MAIL_TO_CUSTOMER')){
// order_header_line tpl for using on different emails as per conditions for hotel or not hotel orders
$headerLineParams = array('hotel_name' => $hotelName, 'has_room_bookings' => $cart_booking_data['cart_htl_data']);
$data['{order_header_line_html}'] = trim($objMail->getEmailTemplateContent('order_header_line', Mail::TYPE_HTML, $headerLineParams));
$data['{order_header_line_txt}'] = trim($objMail->getEmailTemplateContent('order_header_line_text', Mail::TYPE_TEXT, $headerLineParams));
// If order currenct state is overbooking, the send overbooking email or send order confirmation email
if ($isOverBookingStatus) {
$subject = Mail::l('Order Not Confirmed', (int)$order->id_lang);
@@ -1260,6 +1444,10 @@ abstract class PaymentModuleCore extends Module
}
}
}
$headerLineParams = array('for_admin' => true, 'hotel_name' => $hotelName, 'has_room_bookings' => $cart_booking_data['cart_htl_data']);
$data['{order_header_line_html}'] = trim($objMail->getEmailTemplateContent('order_header_line', Mail::TYPE_HTML, $headerLineParams));
$data['{order_header_line_txt}'] = trim($objMail->getEmailTemplateContent('order_header_line_text', Mail::TYPE_TEXT, $headerLineParams));
if (Configuration::get('PS_ORDER_CONF_MAIL_TO_SUPERADMIN')){
// get superadmin employees
if ($superAdminEmployees = Employee::getEmployeesByProfile(_PS_ADMIN_PROFILE_, true)) {
@@ -1295,7 +1483,7 @@ abstract class PaymentModuleCore extends Module
}
}
}
if ($idHotel && Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))) {
if ($idOrderHotel && Validate::isLoadedObject($objHotel = new HotelBranchInformation($idOrderHotel))) {
if (Configuration::get('PS_ORDER_CONF_MAIL_TO_HOTEL_MANAGER')){
// If order currenct state is overbooking, the send overbooking email or send order confirmation email
if ($isOverBookingStatus) {
@@ -1327,7 +1515,7 @@ abstract class PaymentModuleCore extends Module
}
}
if (Configuration::get('PS_ORDER_CONF_MAIL_TO_EMPLOYEE')){
if ($htlAccesses = $objHotel->getHotelAccess($idHotel)) {
if ($htlAccesses = $objHotel->getHotelAccess($idOrderHotel)) {
$data['{customer_name}'] = $this->context->customer->firstname.' '.$this->context->customer->lastname;
$data['{customer_email}'] = $this->context->customer->email;
@@ -1686,7 +1874,7 @@ abstract class PaymentModuleCore extends Module
$obj_htl_bk_dtl = new HotelBookingDetail();
$obj_rm_type = new HotelRoomType();
$objBookingDemand = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$result['total_extra_demands_te'] = 0;
$result['total_extra_demands_ti'] = 0;
$cart_htl_data = array();
@@ -1791,15 +1979,19 @@ abstract class PaymentModuleCore extends Module
1
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$order->id,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to']
$data_v['date_to'],
0,
0,
null,
0,
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$order->id,
0,
0,
@@ -1812,7 +2004,7 @@ abstract class PaymentModuleCore extends Module
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$order->id,
0,
0,

View File

@@ -185,7 +185,7 @@ class ProductCore extends ObjectModel
public $available_for_order = true;
// Room type required to buy
public $service_product_type;
public $selling_preference_type;
// add product to cart automatically
public $auto_add_to_cart = false;
@@ -302,7 +302,7 @@ class ProductCore extends ObjectModel
'cache_has_attachments' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'is_virtual' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'booking_product' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'service_product_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'selling_preference_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
/* Shop fields */
'id_category_default' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedId'),
@@ -481,7 +481,7 @@ class ProductCore extends ObjectModel
),
'hidden_fields' => array(
'booking_product',
'service_product_type'
'selling_preference_type'
),
);
@@ -550,8 +550,11 @@ class ProductCore extends ObjectModel
const PRICE_DISPALY_COMBINE = 1;
const PRICE_DISPALY_INDIVISUAL = 2;
const SERVICE_PRODUCT_WITH_ROOMTYPE = 1;
const SERVICE_PRODUCT_WITHOUT_ROOMTYPE = 2;
// Product selling preference types
const SELLING_PREFERENCE_WITH_ROOM_TYPE = 1; // Product to be sold with Room types
const SELLING_PREFERENCE_HOTEL_STANDALONE = 2; // Product to be sold Standalone with Hotels
const SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE = 3; // Product to be sold Standalone with Hotels and with Room types also
const SELLING_PREFERENCE_STANDALONE = 4; // Product to be sold standalone
const PRICE_ADDITION_TYPE_WITH_ROOM = 1;
const PRICE_ADDITION_TYPE_INDEPENDENT = 2;
@@ -559,6 +562,9 @@ class ProductCore extends ObjectModel
const PRICE_CALCULATION_METHOD_PER_BOOKING = 1;
const PRICE_CALCULATION_METHOD_PER_DAY = 2;
const STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOMER = 1;
const STANDARD_PRODUCT_ADDRESS_PREFERENCE_HOTEL = 2;
const STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM = 3;
public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
{
@@ -581,7 +587,11 @@ class ProductCore extends ObjectModel
// Keep base price
$this->base_price = $this->price;
$this->price = Product::getPriceStatic((int)$this->id, false, null, 6, null, false, true, 1, false, null, null, null, $this->specificPrice);
if ($this->booking_product) {
$this->price = Product::getPriceStatic((int)$this->id, false, null, 6, null, false, true, 1, false, null, null, null, $this->specificPrice);
} else {
$this->price = Product::getServiceProductPrice((int)$this->id);
}
$this->unit_price = ($this->unit_price_ratio != 0 ? $this->price / $this->unit_price_ratio : 0);
if ($this->id) {
$this->tags = Tag::getProductTags((int)$this->id);
@@ -931,6 +941,23 @@ class ProductCore extends ObjectModel
), 'id_product = '.(int)$id_product);
}
public static function getSellingPreferenceType($id_product)
{
$cache_key = 'Product::getSellingPreferenceType_'.(int) $id_product;
if (!Cache::isStored($cache_key)) {
$res = Db::getInstance()->getValue(
'SELECT p.`selling_preference_type`
FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p').'
WHERE p.`id_product` = '.(int)$id_product
);
Cache::store($cache_key, $res);
} else {
$res = Cache::retrieve($cache_key);
}
return $res;
}
public static function getProductPriceCalculation($id_product)
{
$cache_key = 'Product::getProductPriceCalculation'.(int)$id_product;
@@ -1036,11 +1063,12 @@ class ProductCore extends ObjectModel
}
if (!$this->booking_product) {
$objHotelRoomTypeBedType = new HotelRoomTypeBedType();
$objHotelRoomTypeBedType->deleteRoomTypeBedTypes(false, $this->id);
if (!$this->deleteServiceInfo()) {
return false;
}
} else {
$objHotelRoomTypeBedType = new HotelRoomTypeBedType();
$objHotelRoomTypeBedType->deleteRoomTypeBedTypes(false, $this->id);
}
Hook::exec('actionProductDelete', array('id_product' => (int)$this->id, 'product' => $this));
@@ -1412,7 +1440,7 @@ class ProductCore extends ObjectModel
('.
'(`element_type` = '.RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND `id_element` = '.(int)$this->id.')
)
AND p.`service_product_type` = '.(int)self::SERVICE_PRODUCT_WITH_ROOMTYPE. '
AND (p.`selling_preference_type` = '.(int)self::SELLING_PREFERENCE_WITH_ROOM_TYPE. ' || p.`selling_preference_type` = '.(int)self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE.')'. '
AND product_shop.`id_shop` = '.(int)$context->shop->id
.($sub_category? ' AND product_shop.`id_category_default` = '.(int)$sub_category : '')
.($front ? ' AND product_shop.`show_at_front` = 1':'')
@@ -1456,7 +1484,7 @@ class ProductCore extends ObjectModel
('.
'(`element_type` = '.RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND `id_element` = '.(int)$this->id.')
)
AND p.`service_product_type` = '.(int)self::SERVICE_PRODUCT_WITH_ROOMTYPE. '
AND (p.`selling_preference_type` = '.(int)self::SELLING_PREFERENCE_WITH_ROOM_TYPE. '|| p.`selling_preference_type` = '.(int)self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE.')'. '
AND product_shop.`id_shop` = '.(int)$context->shop->id
.($sub_category? ' AND product_shop.`id_category_default` = '.(int)$sub_category : '')
.($front ? ' AND product_shop.`show_at_front` = 1':'')
@@ -1502,8 +1530,9 @@ class ProductCore extends ObjectModel
('.
'(`element_type` = '.RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND `id_element` = '.(int)$this->id.')
)
AND p.`service_product_type` = '.(int)self::SERVICE_PRODUCT_WITH_ROOMTYPE. '
AND product_shop.`id_shop` = '.(int)$context->shop->id
AND p.`selling_preference_type` = '.(int)self::SELLING_PREFERENCE_WITH_ROOM_TYPE.
' || p.`selling_preference_type` = '.(int)self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE.
' AND product_shop.`id_shop` = '.(int)$context->shop->id
.($front ? ' AND product_shop.`auto_add_to_cart` = 0 AND product_shop.`show_at_front` = 1':'')
.($active ? ' AND product_shop.`active` = 1' : '');
@@ -1528,7 +1557,7 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (il.`id_image` = i.`id_image` AND il.`id_lang` = '.(int) $idLang.')
WHERE p.`booking_product` = 0'.
(!is_null($active) ? ' AND p.`active` = '.(int) $active : '').
($serviceProductType ? ' AND p.`service_product_type` = '.(int) $serviceProductType : '');
($serviceProductType ? ' AND p.`selling_preference_type` = '.(int) $serviceProductType : '');
if (Validate::isOrderBy($orderBy) && Validate::isOrderBy($orderWay)) {
$sql .= ' ORDER BY '.$orderBy.' '.$orderWay;
@@ -3060,7 +3089,7 @@ class ProductCore extends ObjectModel
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null,
$only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null,
$id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null,
$use_customer_price = true, $id_product_roomtype = false, $id_group = null)
$use_customer_price = true, $id_hotel = false, $id_product_room_type = false, $id_group = null)
{
if (!$context) {
$context = Context::getContext();
@@ -3119,6 +3148,29 @@ class ProductCore extends ObjectModel
}
}
if (!Product::isBookingProduct($id_product)
&& (Product::getSellingPreferenceType($id_product) == Product::SELLING_PREFERENCE_STANDALONE)
&& !$id_address
) {
$serviceAddressPrefrenceType = Configuration::get('PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE');
if ($serviceAddressPrefrenceType == Product::STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOMER) {
$customer = $context->customer;
if (isset($customer->id)
&& ($idCustomerAddress = Address::getFirstCustomerAddressId($customer->id))
) {
$id_address = $idCustomerAddress;
}
} else if (($serviceAddressPrefrenceType == Product::STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM)
&& ($idCustomAddress = Configuration::get('PS_STANDARD_PRODUCT_ORDER_ADDRESS_ID'))
) {
$id_address = $idCustomAddress;
}
}
if (is_null($id_customer) && Validate::isLoadedObject($context->customer)) {
$id_customer = $context->customer->id;
}
$id_currency = Validate::isLoadedObject($context->currency) ? (int)$context->currency->id : (int)Configuration::get('PS_CURRENCY_DEFAULT');
// retrieve address informations
@@ -3127,26 +3179,17 @@ class ProductCore extends ObjectModel
$zipcode = 0;
if (!$id_address) {
if (!Product::isBookingProduct($id_product)) {
if ($id_product_roomtype) {
// if room type is provided with product then we know that the service product price should be calculated accroding to roomt type
$id_address = Cart::getIdAddressForTaxCalculation($id_product_roomtype);
}
} else {
$id_address = Cart::getIdAddressForTaxCalculation($id_product);
}
$id_address = Cart::getIdAddressForTaxCalculation($id_product, $id_hotel, $id_product_room_type);
}
if (!$id_address) {
if ($primaryHotel = ConfigurationCore::get('WK_PRIMARY_HOTEL')) {
if ($address = HotelBranchInformation::getAddress($primaryHotel)) {
$address_infos['id_country'] = $address['id_country'];
$address_infos['id_state'] = $address['id_state'];
$address_infos['postcode'] = $address['postcode'];
}
}
} elseif ($id_address) {
if ($id_address) {
$address_infos = Address::getCountryAndState($id_address);
} elseif ($primaryHotel = ConfigurationCore::get('WK_PRIMARY_HOTEL')) {
if ($address = HotelBranchInformation::getAddress($primaryHotel)) {
$address_infos['id_country'] = $address['id_country'];
$address_infos['id_state'] = $address['id_state'];
$address_infos['postcode'] = $address['postcode'];
}
}
if (isset($address_infos['id_country']) && $address_infos['id_country']) {
@@ -3159,10 +3202,6 @@ class ProductCore extends ObjectModel
$usetax = false;
}
if (is_null($id_customer) && Validate::isLoadedObject($context->customer)) {
$id_customer = $context->customer->id;
}
$return = Product::priceCalculation(
$context->shop->id,
$id_product,
@@ -3184,7 +3223,8 @@ class ProductCore extends ObjectModel
$use_customer_price,
$id_cart,
$cart_quantity,
$id_product_roomtype
$id_hotel,
$id_product_room_type
);
return $return;
@@ -3218,7 +3258,7 @@ class ProductCore extends ObjectModel
**/
public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency,
$id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction,
$id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0, $id_product_roomtype = false)
$id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0, $id_hotel = false, $id_product_room_type = false)
{
static $address = null;
static $context = null;
@@ -3239,6 +3279,13 @@ class ProductCore extends ObjectModel
$id_customer = 0;
}
if ($id_product_attribute) {
$id_product_option = $id_product_attribute;
$id_product_attribute = null;
} else {
$id_product_option = null;
}
if ($id_product_attribute === null) {
$id_product_attribute = Product::getDefaultAttribute($id_product);
}
@@ -3246,7 +3293,7 @@ class ProductCore extends ObjectModel
$cache_id = (int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.$id_state.'-'.$zipcode.'-'.(int)$id_group.
'-'.(int)$quantity.'-'.(int)$id_product_attribute.
'-'.(int)$with_ecotax.'-'.(int)$id_customer.'-'.(int)$use_group_reduction.'-'.(int)$id_cart.'-'.(int)$real_quantity.
'-'.($only_reduc?'1':'0').'-'.($use_reduc?'1':'0').'-'.($use_tax?'1':'0').'-'.(int)$decimals.'-'.($id_product_roomtype?(int)$id_product_roomtype:'0');
'-'.($only_reduc?'1':'0').'-'.($use_reduc?'1':'0').'-'.($use_tax?'1':'0').'-'.(int)$decimals.'-'.($id_hotel?(int)$id_hotel:'0').'-'.($id_product_option?(int)$id_product_option:'0'.'-'.($id_product_room_type?(int)$id_product_room_type:'0'));
// reference parameter is filled before any returns
$specific_price = SpecificPrice::getSpecificPrice(
@@ -3256,7 +3303,7 @@ class ProductCore extends ObjectModel
(int)$context->country->id,
$id_group,
$quantity,
$id_product_attribute,
$id_product_option,
$id_customer,
$id_cart,
$real_quantity
@@ -3272,6 +3319,9 @@ class ProductCore extends ObjectModel
// fetch price & attribute price
$cache_id_2 = $id_product.'-'.$id_shop;
if ($id_product_option) {
$cache_id_2 .= '-'.$id_product_option;
}
if (!isset(self::$_pricesLevel2[$cache_id_2])) {
$sql = new DbQuery();
$sql->select('product_shop.`price`, product_shop.`ecotax`');
@@ -3285,6 +3335,10 @@ class ProductCore extends ObjectModel
$sql->select('0 as id_product_attribute');
}
if ($id_product_option && ServiceProductOption::productHasOptions($id_product)) {
$sql->select('product_option.id_product_option, product_option.price_impact as option_impact_price');
$sql->leftJoin('product_option', 'product_option', '(product_option.id_product = p.id_product AND product_option.id_product_option = '.(int)$id_product_option.')');
}
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
if (is_array($res) && count($res)) {
@@ -3294,11 +3348,19 @@ class ProductCore extends ObjectModel
'ecotax' => $row['ecotax'],
'attribute_price' => (isset($row['attribute_price']) ? $row['attribute_price'] : null)
);
if (isset($row['option_impact_price'])) {
$array_tmp['option_impact_price'] = $row['option_impact_price'];
$array_tmp['id_product_option'] = $row['id_product_option'];
}
self::$_pricesLevel2[$cache_id_2][(int)$row['id_product_attribute']] = $array_tmp;
if (isset($row['default_on']) && $row['default_on'] == 1) {
self::$_pricesLevel2[$cache_id_2][0] = $array_tmp;
}
if (isset($row['option_impact_price']) && !$id_product_option) {
break;
}
}
}
}
@@ -3310,10 +3372,10 @@ class ProductCore extends ObjectModel
$result = self::$_pricesLevel2[$cache_id_2][(int)$id_product_attribute];
// get price per room type
if ($id_product_roomtype) {
if ($id_product_room_type) {
$priceForRoomInfo = RoomTypeServiceProductPrice::getProductRoomTypePriceAndTax(
$id_product,
$id_product_roomtype,
$id_product_room_type,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE
);
}
@@ -3328,6 +3390,13 @@ class ProductCore extends ObjectModel
$price = (float)$specific_price['price'];
}
// add option impact only if specific price is not set for this option
if ((!$specific_price || !$specific_price['id_product_attribute'] || $specific_price['price'] < 0)
&& isset($result['option_impact_price'])
) {
$price += (float)$result['option_impact_price'];
}
// convert only if the specific price is in the default currency (id_currency = 0)
if (!$specific_price || !($specific_price['price'] >= 0 && $specific_price['id_currency'])) {
$price = Tools::convertPrice($price, $id_currency);
@@ -3345,9 +3414,6 @@ class ProductCore extends ObjectModel
}
}
// find and add if any auto_add services are attached
Hook::exec(
'actionProductPriceModifier',
array(
@@ -4094,47 +4160,55 @@ class ProductCore extends ObjectModel
* @param string $query Search query
* @return array Matching products
*/
public static function searchByName($id_lang, $query, Context $context = null, $id_hotel = false)
public static function searchByName($id_lang, $query, $booking_product = null, $selling_preference_type = null, $id_hotel = false, Context $context = null)
{
if (!$context) {
$context = Context::getContext();
}
$sql = 'SELECT p.`id_product`, pl.`name`, p.`ean13`, p.`upc`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.`quantity`, product_shop.advanced_stock_management, p.`customizable`, p.`booking_product`, p.`allow_multiple_quantity`
FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`)';
$sql .= Product::sqlStock('p', 0);
$sql .= Shop::addSqlAssociation('product', 'p');
$sql = new DbQuery();
$sql->select('p.`id_product`, pl.`name`, p.`ean13`, p.`upc`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.`quantity`, product_shop.advanced_stock_management, p.`customizable`, p.`booking_product`');
$sql->from('product', 'p');
$sql->join(Shop::addSqlAssociation('product', 'p'));
$sql->leftJoin('product_lang', 'pl', '
p.`id_product` = pl.`id_product`
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl')
);
$sql->leftJoin('manufacturer', 'm', 'm.`id_manufacturer` = p.`id_manufacturer`');
if ($id_hotel) {
$sql->innerJoin(
'htl_room_type',
'hrt',
'p.`id_product` = hrt.`id_product` AND hrt.`id_hotel` = '.(int)$id_hotel
);
if (!is_null($booking_product)) {
if ($booking_product) {
$sql .= ' INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (p.`id_product` = hrt.`id_product` AND hrt.`id_hotel` = '.(int)$id_hotel.')';
} else {
$sql .= ' INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product` hrtsp ON (p.`id_product` = hrtsp.`id_product` AND hrtsp.`id_element` = '.(int)$id_hotel.' AND hrtsp.`element_type` = '.(int)RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.')';
}
} else {
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (p.`id_product` = hrt.`id_product` AND hrt.`id_hotel` = '.(int)$id_hotel.')';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` hrtsp ON (p.`id_product` = hrtsp.`id_product` AND hrtsp.`id_element` = '.(int)$id_hotel.' AND hrtsp.`element_type` = '.(int)RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.')';
}
}
$where = 'pl.`name` LIKE \'%'.pSQL($query).'%\'
$sql .= ' WHERE 1';
if (!is_null($booking_product)) {
$sql .= $booking_product ? ' AND p.`booking_product` = 1' : ' AND p.`booking_product` = 0';
} elseif ($id_hotel) {
$sql .= ' AND IF (p.`booking_product` = 1, (p.`id_product` = hrt.`id_product`) , (p.`id_product` = hrtsp.`id_product` AND hrtsp.`id_element` = '.(int)$id_hotel.' AND hrtsp.`element_type` = '.(int)RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.'))';
}
if ($selling_preference_type) {
$sql .= ' AND p.`selling_preference_type` = '.(int)$selling_preference_type;
}
$sql .= ' AND (pl.`name` LIKE \'%'.pSQL($query).'%\'
OR p.`ean13` LIKE \'%'.pSQL($query).'%\'
OR p.`upc` LIKE \'%'.pSQL($query).'%\'
OR p.`reference` LIKE \'%'.pSQL($query).'%\'
OR p.`supplier_reference` LIKE \'%'.pSQL($query).'%\'
OR EXISTS(SELECT * FROM `'._DB_PREFIX_.'product_supplier` sp WHERE sp.`id_product` = p.`id_product` AND `product_supplier_reference` LIKE \'%'.pSQL($query).'%\')';
$sql->orderBy('pl.`name` ASC');
if (Combination::isFeatureActive()) {
$where .= ' OR EXISTS(SELECT * FROM `'._DB_PREFIX_.'product_attribute` `pa` WHERE pa.`id_product` = p.`id_product` AND (pa.`reference` LIKE \'%'.pSQL($query).'%\'
$sql .= ' OR EXISTS(SELECT * FROM `'._DB_PREFIX_.'product_attribute` `pa` WHERE pa.`id_product` = p.`id_product` AND (pa.`reference` LIKE \'%'.pSQL($query).'%\'
OR pa.`supplier_reference` LIKE \'%'.pSQL($query).'%\'
OR pa.`ean13` LIKE \'%'.pSQL($query).'%\'
OR pa.`upc` LIKE \'%'.pSQL($query).'%\'))';
OR pa.`upc` LIKE \'%'.pSQL($query).'%\')))';
}
$sql->where($where);
$sql->join(Product::sqlStock('p', 0));
$sql .= ' ORDER BY pl.`name` ASC';
$result = Db::getInstance()->executeS($sql);
@@ -6776,4 +6850,67 @@ class ProductCore extends ObjectModel
return true;
}
public static function getServiceProductPrice(
$idProduct,
$idProductOption = 0,
$idHotel = false,
$idProductRoomType = false,
$useTax = null,
$quantity = 1,
$dateFrom = null,
$dateTo = null,
$idCart = false,
$idAddress = null,
$useReduc = 1
) {
if ($useTax === null) {
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;
}
$price = Product::getPriceStatic(
(int)$idProduct,
$useTax,
$idProductOption,
6,
null,
false,
$useReduc,
(int)$quantity,
false,
null,
$idCart,
$idAddress,
$specificPrice,
true,
true,
null,
true,
(int)$idHotel,
(int)$idProductRoomType
);
Hook::exec('actionServiceProductPricePriceModifier',
array(
'price' => &$price,
'id_product' => $idProduct,
'id_product_option' => $idProductOption,
'id_hotel' => $idHotel,
'id_product_room_type' => $idProductRoomType,
'date_from' => $dateFrom,
'date_to' => $dateTo,
'use_tax' => $useTax,
'id_cart' => $idCart,
'use_reduc' => $useReduc
)
);
if (Product::getProductPriceCalculation($idProduct) == Product::PRICE_CALCULATION_METHOD_PER_DAY
&& $dateFrom && $dateTo
) {
$price = $price * HotelHelper::getNumberOfDays($dateFrom, $dateTo);
}
return $price * (int)$quantity;
}
}

View File

@@ -29,7 +29,7 @@ class CheckoutCustomerDetailsStepCore extends AbstractCheckoutStepCore
public function handleRequest()
{
$idAddressDelivery = $this->context->cart->id_address_delivery;
$objAddress = new Address($idAddressDelivery);
// $objAddress = new Address($idAddressDelivery);
if (Tools::getValue('proceed_to_customer_dtl')) {
$this->step_is_reachable = 1;
$this->step_is_current = 1;

View File

@@ -600,12 +600,12 @@ class OrderCore extends ObjectModel
public function getProductsDetail(
$is_booking = null,
$product_service_type = null,
$selling_preference_type = null,
$product_auto_add = null,
$product_price_addition_type = null,
$ids_order_detail = []
) {
$sql = 'SELECT *
$sql = 'SELECT *, od.`selling_preference_type` as selling_preference_type
FROM `'._DB_PREFIX_.'order_detail` od
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = od.product_id)
LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
@@ -617,13 +617,13 @@ class OrderCore extends ObjectModel
if ($is_booking !== null) {
$sql .= ' AND od.`is_booking_product` = '. (int)$is_booking;
if (!$is_booking && $product_service_type !== null) {
$sql .= ' AND od.`product_service_type` = '. (int)$product_service_type;
if (!$is_booking && $selling_preference_type !== null) {
$sql .= ' AND od.`selling_preference_type` = '. (int)$selling_preference_type;
}
if (!$is_booking && $product_service_type == Product::SERVICE_PRODUCT_WITH_ROOMTYPE && $product_auto_add !== null) {
if (!$is_booking && $selling_preference_type == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE && $product_auto_add !== null) {
$sql .= ' AND od.`product_auto_add` = '. (int)$product_auto_add;
}
if (!$is_booking && $product_service_type == Product::SERVICE_PRODUCT_WITH_ROOMTYPE && $product_auto_add == 1 && $product_price_addition_type !== null) {
if (!$is_booking && $selling_preference_type == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE && $product_auto_add == 1 && $product_price_addition_type !== null) {
$sql .= ' AND od.`product_price_addition_type` = '. (int)$product_price_addition_type;
}
}
@@ -1110,14 +1110,14 @@ class OrderCore extends ObjectModel
public function getTotalProductsWithoutTaxes(
$products = false,
$bookingProducts = null,
$product_service_type = null,
$selling_preference_type = null,
$product_auto_add = null,
$product_price_addition_type = null,
$ids_order_detail = []
) {
// update
if (!$products) {
$products = $this->getProductsDetail($bookingProducts, $product_service_type, $product_auto_add, $product_price_addition_type, $ids_order_detail);
$products = $this->getProductsDetail($bookingProducts, $selling_preference_type, $product_auto_add, $product_price_addition_type, $ids_order_detail);
}
$return = 0;
@@ -1136,14 +1136,14 @@ class OrderCore extends ObjectModel
public function getTotalProductsWithTaxes(
$products = false,
$bookingProducts = null,
$product_service_type = null,
$selling_preference_type = null,
$product_auto_add = null,
$product_price_addition_type = null,
$ids_order_detail = []
) {
/* Retro-compatibility (now set directly on the validateOrder() method) */
if (!$products) {
$products = $this->getProductsDetail($bookingProducts, $product_service_type, $product_auto_add, $product_price_addition_type, $ids_order_detail);
$products = $this->getProductsDetail($bookingProducts, $selling_preference_type, $product_auto_add, $product_price_addition_type, $ids_order_detail);
}
$return = 0;
@@ -1267,13 +1267,14 @@ class OrderCore extends ObjectModel
*/
public function isReturnable()
{
$objBookingDetail = new HotelBookingDetail();
if ($bookingInfo = $objBookingDetail->getBookingDataByOrderId($this->id)) {
$idHotel = reset($bookingInfo)['id_hotel'];
$objHotelBranch = new HotelBranchInformation($idHotel);
$vatAddress = new Address((int)$this->id_address_tax);
if ($vatAddress->id_hotel) {
$objHotelBranch = new HotelBranchInformation($vatAddress->id_hotel);
// check if global as well as hotel refund is allowed
return (Configuration::get('WK_ORDER_REFUND_ALLOWED') && $objHotelBranch->active_refund);
} else {
return Configuration::get('WK_ORDER_REFUND_ALLOWED');
}
return false;
}
@@ -2450,7 +2451,7 @@ class OrderCore extends ObjectModel
* @param $limitToOrderDetails Optional array of OrderDetails to take into account. False by default to take all OrderDetails from the current Order.
* @return array A list of tax rows applied to the given OrderDetails (or all OrderDetails linked to the current Order).
*/
public function getProductTaxesDetails($limitToOrderDetails = false, $bookingProducts = null, $product_service_type = null)
public function getProductTaxesDetails($limitToOrderDetails = false, $bookingProducts = null, $selling_preference_type = null)
{
$round_type = $this->round_type;
if ($round_type == 0) {
@@ -2470,7 +2471,7 @@ class OrderCore extends ObjectModel
$expected_total_base = (float)$this->getTotalProductsWithoutTaxes(
$limitToOrderDetails,
$bookingProducts,
$product_service_type
$selling_preference_type
);
foreach ($this->getCartRules() as $order_cart_rule) {
@@ -2649,65 +2650,101 @@ class OrderCore extends ObjectModel
*/
public function hasCompletelyRefunded($action = 0, $includeCheckIn = 0)
{
$res = true;
// check rooms in booking
$objHotelBooking = new HotelBookingdetail();
if ($orderBookings = $objHotelBooking->getOrderCurrentDataByOrderId($this->id)) {
// If action is Order::ORDER_COMPLETE_REFUND_FLAG (for refunded) then we will check
// that all rooms must be refunded and at least one booking is not cancelled
if ($action == Order::ORDER_COMPLETE_REFUND_FLAG) {
$uniqueRefundedBookings = array_unique(array_column($orderBookings, 'is_refunded'));
if (count($uniqueRefundedBookings) == 1 && $uniqueRefundedBookings[0] == 1) {
foreach ($orderBookings as $booking) {
if ($booking['is_cancelled'] == 0) {
return true;
}
}
}
// If action is Order::ORDER_COMPLETE_CANCELLATION_FLAG (for cancelled) then we will check that all rooms must be cancelled
} elseif ($action == Order::ORDER_COMPLETE_CANCELLATION_FLAG) {
$uniqueRefundedBookings = array_unique(array_column($orderBookings, 'is_cancelled'));
if (count($uniqueRefundedBookings) == 1 && $uniqueRefundedBookings[0] == 1) {
return true;
}
// If action is Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG (for cancelled and refund requests) then we will check that all rooms are either cancelled or requested for refund
} elseif ($action == Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG) {
foreach ($orderBookings as $booking) {
if (!$booking['is_refunded']) {
// If booking refund request is created and request is completed but booking is not refunded then return false
if ($bookingRefundDetail = OrderReturn::getOrdersReturnDetail($this->id, 0, $booking['id'])) {
$bookingRefundDetail = reset($bookingRefundDetail);
if ($bookingRefundDetail['refunded']) {
return false;
}
} else {
return false;
}
}
}
$res &= $this->checkList($orderBookings, $action, $includeCheckIn);
}
// check hotel linked products
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
if ($hotelProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($this->id, 0, 0, Product::SELLING_PREFERENCE_HOTEL_STANDALONE)) {
$res &= $this->checkList($hotelProducts, $action, false);
}
if ($standaloneProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($this->id, 0, 0, Product::SELLING_PREFERENCE_STANDALONE)) {
$res &= $this->checkList($standaloneProducts, $action, false);
}
return $res;
}
public function checkList($list, $action = 0, $includeCheckIn = 0) {
// If action is Order::ORDER_COMPLETE_REFUND_FLAG (for refunded) then we will check
// that all rooms must be refunded and at least one booking is not cancelled
if ($action == Order::ORDER_COMPLETE_REFUND_FLAG) {
$uniqueRefunded = array_unique(array_column($list, 'is_refunded'));
if (count($uniqueRefunded) == 1 && $uniqueRefunded[0] == 1) {
foreach ($list as $product) {
if ($product['is_cancelled'] == 0) {
return true;
}
}
}
// If action is Order::ORDER_COMPLETE_CANCELLATION_FLAG (for cancelled) then we will check that all rooms must be cancelled
} elseif ($action == Order::ORDER_COMPLETE_CANCELLATION_FLAG) {
$uniqueRefunded = array_unique(array_column($list, 'is_cancelled'));
if (count($uniqueRefunded) == 1 && $uniqueRefunded[0] == 1) {
return true;
// Default process to check if order is fully refunded or cancelled or not
} else {
// if is_refunded is 1 means booking either is cancelled or refunded. So check all bookings must have is_refunded = 1
$uniqueRefundedBookings = array_unique(array_column($orderBookings, 'is_refunded'));
if (count($uniqueRefundedBookings) == 1 && $uniqueRefundedBookings[0] == 1) {
return true;
} elseif ($includeCheckIn) {
foreach ($orderBookings as $booking) {
if ($booking['is_refunded'] == 0
&& !OrderReturn::getOrdersReturnDetail($this->id, 0, $booking['id'])
&& $booking['id_status'] == HotelBookingDetail::STATUS_ALLOTED
) {
}
// If action is Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG (for cancelled and refund requests) then we will check that all rooms are either cancelled or requested for refund
} elseif ($action == Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG) {
foreach ($list as $product) {
if (!$product['is_refunded']) {
// If booking refund request is created and request is completed but booking is not refunded then return false
if ($refundDetail = OrderReturn::getOrdersReturnDetail(
$this->id,
0,
isset($product['id']) ? $product['id'] : 0,
isset($product['id_service_product_order_detail']) ? $product['id_service_product_order_detail'] : 0,
)) {
$refundDetail = reset($refundDetail);
if ($refundDetail['refunded']) {
return false;
}
} else {
return false;
}
return true;
}
}
return true;
// Default process to check if order is fully refunded or cancelled or not
} else {
// if is_refunded is 1 means booking either is cancelled or refunded. So check all bookings must have is_refunded = 1
$uniqueRefunded = array_unique(array_column($list, 'is_refunded'));
if (count($uniqueRefunded) == 1 && $uniqueRefunded[0] == 1) {
return true;
} elseif ($includeCheckIn) {
foreach ($list as $product) {
if ($product['is_refunded'] == 0
&& !OrderReturn::getOrdersReturnDetail($this->id, 0, isset($product['id']) ? $product['id'] : 0)
&& $product['id_status'] == HotelBookingDetail::STATUS_ALLOTED
) {
return false;
}
}
return true;
}
}
return false;
}
public function getOrderCompleteRefundStatus()
{
$idOrderState = 0;
if ($this->hasCompletelyRefunded(Order::ORDER_COMPLETE_REFUND_FLAG)) {
$idOrderState = Configuration::get('PS_OS_REFUND');
} elseif ($this->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_FLAG)) {
$idOrderState = Configuration::get('PS_OS_CANCELED');
} elseif ($this->hasCompletelyRefunded()) {
$idOrderState = Configuration::get('PS_OS_REFUND');
}
return $idOrderState;
}
public function getWsBookings()
{
return Db::getInstance()->executeS(

View File

@@ -102,7 +102,7 @@ class OrderDetailCore extends ObjectModel
public $is_booking_product;
/** @var int */
public $product_service_type;
public $selling_preference_type;
/** @var bool */
public $product_allow_multiple_quantity;
@@ -197,7 +197,7 @@ class OrderDetailCore extends ObjectModel
'group_reduction' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'product_quantity_discount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'is_booking_product' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'product_service_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'selling_preference_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'product_auto_add' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'product_price_addition_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'product_allow_multiple_quantity' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
@@ -478,14 +478,16 @@ class OrderDetailCore extends ObjectModel
/*
*By webkul so that product quantity will not be decreased when product is ordered
*/
/*$update_quantity = true;
if (!StockAvailable::dependsOnStock($product['id_product'])) {
$update_quantity = StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], -(int)$product['cart_quantity']);
}
if (!$product['booking_product']) {
$update_quantity = true;
if (!StockAvailable::dependsOnStock($product['id_product'])) {
$update_quantity = StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], -(int)$product['cart_quantity']);
}
if ($update_quantity) {
$product['stock_quantity'] -= $product['cart_quantity'];
}*/
if ($update_quantity) {
$product['stock_quantity'] -= $product['cart_quantity'];
}
}
if ($product['stock_quantity'] < 0 && Configuration::get('PS_STOCK_MANAGEMENT')) {
$this->outOfStock = true;
@@ -645,7 +647,7 @@ class OrderDetailCore extends ObjectModel
$product_quantity : (int)$product['cart_quantity'];
$this->is_booking_product = $product['booking_product'];
$this->product_service_type = $product['service_product_type'];
$this->selling_preference_type = $product['selling_preference_type'];
$this->product_auto_add = $product['auto_add_to_cart'];
$this->product_price_addition_type = $product['price_addition_type'];
$this->product_allow_multiple_quantity = $product['allow_multiple_quantity'];

View File

@@ -450,6 +450,14 @@ class OrderHistoryCore extends ObjectModel
'{payment_method}' => '',
);
$hotelName = '';
$hotelDetail = '';
$data['{order_hotel_detail_html}'] = '';
$data['{order_hotel_detail_txt}'] = '';
$data['{order_header_line_html}'] = '';
$data['{order_header_line_txt}'] = '';
$context = Context::getContext();
$objMail = new Mail();
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) {
$objHotelBranchInformation = new HotelBranchInformation($idHotel);
$fields = array_merge(
@@ -460,10 +468,30 @@ class OrderHistoryCore extends ObjectModel
foreach ($fields as $key => $value) {
$data['{hotel_'.$key.'}'] = $value;
}
$hotelName = $fields['hotel_name'];
$objHotelBookingDetail = new HotelBookingDetail();
$hotelBookingDetail = $objHotelBookingDetail->getBookingDataByOrderId($order->id);
$data['{num_rooms}'] = count($hotelBookingDetail);
// order_hotel_detail tpl for using on different emails as per conditions for hotel or not hotel orders
$params = array(
'hotel_name' => $fields['hotel_name'],
'hotel_phone' => $fields['phone'],
'hotel_email' => $fields['email'],
'num_rooms' => $data['{num_rooms}']
);
$data['{order_hotel_detail_html}'] = $objMail->getEmailTemplateContent('order_hotel_detail', Mail::TYPE_HTML, $params);
$data['{order_hotel_detail_txt}'] = $objMail->getEmailTemplateContent('order_hotel_detail_text', Mail::TYPE_TEXT, $params);
}
// order_header_line tpl for using on different emails as per conditions for hotel or not hotel orders
$params = array(
'hotel_name' => $hotelName,
'has_room_bookings' => HotelBookingDetail::getIdHotelByIdOrder($order->id, false)
);
$data['{order_header_line_html}'] = trim($objMail->getEmailTemplateContent('order_header_line', Mail::TYPE_HTML, $params));
$data['{order_header_line_txt}'] = trim($objMail->getEmailTemplateContent('order_header_line_text', Mail::TYPE_TEXT, $params));
if ($result['module_name']) {
if (Validate::isLoadedObject($module = Module::getInstanceByName($result['module_name']))) {
@@ -491,7 +519,6 @@ class OrderHistoryCore extends ObjectModel
if (Validate::isLoadedObject($order)) {
// Attach invoice and / or delivery-slip if they exists and status is set to attach them
if (($result['pdf_invoice'] || $result['pdf_delivery'])) {
$context = Context::getContext();
$invoice = $order->getInvoicesCollection();
$file_attachement = array();

View File

@@ -138,7 +138,7 @@ class OrderInvoiceCore extends ObjectModel
public function getProductsDetail()
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *
SELECT *, od.`selling_preference_type` as selling_preference_type
FROM `'._DB_PREFIX_.'order_detail` od
LEFT JOIN `'._DB_PREFIX_.'product` p
ON p.id_product = od.product_id
@@ -417,7 +417,7 @@ class OrderInvoiceCore extends ObjectModel
$order_detail = array_filter($order_detail, function($v) {
return ($v['is_booking_product']
|| ($v['product_auto_add']
&& $v['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE
&& $v['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE
&& $v['product_price_addition_type'] == ProductCore::PRICE_ADDITION_TYPE_WITH_ROOM)
);
});
@@ -484,9 +484,9 @@ class OrderInvoiceCore extends ObjectModel
$breakdown = array();
$order_detail = $this->getProducts();
$order_detail = array_filter($order_detail, function($v) {
return (!$v['is_booking_product'] && !$v['product_auto_add'] && $v['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE);
return (!$v['is_booking_product'] && !$v['product_auto_add'] && $v['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
});
$details = $order->getProductTaxesDetails($order_detail, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE);
$details = $order->getProductTaxesDetails($order_detail, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
if ($sum_composite_taxes) {
$grouped_details = array();
@@ -550,12 +550,12 @@ class OrderInvoiceCore extends ObjectModel
$order_detail = array_filter($order_detail, function($v) {
return (!$v['is_booking_product']
&& $v['product_auto_add']
&& $v['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE
&& $v['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE
&& $v['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT
);
});
$details = $order->getProductTaxesDetails($order_detail, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE);
$details = $order->getProductTaxesDetails($order_detail, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
if ($sum_composite_taxes) {
$grouped_details = array();
@@ -618,9 +618,13 @@ class OrderInvoiceCore extends ObjectModel
$breakdown = array();
$order_detail = $this->getProducts();
$order_detail = array_filter($order_detail, function($v) {
return (!$v['is_booking_product'] && $v['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
return (!$v['is_booking_product'] && (
$v['selling_preference_type'] == Product::SELLING_PREFERENCE_STANDALONE
|| $v['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE
));
});
$details = $order->getProductTaxesDetails($order_detail, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
$details = $order->getProductTaxesDetails($order_detail, false);
if ($sum_composite_taxes) {
$grouped_details = array();

View File

@@ -189,8 +189,8 @@ class OrderReturnCore extends ObjectModel
public function getOrderRefundRequestedBookings($idOrder, $idOrderReturn = 0, $onlyBookingIds = 0, $customerView = 0, $skipReqCompletedNonRefunded = 0)
{
$sql = 'SELECT hbd.*, ord.*, orr.`state` as id_return_state FROM `'._DB_PREFIX_.'order_return` orr';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (orr.`id_order_return` = ord.`id_order_return`)';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id` = ord.`id_htl_booking`)';
$sql .= ' INNER JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (orr.`id_order_return` = ord.`id_order_return`)';
$sql .= ' INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id` = ord.`id_htl_booking`)';
$sql .= ' WHERE orr.`id_order` = '.(int)$idOrder;
if ($idOrderReturn) {
@@ -204,7 +204,7 @@ class OrderReturnCore extends ObjectModel
$objOrder = new Order($idOrder);
$objBookingDemands = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$calcServicePriceFirst = false;
if ($objOrder->is_advance_payment && $objOrder->advance_paid_amount <= $objOrder->total_paid_real) {
@@ -251,11 +251,23 @@ class OrderReturnCore extends ObjectModel
}
}
if ($roomSelectedServices = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom(
if ($roomSelectedServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
0,
0,
0,
0,
0,
0,
0,
0,
null,
0,
null,
0,
$bookingRow['id_htl_booking']
)) {
if (count($roomSelectedServices['additional_services'])) {
foreach ($roomSelectedServices['additional_services'] as $service) {
if (isset($roomSelectedServices[$bookingRow['id_htl_booking']]['additional_services']) && $roomSelectedServices[$bookingRow['id_htl_booking']]['additional_services']) {
foreach ($roomSelectedServices[$bookingRow['id_htl_booking']]['additional_services'] as $service) {
if ($service['total_price_tax_incl'] > 0) {
if ($objOrder->total_paid_real > 0) {
if ($calcServicePriceFirst) {
@@ -309,6 +321,46 @@ class OrderReturnCore extends ObjectModel
return $returnDetails;
}
/**
* Get order refund request products
*/
public function getOrderRefundRequestedProducts($idOrder, $idOrderReturn = 0, $onlyIds = 0, $skipReqCompletedNonRefunded = 0)
{
$sql = 'SELECT spod.*, ord.*, orr.`state` as id_return_state FROM `'._DB_PREFIX_.'order_return` orr';
$sql .= ' INNER JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (orr.`id_order_return` = ord.`id_order_return`)';
$sql .= ' INNER JOIN `'._DB_PREFIX_.'service_product_order_detail` spod ON (spod.`id_service_product_order_detail` = ord.`id_service_product_order_detail`)';
$sql .= ' WHERE orr.`id_order` = '.(int)$idOrder;
if ($idOrderReturn) {
$sql .= ' AND ord.`id_order_return` = '.(int)$idOrderReturn;
}
if ($returnDetails = Db::getInstance()->executeS($sql)) {
$objOrder = new Order($idOrder);
foreach ($returnDetails as $key => &$product) {
if ($skipReqCompletedNonRefunded) {
$objReturnState = new OrderReturnState($product['id_return_state']);
if ($objReturnState->refunded && !$product['is_refunded']) {
unset($returnDetails[$key]);
continue;
}
}
$product['paid_amount'] = 0;
if ($product['total_price_tax_incl'] > 0) {
if ($objOrder->total_paid_real > 0) {
$product['paid_amount'] = ($objOrder->total_paid_real*$product['total_price_tax_incl'])/ ($objOrder->total_paid_tax_incl + $objOrder->total_discounts_tax_incl);
}
}
}
if ($onlyIds) {
return array_column($returnDetails, 'id_service_product_order_detail');
}
}
return $returnDetails;
}
public static function getOrdersReturn($customer_id, $order_id = false, $no_denied = false, $only_customer = 0, Context $context = null)
{
if (!$context) {
@@ -316,12 +368,14 @@ class OrderReturnCore extends ObjectModel
}
$sql = 'SELECT orr.`id_order`, orr.`state`, orr.`id_order_return`, orr.`payment_mode`, orr.`id_transaction`,
orr.`id_return_type`, orr.`return_type`, ors.`id_cart_rule`, orr.`date_add`, orr.`date_upd`, orr.`refunded_amount`,
hbd.`is_cancelled`, COUNT(ord.`id_order_return_detail`) AS total_rooms
hbd.`is_cancelled`, SUM(IF(ord.`id_htl_booking`, 1, 0)) AS total_rooms
FROM `'._DB_PREFIX_.'order_return` orr
LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord
ON (ord.`id_order_return` = orr.`id_order_return`)
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
ON (hbd.`id` = ord.`id_htl_booking`)
LEFT JOIN `'._DB_PREFIX_.'service_product_order_detail` rtspod
ON (rtspod.`id_service_product_order_detail` = ord.`id_service_product_order_detail`)
LEFT JOIN `'._DB_PREFIX_.'order_slip` ors
ON (ors.`id_order_slip` = orr.`id_return_type` AND orr.`return_type` = '.(int) self::RETURN_TYPE_ORDER_SLIP.')
WHERE orr.`id_customer` = '.(int)$customer_id.
@@ -353,6 +407,7 @@ class OrderReturnCore extends ObjectModel
$idOrder,
$idOrderReturn = 0,
$idHtlBooking = 0,
$idServiceProductOrderOetail = 0,
$idLang = 0,
$orderByLatestRequest = 1
) {
@@ -373,6 +428,10 @@ class OrderReturnCore extends ObjectModel
$sql .= ' AND ord.`id_htl_booking` = '.(int)$idHtlBooking;
}
if ($idServiceProductOrderOetail) {
$sql .= ' AND ord.`id_service_product_order_detail` = '.(int)$idServiceProductOrderOetail;
}
if ($orderByLatestRequest) {
$sql .= ' ORDER BY orr.`id_order_return` DESC';
}
@@ -514,6 +573,36 @@ class OrderReturnCore extends ObjectModel
'{id_transaction}' => $this->id_transaction ? $this->id_transaction : '--',
);
$data['{refundBookingHtml}'] = '';
$data['{refundBookingTxt}'] = '';
$data['{refundServiceProductsHtml}'] = '';
$data['{refundServiceProductsTxt}'] = '';
$data['{refund_for_txt}'] = Mail::l('products', (int)$idLang);
if ($refundReqProducts = $this->getOrderRefundRequestedProducts(
$this->id_order,
$this->id,
0
)) {
$serviceProductsData = array(
'is_hotel_products' => false,
'service_products' => $refundReqProducts
);
$addressTax = new Address((int)$objOrder->id_address_tax);
if ($addressTax->id_hotel) {
$serviceProductsData['is_hotel_products'] = true;
}
$data['{refundServiceProductsHtml}'] = $objMail->getEmailTemplateContent(
'service_products_refund_request_detail',
Mail::TYPE_HTML,
$serviceProductsData
);
$data['{refundServiceProductsTxt}'] = $objMail->getEmailTemplateContent(
'service_products_refund_request_detail_text',
Mail::TYPE_TEXT,
$serviceProductsData
);
}
// if mail is true for the customer then send mail to customer with selected template
$objCustomer = new Customer($this->id_customer);
if ($objOrderReturnState->send_email_to_customer && $objOrderReturnState->customer_template) {
@@ -524,14 +613,11 @@ class OrderReturnCore extends ObjectModel
1
)) {
$idHotel = reset($refundReqBookings)['id_hotel'];
$data['{refundBookingHtml}'] = $objMail->getEmailTemplateContent('bookings_refund_request_detail_customer', Mail::TYPE_HTML, $refundReqBookings);
$data['{refundBookingTxt}'] = $objMail->getEmailTemplateContent('bookings_refund_request_detail_customer_text', Mail::TYPE_TEXT, $refundReqBookings);
$data['{refund_for_txt}'] = Mail::l('bookings', (int)$idLang);
}
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_HTML, $refundReqBookings);
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_TEXT, $refundReqBookings);
$data['{refundBookingHtml}'] = $refBookHtml;
$data['{refundBookingTxt}'] = $refBookTxt;
// send customer information
$link = new Link();
$data['{refund_reqests_url}'] = $link->getPageLink('order-follow');
@@ -561,14 +647,12 @@ class OrderReturnCore extends ObjectModel
$this->id
)) {
$idHotel = $refundReqBookings[0]['id_hotel'];
$data['{refundBookingHtml}'] = $objMail->getEmailTemplateContent('bookings_refund_request_detail_admin', Mail::TYPE_HTML, $refundReqBookings);
$data['{refundBookingTxt}'] = $objMail->getEmailTemplateContent('bookings_refund_request_detail_admin_text', Mail::TYPE_TEXT, $refundReqBookings);
$data['{refund_for_txt}'] = Mail::l('bookings', (int)$idLang);
}
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_HTML, $refundReqBookings);
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_TEXT, $refundReqBookings);
$data['{cancelation_reason}'] = $this->question;
$data['{refundBookingHtml}'] = $refBookHtml;
$data['{refundBookingTxt}'] = $refBookTxt;
// send mail to the super admin
if ($objOrderReturnState->send_email_to_superadmin) {

View File

@@ -26,6 +26,9 @@ class OrderReturnDetailCore extends ObjectModel
/** @var int */
public $id_htl_booking;
/** @var int */
public $id_service_product_order_detail;
/** @var float amount of the refund transaction */
public $refunded_amount;
@@ -47,7 +50,8 @@ class OrderReturnDetailCore extends ObjectModel
'primary' => 'id_order_return_detail',
'fields' => array(
'id_order_return' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_htl_booking' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_htl_booking' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_service_product_order_detail' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_order_detail' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'default' => 0),
'id_customization' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'default' => 0),
'product_quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'default' => 0),

View File

@@ -183,13 +183,19 @@ class OrderSlipCore extends ObjectModel
$slipDetails = array();
foreach ($productsRet as &$slipRow) {
$objHtlBooking = new HotelBookingDetail($slipRow['id_htl_booking']);
$slipRow['product_id'] = $objHtlBooking->id_product;
$slipRow['date_from'] = $objHtlBooking->date_from;
$slipRow['date_to'] = $objHtlBooking->date_to;
$slipRow['hotel_name'] = $objHtlBooking->hotel_name;
$slipRow['product_name'] = $objHtlBooking->room_type_name;
$slipRow['room_num'] = $objHtlBooking->room_num;
if ($slipRow['id_htl_booking']) {
$objHtlBooking = new HotelBookingDetail($slipRow['id_htl_booking']);
$slipRow['product_id'] = $objHtlBooking->id_product;
$slipRow['date_from'] = $objHtlBooking->date_from;
$slipRow['date_to'] = $objHtlBooking->date_to;
$slipRow['hotel_name'] = $objHtlBooking->hotel_name;
$slipRow['product_name'] = $objHtlBooking->room_type_name;
$slipRow['room_num'] = $objHtlBooking->room_num;
} else {
$objServiceProductOrderDetail = new ServiceProductOrderDetail($slipRow['id_service_product_order_detail']);
$slipRow['product_name'] = $objServiceProductOrderDetail->name;
}
if (isset($orderDetailCustom[$slipRow['id_order_detail']])) {
$slipRow = array_merge($orderDetailCustom[$slipRow['id_order_detail']], $slipRow);
@@ -304,7 +310,7 @@ class OrderSlipCore extends ObjectModel
return OrderSlip::create($order, $product_list, $shipping);
}
public static function create(Order $order, $booking_list, $shipping_cost = false, $amount = 0, $amount_choosen = false, $add_tax = true)
public static function create(Order $order, $product_list, $shipping_cost = false, $amount = 0, $amount_choosen = false, $add_tax = true)
{
$currency = new Currency((int)$order->id_currency);
$order_slip = new OrderSlip();
@@ -347,25 +353,31 @@ class OrderSlipCore extends ObjectModel
$order_slip->{'total_products_tax_'.$inc_or_ex_2} = 0;
$total_products = array();
foreach ($booking_list as &$booking) {
$objHtlBooking = new HotelBookingDetail($booking['id_htl_booking']);
$order_detail = new OrderDetail((int)$objHtlBooking->id_order_detail);
foreach ($product_list as &$product_row) {
if (isset($product_row['id_htl_booking'])) {
$objHtlBooking = new HotelBookingDetail($product_row['id_htl_booking']);
$order_detail = new OrderDetail((int)$objHtlBooking->id_order_detail);
$quantity = (int)$product_row['num_days'];
} else if (isset($product_row['id_service_product_order_detail'])) {
$objServiceProductOrderDetail = new ServiceProductOrderDetail($product_row['id_service_product_order_detail']);
$order_detail = new OrderDetail((int)$objServiceProductOrderDetail->id_order_detail);
$quantity = (int)$product_row['quantity'];
}
$price = (float)$product_row['unit_price'];
$price = (float)$booking['unit_price'];
$numDays = (int)$booking['num_days'];
$order_slip_resume = OrderSlip::getProductSlipResume((int)$order_detail->id);
if ($numDays + $order_slip_resume['product_quantity'] > $order_detail->product_quantity) {
$numDays = $order_detail->product_quantity - $order_slip_resume['product_quantity'];
if ($quantity + $order_slip_resume['product_quantity'] > $order_detail->product_quantity) {
$quantity = $order_detail->product_quantity - $order_slip_resume['product_quantity'];
}
if ($numDays == 0) {
if ($quantity == 0) {
continue;
}
if (!Tools::isSubmit('cancelProduct') && $order->hasBeenPaid()) {
$order_detail->product_quantity_refunded += $numDays;
$order_detail->product_quantity_refunded += $quantity;
}
$address = Address::initialize($order->id_address_tax, false);
@@ -385,7 +397,7 @@ class OrderSlipCore extends ObjectModel
}
$product_tax_inc_or_ex_1 = Tools::processPriceRounding(
($price * $numDays),
($price * $quantity),
1,
$order->round_type,
$order->round_mode
@@ -394,7 +406,7 @@ class OrderSlipCore extends ObjectModel
$order_slip->{'total_products_tax_'.$inc_or_ex_1} += $product_tax_inc_or_ex_1;
$product_tax_inc_or_ex_2 = Tools::processPriceRounding(
($tax_calculator->{$add_or_remove.'Taxes'}($price * $numDays)),
($tax_calculator->{$add_or_remove.'Taxes'}($price * $quantity)),
1,
$order->round_type,
$order->round_mode
@@ -405,10 +417,10 @@ class OrderSlipCore extends ObjectModel
$total_products[$id_tax_rules_group] += $product_tax_inc_or_ex_2;
}
$booking['unit_price_tax_'.$inc_or_ex_1] = $price;
$booking['unit_price_tax_'.$inc_or_ex_2] = $tax_calculator->{$add_or_remove.'Taxes'}($price);
$booking['total_price_tax_'.$inc_or_ex_1] = $product_tax_inc_or_ex_1;
$booking['total_price_tax_'.$inc_or_ex_2] = $product_tax_inc_or_ex_2;
$product_row['unit_price_tax_'.$inc_or_ex_1] = $price;
$product_row['unit_price_tax_'.$inc_or_ex_2] = $tax_calculator->{$add_or_remove.'Taxes'}($price);
$product_row['total_price_tax_'.$inc_or_ex_1] = $product_tax_inc_or_ex_1;
$product_row['total_price_tax_'.$inc_or_ex_2] = $product_tax_inc_or_ex_2;
}
foreach ($total_products as $key => $price) {
@@ -441,26 +453,26 @@ class OrderSlipCore extends ObjectModel
return false;
}
foreach ($booking_list as $bookingRow) {
$order_slip->addProductOrderSlip($bookingRow);
foreach ($product_list as $productRow) {
$order_slip->addProductOrderSlip($productRow);
}
return $order_slip->id;
}
protected function addProductOrderSlip($booking)
protected function addProductOrderSlip($product_row)
{
return Db::getInstance()->insert('order_slip_detail', array(
'id_order_slip' => (int)$this->id,
'id_htl_booking' => (int)$booking['id_htl_booking'],
'id_order_detail' => (int)$booking['id_order_detail'],
'product_quantity' => $booking['quantity'],
'unit_price_tax_excl' => $booking['unit_price_tax_excl'],
'unit_price_tax_incl' => $booking['unit_price_tax_incl'],
'total_price_tax_excl' => $booking['total_price_tax_excl'],
'total_price_tax_incl' => $booking['total_price_tax_incl'],
'amount_tax_excl' => $booking['total_price_tax_excl'],
'amount_tax_incl' => $booking['total_price_tax_incl']
'id_htl_booking' => isset($product_row['id_htl_booking']) ? (int)$product_row['id_htl_booking'] : 0,
'id_service_product_order_detail' => isset($product_row['id_service_product_order_detail']) ? (int)$product_row['id_service_product_order_detail'] : 0,
'id_order_detail' => (int)$product_row['id_order_detail'],
'product_quantity' => $product_row['quantity'],
'unit_price_tax_excl' => $product_row['unit_price_tax_excl'],
'unit_price_tax_incl' => $product_row['unit_price_tax_incl'],
'total_price_tax_excl' => $product_row['total_price_tax_excl'],
'total_price_tax_incl' => $product_row['total_price_tax_incl'],
'amount_tax_excl' => $product_row['total_price_tax_excl'],
'amount_tax_incl' => $product_row['total_price_tax_incl']
));
}

View File

@@ -317,7 +317,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$formattedHotelAddress = '';
if (Module::isInstalled('hotelreservationsystem')) {
$obj_htl_bk_dtl = new HotelBookingDetail();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objHotelBranchInfo = new HotelBranchInformation((int) HotelBookingDetail::getIdHotelByIdOrder($order_obj->id), $this->context->language->id);
$invoiceAddressPatternRules['avoid'][] = 'lastname';
if ($idHotelAddress = $objHotelBranchInfo->getHotelIdAddress()) {
@@ -332,10 +332,11 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$totalDemandsPriceTE = 0;
$totalDemandsPriceTI = 0;
foreach ($order_details as $type_key => $type_value) {
if (in_array($type_value['product_id'], $processed_product)) {
$processProuctKey = $type_value['product_id'].'_'.$type_value['selling_preference_type'].'_'.$type_value['id_order_detail'];
if (isset($processed_product[$processProuctKey])) {
continue;
}
$processed_product[] = $type_value['product_id'];
$processed_product[$processProuctKey] = $type_value['product_id'];
if ($type_value['is_booking_product']) {
if ($display_product_images) {
@@ -386,7 +387,31 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
// For order refund
$cart_htl_data[$type_key]['date_diff'][$date_join]['id_room'] = $data_v['id_room'];
} else {
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order_obj->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0,
0,
$type_value['id_order_detail']
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order_obj->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1,
0,
$type_value['id_order_detail']
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$order_obj->id,
0,
0,
@@ -396,7 +421,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
0
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$order_obj->id,
0,
0,
@@ -407,7 +432,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
1,
1
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$order_obj->id,
0,
0,
@@ -419,7 +444,34 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
0
);
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$num_days = HotelHelper::getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$fullDate = (isset($this->context->controller->show_full_date) && $this->context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to'])))) ? true : false;
@@ -467,7 +519,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$cart_htl_data[$type_key]['date_diff'][$date_join]['total_price_tax_excl'] += $data_v['total_price_tax_excl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['total_price_tax_incl'] += $data_v['total_price_tax_incl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
@@ -480,7 +532,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
@@ -513,17 +565,26 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$room_extra_demands[] = $extraDemands;
}
if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom(
$data_v['id'],
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
0,
0,
0,
0,
0,
0,
0,
0,
1,
0
0,
null,
0,
$data_v['id']
)) {
$additionalServices['product_id'] = $type_value['product_id'];
$additionalServices['room_type_name'] = $type_value['product_name'];
$additionalServices['date_from'] = $data_v['date_from'];
$additionalServices['date_to'] = $data_v['date_to'];
$room_additinal_services[] = $additionalServices;
$room_additinal_services[] = $additionalServices[$data_v['id']];
}
// Set tax_code
@@ -550,8 +611,29 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
foreach ($cart_htl_data[$type_key]['date_diff'] as $key => &$value) {
$value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $value['num_rm'], 6);
}
} else if (Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE == $type_value['product_service_type']) {
$service_product_data[$type_key] = $type_value;
} else if (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $type_value['selling_preference_type']
|| Product::SELLING_PREFERENCE_STANDALONE == $type_value['selling_preference_type']
) {
$serviceProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($order_obj->id, $type_value['id_order_detail'], $type_value['product_id']);
if ($taxes = OrderDetail::getTaxListStatic($type_value['id_order_detail'])) {
$tax_temp = array();
foreach ($taxes as $tax) {
$obj = new Tax($tax['id_tax']);
$tax_temp[] = sprintf($this->l('%1$s%2$s%%'), ($obj->rate + 0), '');
}
$order_detail_tax_label = implode(', ', $tax_temp);
} else {
$order_detail_tax_label = HTMLTemplateInvoice::l('No tax');
}
foreach ($serviceProducts as $serviceProduct) {
if ($serviceProduct['id_hotel']) {
$objHotel = new HotelBranchInformation($serviceProduct['id_hotel'], $order_obj->id_lang);
$serviceProduct['hotel_name'] = $objHotel->hotel_name;
}
$serviceProduct = array_merge($type_value, $serviceProduct);
$serviceProduct['order_detail_tax_label'] = $order_detail_tax_label;
$service_product_data[] = $serviceProduct;
}
}
}
unset($tax_temp);
@@ -569,19 +651,20 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$footer['total_convenience_fee_te'] = 0;
$footer['total_convenience_fee_ti'] = 0;
if ($idsOrderDetail = array_column($order_details, 'id_order_detail')) {
$footer['room_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, true, null, null, null, $idsOrderDetail) + $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM, $idsOrderDetail);
$footer['room_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, true, null, null, null, $idsOrderDetail) + $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM, $idsOrderDetail);
// $footer['service_products_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
// $footer['service_products_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
$footer['additional_service_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0, null, $idsOrderDetail) + $totalDemandsPriceTE;
$footer['additional_service_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0, null, $idsOrderDetail) + $totalDemandsPriceTI;
$footer['total_convenience_fee_te'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT, $idsOrderDetail);
$footer['total_convenience_fee_ti'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT, $idsOrderDetail);
$footer['room_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, true, null, null, null, $idsOrderDetail) + $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM, $idsOrderDetail);
$footer['room_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, true, null, null, null, $idsOrderDetail) + $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM, $idsOrderDetail);
$footer['service_products_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE, false, false, $idsOrderDetail) + $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE, false, false, $idsOrderDetail);
$footer['service_products_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE, false, false, $idsOrderDetail) + $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE, false, false, $idsOrderDetail);
$footer['additional_service_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0, null, $idsOrderDetail) + $totalDemandsPriceTE;
$footer['additional_service_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0, null, $idsOrderDetail) + $totalDemandsPriceTI;
$footer['total_convenience_fee_te'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT, $idsOrderDetail);
$footer['total_convenience_fee_ti'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT, $idsOrderDetail);
}
$footer['total_paid_real'] = $this->order_invoice->getTotalPaid();
$footer['total_without_discount_te'] = $footer['room_price_tax_excl'] + $footer['total_convenience_fee_te'] + $footer['additional_service_price_tax_excl'];
$footer['total_without_discount_ti'] = $footer['room_price_tax_incl'] + $footer['total_convenience_fee_ti'] + $footer['additional_service_price_tax_incl'];
$footer['total_without_discount_te'] = $footer['room_price_tax_excl'] + $footer['total_convenience_fee_te'] + $footer['additional_service_price_tax_excl'] + $footer['service_products_price_tax_excl'];
$footer['total_without_discount_ti'] = $footer['room_price_tax_incl'] + $footer['total_convenience_fee_ti'] + $footer['additional_service_price_tax_incl'] + $footer['service_products_price_tax_incl'];
$footer['total_tax_without_discount'] = $footer['total_without_discount_ti'] - $footer['total_without_discount_te'];
if ($footer['total_tax_without_discount'] < 0) {
$footer['total_tax_without_discount'] = 0;
@@ -589,6 +672,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$data = array(
'cart_htl_data' => $cart_htl_data,
'is_hotel_order' => HotelBookingDetail::getIdHotelByIdOrder($this->order->id),
'service_product_data' => $service_product_data,
'room_extra_demands' => $room_extra_demands,
'room_additinal_services' => $room_additinal_services,

View File

@@ -90,7 +90,8 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
$customer = new Customer((int)$this->order->id_customer);
$this->order->total_paid_tax_excl = $this->order->total_paid_tax_incl = $this->order->total_products = $this->order->total_products_wt = 0;
$roomsDetails = array();
$productsDetails = array();
if ($this->order_slip->amount > 0) {
foreach ($this->order->products as &$product) {
// $product['total_price_tax_excl'] = $product['unit_price_tax_excl'] * $product['product_quantity'];
@@ -101,9 +102,10 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
SELECT * FROM `'._DB_PREFIX_.'order_slip_detail`
WHERE `id_order_slip` = '.(int)$this->order_slip->id.'
AND `id_order_detail` = '.(int)$product['id_order_detail'].'
AND `id_htl_booking` = '.(int)$product['id_htl_booking']);
AND `id_htl_booking` = '.(int)$product['id_htl_booking'].'
AND `id_service_product_order_detail` = '.(int)$product['id_service_product_order_detail']);
$product['total_price_tax_excl'] = $order_slip_detail['amount_tax_excl'];
$product['total_price_tax_excl'] = $order_slip_detail['amount_tax_excl'];
$product['total_price_tax_incl'] = $order_slip_detail['amount_tax_incl'];
}
@@ -111,6 +113,12 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
$this->order->total_products_wt += $product['total_price_tax_incl'];
$this->order->total_paid_tax_excl = $this->order->total_products;
$this->order->total_paid_tax_incl = $this->order->total_products_wt;
if ($product['id_htl_booking']) {
$roomsDetails[] = $product;
} else {
$productsDetails[] = $product;
}
}
} else {
$this->order->products = null;
@@ -144,10 +152,13 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
}
}
}
$this->smarty->assign(array(
'order' => $this->order,
'order_slip' => $this->order_slip,
'order_details' => $this->order->products,
'roomsDetails' => $roomsDetails,
'productsDetails' => $productsDetails,
'cart_rules' => $this->order_slip->order_slip_type == 1 ? $this->order->getCartRules($this->order_invoice->id) : false,
'amount_choosen' => $this->order_slip->order_slip_type == 2 ? true : false,
'delivery_address' => $formatted_delivery_address,
@@ -274,7 +285,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
$order_detail = array_filter($this->order->products, function($v) {
return ((isset($v['is_booking_product']) && $v['is_booking_product'])
|| ((isset($v['product_auto_add']) && $v['product_auto_add'])
&& $v['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE
&& $v['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE
&& $v['product_price_addition_type'] == ProductCore::PRICE_ADDITION_TYPE_WITH_ROOM)
);
});

View File

@@ -1004,7 +1004,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
}
}
$serviceProductPrice = $objOrder->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE);
$serviceProductPrice = $objOrder->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
if ($demands = $objHotelBookingDemands->getExtraDemandsTaxesDetails($objOrder->id)) {
$demandsPrice = array_sum(array_column($demands, 'total_price_tax_excl'));
// Adding the tax
@@ -1110,9 +1110,9 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
public function updateServicesAndDemandsInOrder($idOrder)
{
$objOrder = new Order($idOrder);
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
if (isset($this->wsRequestedRoomTypes) && $this->wsRequestedRoomTypes) {
if ($orderedServices = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts($objOrder->id,
if ($orderedServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts($objOrder->id,
0,
0,
0,
@@ -1133,8 +1133,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
) {
foreach ($orderedService['additional_services'] as $service) {
$objOrderDetail = new OrderDetail($service['id_order_detail']);
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($service['id_room_type_service_product_order_detail']);
$quantity = $objRoomTypeServiceProductOrderDetail->quantity;
$objServiceProductOrderDetail = new ServiceProductOrderDetail($service['id_service_product_order_detail']);
$quantity = $objServiceProductOrderDetail->quantity;
if ($objOrderDetail->product_price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$quantity = $quantity * HotelHelper::getNumberOfDays(
$objHotelBookingDetail->date_from,
@@ -1143,8 +1143,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
}
if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']])) {
$oldPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
$oldPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
$oldPriceTaxExcl = $objServiceProductOrderDetail->total_price_tax_excl;
$oldPriceTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl;
if ($oldPriceTaxExcl > 0) {
$oldTaxMultiplier = $oldPriceTaxIncl / $oldPriceTaxExcl;
} else {
@@ -1156,13 +1156,13 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$unitPriceTaxIncl = $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['unit_price_without_tax'] * $oldTaxMultiplier;
$totalPriceTaxExcl = $unitPriceTaxExcl * $quantity;
$totalPriceTaxIncl = $unitPriceTaxIncl * $quantity;
$objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = Tools::ps_round($unitPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->unit_price_tax_excl = Tools::ps_round($unitPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_excl = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$priceDiffTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl - $oldPriceTaxExcl;
$priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$priceDiffTaxExcl = $objServiceProductOrderDetail->total_price_tax_excl - $oldPriceTaxExcl;
$priceDiffTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$objOrderDetail->total_price_tax_excl += $priceDiffTaxExcl;
$objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl;
@@ -1179,13 +1179,13 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$unitPriceTaxExcl = $totalPriceTaxExcl / $quantity;
$unitPriceTaxIncl = $totalPriceTaxIncl / $quantity;
$objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = Tools::ps_round($unitPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->unit_price_tax_excl = Tools::ps_round($unitPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_excl = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$priceDiffTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl - $oldPriceTaxExcl;
$priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$priceDiffTaxExcl = $objServiceProductOrderDetail->total_price_tax_excl - $oldPriceTaxExcl;
$priceDiffTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$objOrderDetail->total_price_tax_excl += $priceDiffTaxExcl;
$objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl;
@@ -1203,13 +1203,13 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objAddress = new Address((int) $objOrder->id_address_tax);
$objTaxManager = TaxManagerFactory::getManager($objAddress, $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['id_tax_rules_group']);
$objTaxCalculator = $objTaxManager->getTaxCalculator();
$unitPriceTaxIncl = $objTaxCalculator->addTaxes($objRoomTypeServiceProductOrderDetail->unit_price_tax_excl);
$oldPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
$unitPriceTaxIncl = $objTaxCalculator->addTaxes($objServiceProductOrderDetail->unit_price_tax_excl);
$oldPriceTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl;
$objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round(($unitPriceTaxIncl * $quantity), _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round(($unitPriceTaxIncl * $quantity), _PS_PRICE_COMPUTE_PRECISION_);
$priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$priceDiffTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl;
$objOrderDetail->unit_price_tax_incl = Tools::ps_round(($objOrderDetail->total_price_tax_incl / $objOrderDetail->product_quantity), _PS_PRICE_COMPUTE_PRECISION_);
@@ -1219,13 +1219,13 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
} else if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])
&& $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax']
) {
$oldPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl + $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'];
$oldPriceTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl;
$objServiceProductOrderDetail->total_price_tax_incl = $objServiceProductOrderDetail->total_price_tax_excl + $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'];
$objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($objRoomTypeServiceProductOrderDetail->total_price_tax_incl / $quantity, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round(($objRoomTypeServiceProductOrderDetail->total_price_tax_incl), _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($objServiceProductOrderDetail->total_price_tax_incl / $quantity, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round(($objServiceProductOrderDetail->total_price_tax_incl), _PS_PRICE_COMPUTE_PRECISION_);
$priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$priceDiffTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl;
$objOrderDetail->unit_price_tax_incl = Tools::ps_round(($objOrderDetail->total_price_tax_incl / $objOrderDetail->product_quantity), _PS_PRICE_COMPUTE_PRECISION_);
@@ -1233,7 +1233,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objOrder->total_paid += $priceDiffTaxIncl;
}
$objRoomTypeServiceProductOrderDetail->save();
$objServiceProductOrderDetail->save();
$objOrderDetail->save();
}
}
@@ -1795,7 +1795,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objProduct->redirect_type = '404';
$objProduct->visibility = 'none';
$objProduct->minimal_quantity = 1;
$objProduct->service_product_type = Product::SERVICE_PRODUCT_WITH_ROOMTYPE;
$objProduct->selling_preference_type = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
$objProduct->allow_multiple_quantity = true;
$objProduct->max_quantity = $quantity;
if ($objProduct->save()) {
@@ -1822,18 +1822,18 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
public function removeAutoAddedServicesFromCart()
{
if (Validate::isLoadedobject($this->context->cart)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($serviceProducts = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$objServiceProductCartDetail = new ServiceProductCartDetail();
if ($serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
0,
0,
0,
0,
0,
0,
[],
0,
null,
1 // for auto added products
null,
null,
null,
null,
0,
1
)) {
foreach ($serviceProducts as $serviceProduct) {
$dateRoomJoinKey = strtotime($serviceProduct['date_from']).strtotime($serviceProduct['date_to']).$serviceProduct['id_room'];
@@ -1841,14 +1841,14 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
foreach ($serviceProduct['selected_products_info'] as $service) {
// Checking if the auto add service was sent in the request
if (!isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']])
&& ($idRoomTypeServiceProductCartDetail = $objRoomTypeServiceProductCartDetail->alreadyExists(
$service['id_product'],
&& ($idServiceProductCartDetail = $objServiceProductCartDetail->alreadyExists(
$this->context->cart->id,
$service['id_product'],
$serviceProduct['htl_cart_booking_id'])
)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $idRoomTypeServiceProductCartDetail);
$this->context->cart->updateQty($objRoomTypeServiceProductCartDetail->quantity, $objRoomTypeServiceProductCartDetail->id_product, null, false, 'down');
$objRoomTypeServiceProductCartDetail->delete();
$objServiceProductCartDetail = new ServiceProductCartDetail((int) $idServiceProductCartDetail);
$this->context->cart->updateQty($objServiceProductCartDetail->quantity, $objServiceProductCartDetail->id_product, null, false, 'down');
$objServiceProductCartDetail->delete();
}
}
}
@@ -1930,7 +1930,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
// only perform any update if request is valid.
// Update the information for the services that were updated in the existing rooms
if (count($roomsToUpdate)) {
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objBookingDemand = new HotelBookingDemands();
foreach ($roomsToUpdate as $roomsByDate) {
if (isset($roomsByDate['requested'])
@@ -1959,9 +1959,23 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
}
$idHotelBookingDetail = $roomsByDate['order'][$roomsKey]['id'];
if ($existingServices = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom($idHotelBookingDetail)) {
if (!empty($existingServices['additional_services'])) {
$this->removeServicesFromOrderedRoom($existingServices['additional_services']);
if ($existingServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
0,
0,
0,
0,
0,
0,
0,
0,
null,
0,
null,
0,
$idHotelBookingDetail
)) {
if (!empty($existingServices[$idHotelBookingDetail]['additional_services'])) {
$this->removeServicesFromOrderedRoom($existingServices[$idHotelBookingDetail]['additional_services']);
}
}
@@ -1983,9 +1997,23 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
&& $roomsByDate['order']
) {
$hotelBookingDetail = array_shift($roomsByDate['order']);
if ($existingServices = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom($hotelBookingDetail['id'])) {
if (!empty($existingServices['additional_services'])) {
$this->removeServicesFromOrderedRoom($existingServices['additional_services']);
if ($existingServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
0,
0,
0,
0,
0,
0,
0,
0,
null,
0,
null,
0,
$hotelBookingDetail['id']
)) {
if (!empty($existingServices[$hotelBookingDetail['id']]['additional_services'])) {
$this->removeServicesFromOrderedRoom($existingServices[$hotelBookingDetail['id']]['additional_services']);
}
}
@@ -2209,33 +2237,40 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
if ($objBookingDetail->save()) {
$objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice();
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$objServiceProductCartDetail = new ServiceProductCartDetail();
$dateRoomJoinKey = strtotime($objCartBookingData->date_from).strtotime($objCartBookingData->date_to).$objCartBookingData->id_room;
if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'])
&& ($services = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts($objCartBookingData->id))
) {
&& ($services = $objServiceProductCartDetail->getServiceProductsInCart(
$objCartBookingData->id_cart,
[],
null,
$objCartBookingData->id
))) {
foreach ($services as $service) {
$insertedServiceProductIdOrderDetail = $objBookingDetail->getLastInsertedServiceIdOrderDetail($objOrder->id, $service['id_product']);
$numDays = 1;
if (Product::getProductPriceCalculation($service['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$numDays = HotelHelper::getNumberOfDays($objBookingDetail->date_from, $objBookingDetail->date_to);
}
$totalPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice(
$totalPriceTaxExcl = Product::getServiceProductPrice(
$service['id_product'],
0,
false,
$roomTypeInfo['id'],
false,
$service['quantity'],
$objBookingDetail->date_from,
$objBookingDetail->date_to,
false
$objBookingDetail->date_to
);
$totalPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice(
$totalPriceTaxIncl = Product::getServiceProductPrice(
$service['id_product'],
0,
false,
$roomTypeInfo['id'],
true,
$service['quantity'],
$objBookingDetail->date_from,
$objBookingDetail->date_to,
true
$objBookingDetail->date_to
);
$unitPriceTaxExcl = $totalPriceTaxExcl / ($numDays * $service['quantity']);
$unitPriceTaxIncl = $totalPriceTaxIncl / ($numDays * $service['quantity']);
@@ -2295,22 +2330,22 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objOrderDetail->unit_price_tax_incl = Tools::ps_round(($objOrderDetail->total_price_tax_incl / $objOrderDetail->product_quantity), _PS_PRICE_COMPUTE_PRECISION_);
$objOrderDetail->save();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objRoomTypeServiceProductOrderDetail->id_product = $service['id_product'];
$objRoomTypeServiceProductOrderDetail->id_order = $objBookingDetail->id_order;
$objRoomTypeServiceProductOrderDetail->id_order_detail = $insertedServiceProductIdOrderDetail;
$objRoomTypeServiceProductOrderDetail->id_cart = $this->context->cart->id;
$objRoomTypeServiceProductOrderDetail->id_htl_booking_detail = $objBookingDetail->id;
$objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = Tools::ps_round($unitPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->name = $service['name'];
$objRoomTypeServiceProductOrderDetail->quantity = $service['quantity'];
$objRoomTypeServiceProductOrderDetail->save();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objServiceProductOrderDetail->id_product = $service['id_product'];
$objServiceProductOrderDetail->id_order = $objBookingDetail->id_order;
$objServiceProductOrderDetail->id_order_detail = $insertedServiceProductIdOrderDetail;
$objServiceProductOrderDetail->id_cart = $this->context->cart->id;
$objServiceProductOrderDetail->id_htl_booking_detail = $objBookingDetail->id;
$objServiceProductOrderDetail->unit_price_tax_excl = Tools::ps_round($unitPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_excl = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->name = $service['name'];
$objServiceProductOrderDetail->quantity = $service['quantity'];
$objServiceProductOrderDetail->save();
$objOrder->total_products += $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
$objOrder->total_products_wt += $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
$objOrder->total_products += $objServiceProductOrderDetail->total_price_tax_excl;
$objOrder->total_products_wt += $objServiceProductOrderDetail->total_price_tax_incl;
$objOrder->total_paid += Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objOrder->total_paid_tax_excl += Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
@@ -2460,7 +2495,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objOrder = new Order((int) $params['id']);
$objBookingDemand = new HotelBookingDemands();
$objHotelBookingDetail = new HotelBookingDetail();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
foreach ($roomsToRemove as $roomType) {
$dateFrom = $roomType['date_from'];
$dateTo = $roomType['date_to'];
@@ -2490,45 +2525,79 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
1,
0
);
$additionlServicesTI = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom(
$idHotelBooking,
$additionlServicesTI = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
0,
0,
0,
0,
0,
0,
0,
1,
1
);
$additionlServicesTE = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom(
$idHotelBooking,
1,
0
);
$selectedAdditonalServices = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom(
0,
null,
0,
$idHotelBooking
);
$additionlServicesTE = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
null,
0,
$idHotelBooking
);
$diffProductsTaxIncl = $bookingPriceTaxIncl;
$diffProductsTaxExcl = $bookingPriceTaxExcl;
$objHotelBookingDetail = new HotelBookingDetail((int) $idHotelBooking);
$roomQuantity = (int) HotelHelper::getNumberOfDays($dateFrom, $dateTo);
if (isset($selectedAdditonalServices['additional_services'])
&& count($selectedAdditonalServices['additional_services'])
) {
foreach ($selectedAdditonalServices['additional_services'] as $service) {
$serviceOrderDetail = new OrderDetail($service['id_order_detail']);
$cart_quantity = $service['quantity'];
if ($service['product_price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$cart_quantity = $cart_quantity * $quantity;
}
if ($selectedAdditonalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
0,
0,
0,
0,
0,
0,
0,
0,
null,
0,
null,
0,
$idHotelBooking
)) {
if (isset($selectedAdditonalServices[$idHotelBooking]['additional_services'])
&& count($selectedAdditonalServices[$idHotelBooking]['additional_services'])
) {
foreach ($selectedAdditonalServices[$idHotelBooking]['additional_services'] as $service) {
$serviceOrderDetail = new OrderDetail($service['id_order_detail']);
$cart_quantity = $service['quantity'];
if ($service['price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$cart_quantity = $cart_quantity * $quantity;
}
if ($cart_quantity >= $serviceOrderDetail->product_quantity) {
$serviceOrderDetail->delete();
} else {
$serviceOrderDetail->total_price_tax_incl -= Tools::ps_round($service['total_price_tax_incl'], _PS_PRICE_COMPUTE_PRECISION_);
$serviceOrderDetail->total_price_tax_excl -= Tools::ps_round($service['total_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_);
$serviceOrderDetail->product_quantity -= $cart_quantity;
if ($cart_quantity >= $serviceOrderDetail->product_quantity) {
$serviceOrderDetail->delete();
} else {
$serviceOrderDetail->total_price_tax_incl -= Tools::ps_round($service['total_price_tax_incl'], _PS_PRICE_COMPUTE_PRECISION_);
$serviceOrderDetail->total_price_tax_excl -= Tools::ps_round($service['total_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_);
$serviceOrderDetail->product_quantity -= $cart_quantity;
// update taxes
$serviceOrderDetail->updateTaxAmount($objOrder);
// update taxes
$serviceOrderDetail->updateTaxAmount($objOrder);
// Save order detail
$serviceOrderDetail->update();
// Save order detail
$serviceOrderDetail->update();
}
}
}
}
@@ -2558,7 +2627,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objOrder->update();
// delete the demands of this booking
$objBookingDemand->deleteBookingDemands($idHotelBooking);
$objRoomTypeServiceProductOrderDetail->deleteRoomSevices($idHotelBooking);
$objServiceProductOrderDetail->deleteSeviceProducts(0, $idHotelBooking);
$objHotelCartBookingData = new HotelCartBookingData();
$objHotelCartBookingData->deleteOrderedRoomFromCart(
$objOrder->id,
@@ -3018,20 +3087,20 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
{
if (count($services)) {
foreach ($services as $service) {
$idRoomTypeServiceProductOrderDetail = $service['id_room_type_service_product_order_detail'];
if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail((int) $idRoomTypeServiceProductOrderDetail))) {
$objOrderDetail = new OrderDetail((int) $objRoomTypeServiceProductOrderDetail->id_order_detail);
$priceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
$priceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
$objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail);
$idServiceProductOrderDetail = $service['id_service_product_order_detail'];
if (Validate::isLoadedObject($objServiceProductOrderDetail = new ServiceProductOrderDetail((int) $idServiceProductOrderDetail))) {
$objOrderDetail = new OrderDetail((int) $objServiceProductOrderDetail->id_order_detail);
$priceTaxExcl = $objServiceProductOrderDetail->total_price_tax_excl;
$priceTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl;
$objHotelBookingDetail = new HotelBookingDetail($objServiceProductOrderDetail->id_htl_booking_detail);
$numDays = 1;
if (Product::getProductPriceCalculation($service['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$numDays = HotelHelper::getNumberOfDays($objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to);
}
$quantity = $objRoomTypeServiceProductOrderDetail->quantity * $numDays;
if ($objRoomTypeServiceProductOrderDetail->delete()) {
$objOrder = new Order($objRoomTypeServiceProductOrderDetail->id_order);
$quantity = $objServiceProductOrderDetail->quantity * $numDays;
if ($objServiceProductOrderDetail->delete()) {
$objOrder = new Order($objServiceProductOrderDetail->id_order);
if ($quantity >= $objOrderDetail->product_quantity) {
$objOrderDetail->delete();
} else {
@@ -3068,7 +3137,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$this->context->currency = new Currency($objOrder->id_currency);
$objHotelCartBookingData = new HotelCartBookingData();
$objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice();
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$objServiceProductCartDetail = new ServiceProductCartDetail();
$roomHtlCartInfo = $objHotelCartBookingData->getRoomRowByIdProductIdRoomInDateRange(
$objHotelBookingDetail->id_cart,
$objHotelBookingDetail->id_product,
@@ -3091,10 +3160,11 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$services = $formattedServices;
foreach ($services as $service) {
$objRoomTypeServiceProductCartDetail->addServiceProductInCart(
$objServiceProductCartDetail->addServiceProductInCart(
$objCart->id,
$service['id_product'],
$service['quantity'],
$objCart->id,
false,
$roomHtlCartInfo['id']
);
}
@@ -3104,34 +3174,39 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objOrderDetail = new OrderDetail();
$objOrderDetail->createList($objOrder, $objCart, $objOrder->getCurrentOrderState(), $productList, 0, true);
foreach ($productList as &$product) {
if ($idRoomTypeServiceProductCartDetail = $objRoomTypeServiceProductCartDetail->alreadyExists(
$product['id_product'],
if ($idServiceProductCartDetail = $objServiceProductCartDetail->alreadyExists(
$objCart->id,
$product['id_product'],
$roomHtlCartInfo['id'])
) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $idRoomTypeServiceProductCartDetail);
$objServiceProductCartDetail = new ServiceProductCartDetail((int) $idServiceProductCartDetail);
$numDays = 1;
if (Product::getProductPriceCalculation($product['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$numDays = HotelHelper::getNumberOfDays($objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to);
}
$quantity = $objRoomTypeServiceProductCartDetail->quantity * $numDays;
$unitPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice(
$quantity = $objServiceProductCartDetail->quantity * $numDays;
$unitPriceTaxExcl = Product::getServiceProductPrice(
(int) $product['id_product'],
0,
false,
false,
false,
1,
$objHotelBookingDetail->date_from,
$objHotelBookingDetail->date_to,
false,
$objCart->id
)/ $numDays;
$unitPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice(
$unitPriceTaxIncl = Product::getServiceProductPrice(
(int) $product['id_product'],
0,
false,
false,
true,
1,
$objHotelBookingDetail->date_from,
$objHotelBookingDetail->date_to,
true,
$objCart->id
)/ $numDays;
@@ -3175,32 +3250,32 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$unitPriceTaxIncl = Tools::ps_round($totalPriceTaxIncl / $quantity, _PS_PRICE_COMPUTE_PRECISION_);
}
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objRoomTypeServiceProductOrderDetail->id_product = $product['id_product'];
$objRoomTypeServiceProductOrderDetail->id_order = $objHotelBookingDetail->id_order;
$objRoomTypeServiceProductOrderDetail->id_order_detail = $objOrderDetail->id;
$objRoomTypeServiceProductOrderDetail->id_cart = $objCart->id;
$objRoomTypeServiceProductOrderDetail->id_htl_booking_detail = $objHotelBookingDetail->id;
$objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = Tools::ps_round($unitPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objRoomTypeServiceProductOrderDetail->name = $product['name'];
$objRoomTypeServiceProductOrderDetail->quantity = $objRoomTypeServiceProductCartDetail->quantity;
$objRoomTypeServiceProductOrderDetail->save();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objServiceProductOrderDetail->id_product = $product['id_product'];
$objServiceProductOrderDetail->id_order = $objHotelBookingDetail->id_order;
$objServiceProductOrderDetail->id_order_detail = $objOrderDetail->id;
$objServiceProductOrderDetail->id_cart = $objCart->id;
$objServiceProductOrderDetail->id_htl_booking_detail = $objHotelBookingDetail->id;
$objServiceProductOrderDetail->unit_price_tax_excl = Tools::ps_round($unitPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_excl = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$objServiceProductOrderDetail->name = $product['name'];
$objServiceProductOrderDetail->quantity = $objServiceProductCartDetail->quantity;
$objServiceProductOrderDetail->save();
// update totals amount of order
$objOrder->total_products += $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
$objOrder->total_products_wt += $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
$objOrder->total_products += $objServiceProductOrderDetail->total_price_tax_excl;
$objOrder->total_products_wt += $objServiceProductOrderDetail->total_price_tax_incl;
$objOrder->total_paid += Tools::ps_round($objRoomTypeServiceProductOrderDetail->total_price_tax_incl, _PS_PRICE_COMPUTE_PRECISION_);
$objOrder->total_paid_tax_excl += Tools::ps_round($objRoomTypeServiceProductOrderDetail->total_price_tax_excl, _PS_PRICE_COMPUTE_PRECISION_);
$objOrder->total_paid_tax_incl += Tools::ps_round($objRoomTypeServiceProductOrderDetail->total_price_tax_incl, _PS_PRICE_COMPUTE_PRECISION_);
$objOrder->total_paid += Tools::ps_round($objServiceProductOrderDetail->total_price_tax_incl, _PS_PRICE_COMPUTE_PRECISION_);
$objOrder->total_paid_tax_excl += Tools::ps_round($objServiceProductOrderDetail->total_price_tax_excl, _PS_PRICE_COMPUTE_PRECISION_);
$objOrder->total_paid_tax_incl += Tools::ps_round($objServiceProductOrderDetail->total_price_tax_incl, _PS_PRICE_COMPUTE_PRECISION_);
$objOrderDetail->unit_price_tax_incl += $unitPriceTaxIncl;
$objOrderDetail->total_price_tax_incl += $unitPriceTaxIncl * $objRoomTypeServiceProductOrderDetail->quantity;
$objOrderDetail->total_price_tax_incl += $unitPriceTaxIncl * $objServiceProductOrderDetail->quantity;
$objOrderDetail->unit_price_tax_excl += $unitPriceTaxExcl;
$objOrderDetail->total_price_tax_excl += $unitPriceTaxExcl * $objRoomTypeServiceProductOrderDetail->quantity;
$objOrderDetail->total_price_tax_excl += $unitPriceTaxExcl * $objServiceProductOrderDetail->quantity;
}
}
@@ -3375,7 +3450,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objCurrency = new Currency($objOrder->id_currency);
$objBookingDetail = new HotelBookingDetail();
$objBookingDemand = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objOrderReturn = new OrderReturn();
$idHotel = HotelBookingDetail::getIdHotelByIdOrder($objOrder->id);
$objHotelBranchInformation = new HotelBranchInformation($idHotel, Configuration::get('PS_LANG_DEFAULT'));
@@ -3490,7 +3565,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
unset($roomInfo['services']);
}
if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$orderData['id_order'],
0,
0,

View File

@@ -1089,6 +1089,18 @@ class AdminCartsControllerCore extends AdminController
}
}
public function ajaxProcessUpdateProductQuantity()
{
$params = Tools::getValue('params');
$idProduct = (int) $params['id_product'];
$idCart = (int) $params['id_cart'];
$this->context->cart = new Cart($idCart);
if ($this->tabAccess['edit'] === '1') {
$product = new Product($idProduct, true, $this->context->language->id);
}
}
// Process to get extra demands of any room while order creation process form.tpl
public function ajaxProcessGetRoomTypeCartDemands()
{
@@ -1135,35 +1147,55 @@ class AdminCartsControllerCore extends AdminController
}
}
$selectedRoomServiceProduct = array();
if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) {
// get all services
$objProduct = new Product();
$serviceProducts = $objProduct->getServiceProducts(true);
$hotelServiceProducts = $objProduct->getServiceProducts(null, Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE);
$roomTypeServiceProducts = $objProduct->getServiceProducts(null, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
$serviceProducts = array_merge($roomTypeServiceProducts, $hotelServiceProducts);
} else {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null);
}
if ($serviceProducts) {
$objRoomTypeServPrice = new RoomTypeServiceProductPrice();
foreach ($serviceProducts as $key => $servProduct) {
$serviceProducts[$key]['price_tax_exc'] = $objRoomTypeServPrice->getServicePrice($servProduct['id_product'], 0, 1, null, null, false, $idCart);
$serviceProducts[$key]['price_tax_exc'] = Product::getServiceProductPrice(
$servProduct['id_product'],
0,
0,
$idProduct,
false,
1,
$dateFrom,
$dateTo,
$idCart
);
}
}
if ($selectedRoomServiceProduct = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange(
$objServiceProductCartDetail = new ServiceProductCartDetail();
if ($selectedRoomServiceProduct = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange(
$idCart,
$idProduct,
$dateFrom,
$dateTo,
$idRoom
)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$selectedRoomServiceProduct['selected_service'] = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts(
$selectedRoomServiceProduct['selected_service'] = $objServiceProductCartDetail->getServiceProductsInCart(
$idCart,
[],
null,
$selectedRoomServiceProduct['id'],
null,
null,
null,
null,
0,
null,
null
null,
1
);
}
@@ -1211,65 +1243,6 @@ class AdminCartsControllerCore extends AdminController
}
}
public function ajaxProcessUpdateServiceProduct()
{
if ($this->tabAccess['edit'] === '1') {
$operator = Tools::getValue('operator', 'up');
$idServiceProduct = Tools::getValue('id_product');
$idCartBooking = Tools::getValue('id_cart_booking');
$qty = Tools::getValue('qty');
if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($operator == 'up') {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelCartBookingData->id_product, $idServiceProduct)) {
// validate quanitity
if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) {
if ($objProduct->allow_multiple_quantity) {
if (!Validate::isUnsignedInt($qty)) {
$this->errors[] = Tools::displayError('The quantity code you\'ve entered is invalid.');
// } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) {
// $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity));
}
} else {
$qty = 1;
}
} else {
$this->errors[] = Tools::displayError('This Service is not available.');
}
} else {
$this->errors[] = Tools::displayError('This Service is not available with selected room.');
}
}
if (empty($this->errors)) {
if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct(
$idCartBooking,
$idServiceProduct,
$qty,
$objHotelCartBookingData->id_cart,
$operator
)) {
$this->ajaxDie(json_encode(array(
'hasError' => false
)));
} else {
$this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.');
}
}
} else {
$this->errors[] = Tools::displayError('Room not found. Please try reloading the page.');
}
$this->ajaxDie(json_encode(array(
'hasError' => true,
'errors' => $this->errors
)));
}
}
public static function getOrderTotalUsingTaxCalculationMethod($id_cart)
{
$context = Context::getContext();
@@ -1393,7 +1366,7 @@ class AdminCartsControllerCore extends AdminController
// ======= START: Create Service product =========
$objServiceProduct = new Product();
$objServiceProduct->price_calculation_method = $priceCalcMethod;
$objServiceProduct->service_product_type = Product::SERVICE_PRODUCT_WITH_ROOMTYPE;
$objServiceProduct->selling_preference_type = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
$objServiceProduct->id_category_default = Configuration::get('PS_SERVICE_CATEGORY');
$objServiceProduct->name[Configuration::get('PS_LANG_DEFAULT')] = $name;
$objServiceProduct->id_shop_default = Configuration::get('PS_SHOP_DEFAULT');
@@ -1419,15 +1392,22 @@ class AdminCartsControllerCore extends AdminController
// ======= Create Service product END =========
if ($objServiceProduct->save()) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$objRoomTypeServiceProduct->addRoomProductLink(
$objServiceProduct->id,
[$objHtlCartBooking->id_product],
RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE
);
// If service product is create successfully the start adding the product in cart and order
$objCart = new Cart($objHtlCartBooking->id_cart);
$objServiceProduct = new Product($objServiceProduct->id, false, $objCart->id_lang);
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($objRoomTypeServiceProductCartDetail->addServiceProductInCart(
$objServiceProductCartDetail = new ServiceProductCartDetail();
if ($objServiceProductCartDetail->addServiceProductInCart(
$objCart->id,
$objServiceProduct->id,
$productQty,
$objCart->id,
0,
$objHtlCartBooking->id
)) {
// Lets create a specific price for the service to match the price provided by the user
@@ -1486,7 +1466,9 @@ class AdminCartsControllerCore extends AdminController
if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) {
// get all services
$objProduct = new Product();
$serviceProducts = $objProduct->getServiceProducts(true);
$hotelServiceProducts = $objProduct->getServiceProducts(null, Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE);
$roomTypeServiceProducts = $objProduct->getServiceProducts(null, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
$serviceProducts = array_merge($roomTypeServiceProducts, $hotelServiceProducts);
} else {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($objCartBookingData->id_product, 1, 0, false, 2, null);
@@ -1495,27 +1477,30 @@ class AdminCartsControllerCore extends AdminController
if ($serviceProducts) {
foreach ($serviceProducts as $key => $servProduct) {
$serviceProducts[$key]['price_tax_exc'] = $servProduct['price'];
if ($additionalServices
&& (in_array($servProduct['id_product'], array_column($additionalServices['additional_services'], 'id_product')))
) {
unset($serviceProducts[$key]);
}
}
}
if ($selectedRoomServiceProduct = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange(
$objServiceProductCartDetail = new ServiceProductCartDetail();
if ($selectedRoomServiceProduct = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange(
$objCartBookingData->id_cart,
$objCartBookingData->id_product,
$objCartBookingData->date_from,
$objCartBookingData->date_to,
$objCartBookingData->id_room
)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$selectedRoomServiceProduct['selected_service'] = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts(
$selectedRoomServiceProduct['selected_service'] = $objServiceProductCartDetail->getServiceProductsInCart(
$objCartBookingData->id_cart,
[],
null,
$selectedRoomServiceProduct['id'],
null,
null,
null,
null,
0,
null,
null
null,
1
);
}
@@ -1584,7 +1569,7 @@ class AdminCartsControllerCore extends AdminController
if (!$response['hasError']) {
$result = true;
$objRoomTypeServiceProductCart = new RoomTypeServiceProductCartDetail();
$objServiceProductCartDetail = new ServiceProductCartDetail();
foreach ($selectedServiceProducts as $idServiceProduct => $selected) {
if ($selected) {
$operator = 'up';
@@ -1593,12 +1578,13 @@ class AdminCartsControllerCore extends AdminController
}
$quantity = $serviceQuantities[$idServiceProduct];
$unitPrice = $serviceUnitPrices[$idServiceProduct];
if ($result &= $objRoomTypeServiceProductCart->updateCartServiceProduct(
$idCartBooking,
$idServiceProduct,
$quantity,
if ($result &= $objServiceProductCartDetail->updateCartServiceProduct(
$objHotelCartBookingData->id_cart,
$idServiceProduct,
$operator,
$quantity,
0,
$idCartBooking
)) {
$originalPrice = Product::getPriceStatic($idServiceProduct, false);
// if price is different than the original service price then update the price

View File

@@ -1868,7 +1868,7 @@ class AdminImportControllerCore extends AdminController
}
$objServiceProduct = new Product($idServiceProduct);
if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $objServiceProduct->service_product_type) {
if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $objServiceProduct->selling_preference_type) {
$objRoomTypeServiceProduct->addRoomProductLink(
$objServiceProduct->id,
$product->id,
@@ -2240,7 +2240,7 @@ class AdminImportControllerCore extends AdminController
$product->price_addition_type = Product::PRICE_ADDITION_TYPE_WITH_ROOM;
}
$product->service_product_type = Product::SERVICE_PRODUCT_WITH_ROOMTYPE;
$product->selling_preference_type = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
if (!$serviceProductExists) {
if (isset($product->date_add) && $product->date_add != '') {
$res = $product->add(false);
@@ -2296,7 +2296,7 @@ class AdminImportControllerCore extends AdminController
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
RoomTypeServiceProduct::deleteRoomProductLink($product->id);
if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product->service_product_type) {
if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product->selling_preference_type) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
if (isset($info['id_room_types']) && $info['id_room_types']) {
$objRoomTypeServiceProduct->addRoomProductLink(
@@ -3278,7 +3278,6 @@ class AdminImportControllerCore extends AdminController
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_cart_booking_data`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_branch_refund_rules`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_order_restrict_date`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_hotel_service_product_cart_detail`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_branch_info`');
$objHotelReservation = Module::getInstanceByName('hotelreservationsystem');
$hotelImages = $objHotelReservation->getLocalPath().'views/img/hotel_img/';
@@ -3320,7 +3319,7 @@ class AdminImportControllerCore extends AdminController
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_demand_price`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_demand`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_service_product_price`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'service_product_cart_detail`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_restriction_date_range`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'feature_product`');
@@ -3386,7 +3385,7 @@ class AdminImportControllerCore extends AdminController
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_service_product`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_service_product_price`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail`');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'service_product_cart_detail`');
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product` WHERE booking_product=0');
break;
case $this->entities[$this->l('Customers')]:
@@ -3423,9 +3422,8 @@ class AdminImportControllerCore extends AdminController
'htl_booking_detail',
'htl_booking_demands',
'htl_booking_demands_tax',
'htl_room_type_service_product_order_detail',
'htl_room_type_service_product_cart_detail',
'htl_hotel_service_product_cart_detail',
'service_product_order_detail',
'service_product_cart_detail',
);
foreach($orderRelatedTables as $table) {
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.$table.'`');

View File

@@ -102,6 +102,8 @@ class AdminNormalProductsControllerCore extends AdminController
// 'Seo' => $this->l('SEO'),
'Images' => $this->l('Images'),
'Associations' => $this->l('Associations'),
// 'Quantities' => $this->l('Quantities'), // Code For Standard product working
// 'Options' => $this->l('Options'),// Code For Standard product working
);
if ($this->context->shop->getContext() != Shop::CONTEXT_GROUP) {
@@ -111,6 +113,8 @@ class AdminNormalProductsControllerCore extends AdminController
// 'Seo' => 2,
'Associations' => 3,
'Images' => 4,
// 'Quantities' => 5, // Code For Standard product working
// 'Options' => 6// Code For Standard product working
));
}
@@ -118,7 +122,7 @@ class AdminNormalProductsControllerCore extends AdminController
asort($this->available_tabs, SORT_NUMERIC);
/* Adding tab if modules are hooked */
$modules_list = Hook::getHookModuleExecList('displayAdminNormalProductsExtra');
$modules_list = Hook::getHookModuleExecList('displayAdminServiceProductsExtra');
if (is_array($modules_list) && count($modules_list) > 0) {
foreach ($modules_list as $m) {
// if module is setting name of the tab at the product edit page
@@ -208,6 +212,9 @@ class AdminNormalProductsControllerCore extends AdminController
// show the list of the product according to the booking or service products
$this->_where .= ' AND a.`booking_product` = 0';
// Code For Standard product working
$this->_where .= ' AND a.`selling_preference_type` = '.(int)Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
$this->_group = 'GROUP BY a.`id_product`';
$this->fields_list = array();
@@ -291,17 +298,22 @@ class AdminNormalProductsControllerCore extends AdminController
'filter_key' => 'a!id_category_default',
'optional' => true,
);
// $serviceProductType = array(
// Product::SERVICE_PRODUCT_WITH_ROOMTYPE => $this->l('Bought with room type'),
// Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE => $this->l('Bought without room type')
// Code For Standard product working
// $sellingPreferenceTypes = array(
// Product::SELLING_PREFERENCE_WITH_ROOM_TYPE => $this->l('With room type'),
// Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE => $this->l('With hotel|room type'),
// Product::SELLING_PREFERENCE_STANDALONE => $this->l('Standalone'),
// Product::SELLING_PREFERENCE_HOTEL_STANDALONE => $this->l('With hotel'),
// );
// $this->fields_list['service_product_type'] = array(
// $this->fields_list['selling_preference_type'] = array(
// 'type' => 'select',
// 'list' => $serviceProductType,
// 'list' => $sellingPreferenceTypes,
// 'title' => $this->l('Buying option'),
// 'filter_key' => 'a!service_product_type',
// 'filter_key' => 'a!selling_preference_type',
// 'callback' => 'getBuyingOption'
// );
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) {
$this->fields_list['shopname'] = array(
'title' => $this->l('Default shop'),
@@ -387,12 +399,16 @@ class AdminNormalProductsControllerCore extends AdminController
}
}
public function getBuyingOption($service_product_type, $row)
public function getBuyingOption($selling_preference_type, $row)
{
if ($service_product_type == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) {
if ($selling_preference_type == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) {
return $this->l('With room type');
} else if ($service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
return $this->l('Without room type');
} else if ($selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE) {
return $this->l('With hotel|room type');
} else if ($selling_preference_type == Product::SELLING_PREFERENCE_STANDALONE) {
return $this->l('Standalone');
} else if ($selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE) {
return $this->l('With hotel');
}
return '--';
@@ -1873,8 +1889,10 @@ class AdminNormalProductsControllerCore extends AdminController
$_POST['allow_multiple_quantity'] = 0;
}
// Code For Standard product working
$_POST['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
$this->copyFromPost($this->object, $this->table);
$this->object->service_product_type = Product::SERVICE_PRODUCT_WITH_ROOMTYPE;
// set product visibility to none for current flow.
@@ -2018,6 +2036,10 @@ class AdminNormalProductsControllerCore extends AdminController
if (Validate::isLoadedObject($object)) {
$this->_removeTaxFromEcotax();
$product_type_before = $object->getType();
// Code For Standard product working
$_POST['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
$this->copyFromPost($object, $this->table);
$object->indexed = 0;
@@ -2083,6 +2105,9 @@ class AdminNormalProductsControllerCore extends AdminController
if ($this->isTabSubmitted('Occupancy')) {
$this->processOccupancy();
}
if ($this->isTabSubmitted('Options')) {
$this->processOptions();
}
$this->updateLinkedHotelsAndRooms($this->object);
// Disallow avanced stock management if the product become a pack
@@ -2929,8 +2954,9 @@ class AdminNormalProductsControllerCore extends AdminController
{
if (Validate::isLoadedObject($product)) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$associatedRoomTypes = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id)['room_type'];
if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product->service_product_type) {
$allAssociations = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id);
if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product->selling_preference_type) {
$associatedRoomTypes = $allAssociations['room_type'];
$selectedRoomTypes = Tools::getValue('room_type_box');
// Generate list of new associations
@@ -2966,15 +2992,129 @@ class AdminNormalProductsControllerCore extends AdminController
RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE
);
}
} else {
RoomTypeServiceProduct::deleteRoomProductLink(
$product->id,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL
);
} elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $product->selling_preference_type) {
$associatedHotels = $allAssociations['hotel'];
$selectedHotel = Tools::getValue('hotel_box');
// Generate list of new associations
$newHotels = array();
foreach ($selectedHotel as $selectedRoomType) {
if (!in_array($selectedRoomType, $associatedHotels)) {
$newHotels[] = $selectedRoomType;
}
}
// Generate list of associations to remove
$removedHotels = array();
foreach ($associatedHotels as $associatedRoomType) {
if (!in_array($associatedRoomType, $selectedHotel)) {
$removedHotels[] = $associatedRoomType;
}
}
// Remove associations
foreach ($removedHotels as $removedHotel) {
RoomTypeServiceProduct::deleteRoomProductLink(
$product->id,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL,
$removedHotel
);
}
// Save new associations
if ($newHotels) {
$objRoomTypeServiceProduct->addRoomProductLink(
$product->id,
$newHotels,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL
);
}
RoomTypeServiceProduct::deleteRoomProductLink(
$product->id,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE
);
} elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $product->selling_preference_type) {
// Add room types linking
$associatedRoomTypes = $allAssociations['room_type'];
$selectedRoomTypes = Tools::getValue('room_type_box');
// Generate list of new associations
$newRoomTypes = array();
foreach ($selectedRoomTypes as $selectedRoomType) {
if (!in_array($selectedRoomType, $associatedRoomTypes)) {
$newRoomTypes[] = $selectedRoomType;
}
}
// Generate list of associations to remove
$removedRoomTypes = array();
foreach ($associatedRoomTypes as $associatedRoomType) {
if (!in_array($associatedRoomType, $selectedRoomTypes)) {
$removedRoomTypes[] = $associatedRoomType;
}
}
// Remove old associations
foreach ($removedRoomTypes as $removedRoomType) {
RoomTypeServiceProduct::deleteRoomProductLink(
$product->id,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE,
$associatedRoomType
$removedRoomType
);
}
// Save new associations
if ($newRoomTypes) {
$objRoomTypeServiceProduct->addRoomProductLink(
$product->id,
$newRoomTypes,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE
);
}
// Add hotels linking
$associatedHotels = $allAssociations['hotel'];
$selectedHotel = Tools::getValue('hotel_box');
// Generate list of new associations
$newHotels = array();
foreach ($selectedHotel as $selectedRoomType) {
if (!in_array($selectedRoomType, $associatedHotels)) {
$newHotels[] = $selectedRoomType;
}
}
// Generate list of associations to remove
$removedHotels = array();
foreach ($associatedHotels as $associatedRoomType) {
if (!in_array($associatedRoomType, $selectedHotel)) {
$removedHotels[] = $associatedRoomType;
}
}
// Remove old associations
foreach ($removedHotels as $removedHotel) {
RoomTypeServiceProduct::deleteRoomProductLink(
$product->id,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL,
$removedHotel
);
}
// Save new associations
if ($newHotels) {
$objRoomTypeServiceProduct->addRoomProductLink(
$product->id,
$newHotels,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL
);
}
} else {
// Remove associations
RoomTypeServiceProduct::deleteRoomProductLink(
$product->id
);
}
}
}
@@ -3241,6 +3381,160 @@ class AdminNormalProductsControllerCore extends AdminController
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
/**
* @param Product $obj
* @throws Exception
* @throws SmartyException
*/
public function initFormQuantities($obj)
{
if (!$this->default_form_language) {
$this->getLanguages();
}
$data = $this->createTemplate($this->tpl_form);
$data->assign('default_form_language', $this->default_form_language);
if ($obj->id) {
if ($this->product_exists_in_shop) {
// Get all id_product_attribute
$attributes = $obj->getAttributesResume($this->context->language->id);
if (empty($attributes)) {
$attributes[] = array(
'id_product_attribute' => 0,
'attribute_designation' => ''
);
}
// Get available quantities
$available_quantity = array();
$product_designation = array();
foreach ($attributes as $attribute) {
// Get available quantity for the current product attribute in the current shop
$available_quantity[$attribute['id_product_attribute']] = isset($attribute['id_product_attribute']) && $attribute['id_product_attribute'] ? (int)$attribute['quantity'] : (int)$obj->quantity;
// Get all product designation
$product_designation[$attribute['id_product_attribute']] = rtrim(
$obj->name[$this->context->language->id].' - '.$attribute['attribute_designation'],
' - '
);
}
$show_quantities = true;
$shop_context = Shop::getContext();
$shop_group = new ShopGroup((int)Shop::getContextShopGroupID());
// if we are in all shops context, it's not possible to manage quantities at this level
if (Shop::isFeatureActive() && $shop_context == Shop::CONTEXT_ALL) {
$show_quantities = false;
}
// if we are in group shop context
elseif (Shop::isFeatureActive() && $shop_context == Shop::CONTEXT_GROUP) {
// if quantities are not shared between shops of the group, it's not possible to manage them at group level
if (!$shop_group->share_stock) {
$show_quantities = false;
}
}
// if we are in shop context
elseif (Shop::isFeatureActive()) {
// if quantities are shared between shops of the group, it's not possible to manage them for a given shop
if ($shop_group->share_stock) {
$show_quantities = false;
}
}
$data->assign('ps_stock_management', Configuration::get('PS_STOCK_MANAGEMENT'));
$data->assign('has_attribute', $obj->hasAttributes());
// Check if product has combination, to display the available date only for the product or for each combination
if (Combination::isFeatureActive()) {
$data->assign('countAttributes', (int)Db::getInstance()->getValue('SELECT COUNT(id_product) FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.(int)$obj->id));
} else {
$data->assign('countAttributes', false);
}
// if advanced stock management is active, checks associations
$advanced_stock_management_warning = false;
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $obj->advanced_stock_management) {
$p_attributes = Product::getProductAttributesIds($obj->id);
$warehouses = array();
if (!$p_attributes) {
$warehouses[] = Warehouse::getProductWarehouseList($obj->id, 0);
}
foreach ($p_attributes as $p_attribute) {
$ws = Warehouse::getProductWarehouseList($obj->id, $p_attribute['id_product_attribute']);
if ($ws) {
$warehouses[] = $ws;
}
}
$warehouses = Tools::arrayUnique($warehouses);
if (empty($warehouses)) {
$advanced_stock_management_warning = true;
}
}
if ($advanced_stock_management_warning) {
$this->displayWarning($this->l('If you wish to use the advanced stock management, you must:'));
$this->displayWarning('- '.$this->l('associate your room types with warehouses.'));
$this->displayWarning('- '.$this->l('associate your warehouses with carriers.'));
$this->displayWarning('- '.$this->l('associate your warehouses with the appropriate shops.'));
}
$pack_quantity = null;
// if product is a pack
if (Pack::isPack($obj->id)) {
$items = Pack::getItems((int)$obj->id, Configuration::get('PS_LANG_DEFAULT'));
// gets an array of quantities (quantity for the product / quantity in pack)
$pack_quantities = array();
foreach ($items as $item) {
/** @var Product $item */
if (!$item->isAvailableWhenOutOfStock((int)$item->out_of_stock)) {
$pack_id_product_attribute = Product::getDefaultAttribute($item->id, 1);
$pack_quantities[] = Product::getQuantity($item->id, $pack_id_product_attribute) / ($item->pack_quantity !== 0 ? $item->pack_quantity : 1);
}
}
// gets the minimum
if (count($pack_quantities)) {
$pack_quantity = $pack_quantities[0];
foreach ($pack_quantities as $value) {
if ($pack_quantity > $value) {
$pack_quantity = $value;
}
}
}
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && !Warehouse::getPackWarehouses((int)$obj->id)) {
$this->displayWarning($this->l('You must have a common warehouse between this pack and its room type.'));
}
}
$data->assign(array(
'attributes' => $attributes,
'available_quantity' => $available_quantity,
'pack_quantity' => $pack_quantity,
'stock_management_active' => Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'),
'product_designation' => $product_designation,
'product' => $obj,
'show_quantities' => $show_quantities,
'order_out_of_stock' => Configuration::get('PS_ORDER_OUT_OF_STOCK'),
'pack_stock_type' => Configuration::get('PS_PACK_STOCK_TYPE'),
'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'),
'token' => $this->token,
'languages' => $this->_languages,
'id_lang' => $this->context->language->id
));
} else {
$this->displayWarning($this->l('You must save the room type in this shop before managing quantities.'));
}
} else {
$this->displayWarning($this->l('You must save this room type before managing quantities.'));
}
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
protected function _getFinalPrice($specific_price, $product_price, $tax_rate)
{
return $this->object->getPrice(false, $specific_price['id_product_attribute'], 2);
@@ -3552,13 +3846,26 @@ class AdminNormalProductsControllerCore extends AdminController
}
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$selectedElements = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id);
$selectetRoomTypes = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE);
$selectetHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL);
$tree = new HelperTree('hotels-room-tree');
$tree->setData(HotelHelper::generateTreeData([
'rootNode' => HotelHelper::NODE_HOTEL,
'leafNode' => HotelHelper::NODE_ROOM_TYPE,
'selectedElements' => $selectetRoomTypes
]))
->setUseCheckBox(true)
->setAutoSelectChildren(true)
->setUseBulkActions(true)
->setUseSearch(true);
$data->assign('hotel_room_tree', $tree->render());
$tree = new HelperTree('hotels-tree');
$tree->setData(HotelHelper::generateTreeData([
'rootNode' => HotelHelper::NODE_HOTEL,
'leafNode' => HotelHelper::NODE_ROOM_TYPE,
'selectedElements' => $selectedElements
'leafNode' => HotelHelper::NODE_HOTEL,
'selectedElements' => $selectetHotels
]))
->setUseCheckBox(true)
->setAutoSelectChildren(true)
@@ -3595,6 +3902,77 @@ class AdminNormalProductsControllerCore extends AdminController
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormOptions($product)
{
if (!$this->default_form_language) {
$this->getLanguages();
}
$data = $this->createTemplate($this->tpl_form);
$currency = $this->context->currency;
$objServiceProductOption = new ServiceProductOption();
$serviceProductOptions = $objServiceProductOption->getProductOptions($product->id);
$data->assign(array(
'languages' => $this->_languages,
'default_form_language' => $this->default_form_language,
'currency' => $currency,
'serviceProductOptions' => $serviceProductOptions
));
$this->object = $product;
$this->tpl_form_vars['product'] = $product;
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function processOptions()
{
if ($this->tabAccess['edit'] === '0') {
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
}
$idProduct = Tools::getValue('id_product');
$productOptionNames = Tools::getValue('product_option_name');
$productOptionPrices = Tools::getValue('product_option_price');
// validate data
if ($productOptionNames && $productOptionPrices) {
$languages = Language::getLanguages(false);
foreach ($productOptionNames as $key => $name) {
if ($name || $productOptionPrices[$key]) {
if (!Validate::isGenericName($name)) {
$this->errors[] = $this->l('Option name is invalid for option: ').($key+1);
}
if (!Validate::isFloat($productOptionPrices[$key])) {
$this->errors[] = $this->l('Option price is invalid for option: ').($key+1);
}
}
}
}
if (!$this->errors) {
$productOptionIds = Tools::getValue('product_option_id');
if ($productOptionNames && $productOptionPrices) {
$languages = Language::getLanguages(false);
foreach ($productOptionNames as $key => $name) {
if ($name) {
if (isset($productOptionIds[$key]) && $productOptionIds[$key]) {
$objServiceProductOption = new ServiceProductOption($productOptionIds[$key]);
} else {
$objServiceProductOption = new ServiceProductOption();
}
$objServiceProductOption->id_product = $idProduct;
$objServiceProductOption->price_impact = $productOptionPrices[$key];
foreach ($languages as $lang) {
$objServiceProductOption->name[$lang['id_lang']] = $name;
}
$objServiceProductOption->save();
}
}
}
}
}
protected function getCarrierList()
{
$carrier_list = Carrier::getCarriers($this->context->language->id, false, false, false, null, Carrier::ALL_CARRIERS);
@@ -4054,7 +4432,7 @@ class AdminNormalProductsControllerCore extends AdminController
public function initFormModules($obj)
{
$id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($this->tab_display_module).'\'');
$this->tpl_form_vars['custom_form'] = Hook::exec('displayAdminNormalProductsExtra', array(), (int)$id_module);
$this->tpl_form_vars['custom_form'] = Hook::exec('displayAdminServiceProductsExtra', array(), (int)$id_module);
}
public function getL($key)
@@ -4213,4 +4591,29 @@ class AdminNormalProductsControllerCore extends AdminController
return $tpl->fetch();
}
// Delete product option process
public function ajaxProcessDeleteServiceProductOption()
{
$response = array();
$response['hasError'] = true;
$response['error'] = $this->l('Some error occurred while deleting product option. Please try again.');
if ($this->tabAccess['edit'] == 1) {
$idProductOption = Tools::getValue('id_product_option');
if (Validate::isLoadedObject($objProductOption = new ServiceProductOption((int)$idProductOption))) {
if ($objProductOption->delete()) {
$response['success'] = true;
$response['hasError'] = false;
} else {
$this->errors[] = $this->l('Unable to delete product option. Please try again.');
}
} else {
$response['error'] = $this->l('Product option not found. Please try again.');
}
} else {
$response['error'] = $this->l('You do not have the permissions to delete.');
}
$this->ajaxDie(json_encode($response));
}
}

View File

@@ -293,7 +293,6 @@ class AdminOrderPreferencesControllerCore extends AdminController
'validation' => 'isInt',
'type' => 'text',
'class' => 'fixed-width-xxl',
'validation' => 'isInt',
'id' => 'PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY',
),
'OVERBOOKING_ORDER_CANCEL_ACTION' => array(
@@ -323,6 +322,69 @@ class AdminOrderPreferencesControllerCore extends AdminController
),
);
if (Hook::exec('actionEnableStandartProductConfig')) {
$addressPrefrenceTypes = array(
array(
'value' => Product::STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOMER,
'name' => $this->l('Customer Address')
),
array(
'value' => Product::STANDARD_PRODUCT_ADDRESS_PREFERENCE_HOTEL,
'name' => $this->l('Hotel Address')
),
array(
'value' => Product::STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM,
'name' => $this->l('Custom Address')
)
);
$customAddressDetails = array();
$objHotelBranch = new HotelBranchInformation();
if ((($idCustomAddress = Configuration::get('PS_STANDARD_PRODUCT_ORDER_ADDRESS_ID'))
&& Validate::isLoadedObject($objAddress = new Address($idCustomAddress))
) || (($primaryHotelId = Configuration::get('WK_PRIMARY_HOTEL'))
&& ($idHotelAddresss = HotelBranchInformation::getAddress((int) $primaryHotelId))
&& Validate::isLoadedObject($objAddress = new Address($idHotelAddresss['id_address']))
) || (($hotels = $objHotelBranch->hotelBranchesInfo(false, 1))
&& ($idHotelAddresss = HotelBranchInformation::getAddress((int) $hotels[0]['id']))
&& Validate::isLoadedObject($objAddress = new Address($idHotelAddresss))
)) {
$customAddressDetails = array(
'id_country' => $objAddress->id_country,
'id_state' => $objAddress->id_state,
'city' => $objAddress->city,
'postcode' => $objAddress->postcode,
);
$this->context->smarty->assign('custom_address_details', $customAddressDetails);
}
$countries = Country::getCountries($this->context->language->id);
$this->context->smarty->assign('countries', $countries);
$this->fields_options['standard_product'] = array(
'title' => $this->l('Standard Product'),
'icon' => 'icon-cogs',
'fields' => array(
'PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE' => array(
'title' => $this->l('Standard product address type'),
'validation' => 'isInt',
'type' => 'select',
'cast' => 'intval',
'list' => $addressPrefrenceTypes,
'identifier' => 'value',
'js' => "changeStandardProductAddressType()",
'hint' => $this->l('Select Standard product Address type, this will be used to calculate the tax for the standard product price.'),
'desc' => $this->l('The selected address type will be used to calculate tax for the standard product.')
),
'PS_STANDARD_PRODUCT_ORDER_ADDRESS' => array(
'title' => $this->l('Standard product custom address'),
'hint' => $this->l('Set the Address details'),
'type' => 'html',
),
),
'submit' => array('title' => $this->l('Save'))
);
}
if (!Configuration::get('PS_ALLOW_MULTISHIPPING')) {
unset($this->fields_options['general']['fields']['PS_ALLOW_MULTISHIPPING']);
}
@@ -360,11 +422,80 @@ class AdminOrderPreferencesControllerCore extends AdminController
if ($maxCheckoutOffset && $maxCheckoutOffset <= $minBookingOffset) {
$this->errors[] = Tools::displayError('Field \'Maximum checkout offset\' cannot be be less than or equal to \'Minimum booking offset\'.');
}
$idCountry = Tools::getValue('service_id_country');
$idSate = Tools::getValue('service_id_state');
$city = trim(Tools::getValue('service_city'));
$postcode = trim(Tools::getValue('service_postcode'));
$serviceAddressPrefrenceType = Tools::getValue('PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE');
if ($serviceAddressPrefrenceType == Product::STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM) {
$addressValidation = Address::getValidationRules('Address');
if (!$idCountry) {
$this->errors[] = Tools::displayError('Field country is required');
} elseif (!Validate::isLoadedObject($objCountry = new Country($idCountry))) {
$this->errors[] = Tools::displayError('Invaid country');
} elseif ($objCountry->zip_code_format && !$objCountry->checkZipCode($postcode)) {
$this->errors[] = sprintf($this->l('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $objCountry->iso_code, str_replace('N', '0', str_replace('L', 'A', $objCountry->zip_code_format))));
} elseif (!$postcode && $objCountry->need_zip_code) {
$this->errors[] = $this->l('Zip / Postal code is required.');
} elseif ($postcode && !Validate::isPostCode($postcode)) {
$this->errors[] = $this->l('The Zip / Postal code is invalid.');
} elseif (Tools::strlen($postcode) > $addressValidation['postcode']) {
$this->errors[] = sprintf(Tools::displayError('The zip code is too long (%1$d chars max).'), $addressValidation['postcode']);
} elseif ($objCountry->contains_states && !$idSate) {
$this->errors[] = Tools::displayError('Field State is required');
} elseif (!Validate::isLoadedObject(new State($idSate))) {
$this->errors[] = Tools::displayError('Invaid state');
}
if (!$city || $city == '') {
$this->errors[] = $this->l('City is required field.');
} elseif (!Validate::isCityName($city)) {
$this->errors[] = $this->l('Enter a valid city name.');
} elseif (Tools::strlen($city) > $addressValidation['city']) {
$this->errors[] = sprintf(Tools::displayError('The city name is too long (%1$d chars max).'), $addressValidation['city']);
}
}
}
public function processUpdateOptions()
{
parent::processUpdateOptions();
if (empty($this->errors)) {
$serviceAddressPrefrenceType = Tools::getValue('PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE');
if ($serviceAddressPrefrenceType == Product::STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM) {
$idCountry = Tools::getValue('service_id_country');
if ($idCustomAddress = Configuration::get('PS_STANDARD_PRODUCT_ORDER_ADDRESS_ID')) {
$objAddress = new Address($idCustomAddress);
} else {
$objAddress = new Address();
}
$objCountry = new Country($idCountry, $this->context->language->id);
$objAddress->alias = 'Standard Product -'.$objCountry->name;
$objAddress->address1 = 'Standard Product -'.$objCountry->name;
$objAddress->firstname = 'Stand Alone';
$objAddress->lastname = 'Standard Product';
$objAddress->id_country = $idCountry;
$objAddress->id_customer = 0;
$objAddress->id_hotel = 0;
$objAddress->id_state = Tools::getValue('service_id_state');
$objAddress->city = Tools::getValue('service_city');
$objAddress->postcode = Tools::getValue('service_postcode');
if ($objAddress->save()) {
Configuration::updateValue('PS_STANDARD_PRODUCT_ORDER_ADDRESS_ID', $objAddress->id);
}
}
}
}
public function setMedia()
{
parent::setMedia();
Media::addJsDef(array(
'STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM' => Product::STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM
));
$this->addCSS(_MODULE_DIR_.'hotelreservationsystem/views/css/HotelReservationAdmin.css');
$this->addJS(_MODULE_DIR_.'hotelreservationsystem/views/js/HotelReservationAdmin.js');
}

File diff suppressed because it is too large Load Diff

View File

@@ -331,80 +331,80 @@ class AdminPPreferencesControllerCore extends AdminController
),
'submit' => array('title' => $this->l('Save'))
),
// 'stock' => array(
// 'title' => $this->l('Products stock'),
// 'fields' => array(
// 'PS_ORDER_OUT_OF_STOCK' => array(
// 'title' => $this->l('Allow ordering of out-of-stock products'),
// 'hint' => $this->l('By default, the Add to Cart button is hidden when a product is unavailable. You can choose to have it displayed in all cases.'),
// 'validation' => 'isBool',
// 'cast' => 'intval',
// 'required' => false,
// 'type' => 'bool'
// ),
// 'PS_STOCK_MANAGEMENT' => array(
// 'title' => $this->l('Enable stock management'),
// 'validation' => 'isBool',
// 'cast' => 'intval',
// 'required' => false,
// 'type' => 'bool',
// 'js' => array(
// 'on' => 'onchange="stockManagementActivationAuthorization()"',
// 'off' => 'onchange="stockManagementActivationAuthorization()"'
// )
// ),
// 'PS_ADVANCED_STOCK_MANAGEMENT' => array(
// 'title' => $this->l('Enable advanced stock management'),
// 'hint' => $this->l('Allows you to manage physical stock, warehouses and supply orders in a new Stock menu.'),
// 'validation' => 'isBool',
// 'cast' => 'intval',
// 'required' => false,
// 'type' => 'bool',
// 'visibility' => Shop::CONTEXT_ALL,
// 'js' => array(
// 'on' => 'onchange="advancedStockManagementActivationAuthorization()"',
// 'off' => 'onchange="advancedStockManagementActivationAuthorization()"'
// )
// ),
// 'PS_FORCE_ASM_NEW_PRODUCT' => array(
// 'title' => $this->l('New products use advanced stock management'),
// 'hint' => $this->l('New products will automatically use advanced stock management and depends on stock, but no warehouse will be selected'),
// 'validation' => 'isBool',
// 'cast' => 'intval',
// 'required' => false,
// 'type' => 'bool',
// 'visibility' => Shop::CONTEXT_ALL,
// ),
// 'PS_DEFAULT_WAREHOUSE_NEW_PRODUCT' => array(
// 'title' => $this->l('Default warehouse on new products'),
// 'hint' => $this->l('Automatically set a default warehouse when new product is created'),
// 'type' => 'select',
// 'list' => $warehouse_list,
// 'identifier' => 'id_warehouse'
// ),
// 'PS_PACK_STOCK_TYPE' => array(
// 'title' => $this->l('Default pack stock management'),
// 'type' => 'select',
// 'list' =>array(
// array(
// 'pack_stock' => 0,
// 'name' => $this->l('Decrement pack only.')
// ),
// array(
// 'pack_stock' => 1,
// 'name' => $this->l('Decrement products in pack only.')
// ),
// array(
// 'pack_stock' => 2,
// 'name' => $this->l('Decrement both.')
// ),
// ),
// 'identifier' => 'pack_stock',
// ),
// ),
// 'bottom' => '<script type="text/javascript">stockManagementActivationAuthorization();advancedStockManagementActivationAuthorization();</script>',
// 'submit' => array('title' => $this->l('Save'))
// ),
'stock' => array(
'title' => $this->l('Products stock'),
'fields' => array(
'PS_ORDER_OUT_OF_STOCK' => array(
'title' => $this->l('Allow ordering of out-of-stock products'),
'hint' => $this->l('By default, the Add to Cart button is hidden when a product is unavailable. You can choose to have it displayed in all cases.'),
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
'type' => 'bool'
),
'PS_STOCK_MANAGEMENT' => array(
'title' => $this->l('Enable stock management'),
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
'type' => 'bool',
'js' => array(
'on' => 'onchange="stockManagementActivationAuthorization()"',
'off' => 'onchange="stockManagementActivationAuthorization()"'
)
),
// 'PS_ADVANCED_STOCK_MANAGEMENT' => array(
// 'title' => $this->l('Enable advanced stock management'),
// 'hint' => $this->l('Allows you to manage physical stock, warehouses and supply orders in a new Stock menu.'),
// 'validation' => 'isBool',
// 'cast' => 'intval',
// 'required' => false,
// 'type' => 'bool',
// 'visibility' => Shop::CONTEXT_ALL,
// 'js' => array(
// 'on' => 'onchange="advancedStockManagementActivationAuthorization()"',
// 'off' => 'onchange="advancedStockManagementActivationAuthorization()"'
// )
// ),
// 'PS_FORCE_ASM_NEW_PRODUCT' => array(
// 'title' => $this->l('New products use advanced stock management'),
// 'hint' => $this->l('New products will automatically use advanced stock management and depends on stock, but no warehouse will be selected'),
// 'validation' => 'isBool',
// 'cast' => 'intval',
// 'required' => false,
// 'type' => 'bool',
// 'visibility' => Shop::CONTEXT_ALL,
// ),
// 'PS_DEFAULT_WAREHOUSE_NEW_PRODUCT' => array(
// 'title' => $this->l('Default warehouse on new products'),
// 'hint' => $this->l('Automatically set a default warehouse when new product is created'),
// 'type' => 'select',
// 'list' => $warehouse_list,
// 'identifier' => 'id_warehouse'
// ),
// 'PS_PACK_STOCK_TYPE' => array(
// 'title' => $this->l('Default pack stock management'),
// 'type' => 'select',
// 'list' =>array(
// array(
// 'pack_stock' => 0,
// 'name' => $this->l('Decrement pack only.')
// ),
// array(
// 'pack_stock' => 1,
// 'name' => $this->l('Decrement products in pack only.')
// ),
// array(
// 'pack_stock' => 2,
// 'name' => $this->l('Decrement both.')
// ),
// ),
// 'identifier' => 'pack_stock',
// ),
),
// 'bottom' => '<script type="text/javascript">stockManagementActivationAuthorization();advancedStockManagementActivationAuthorization();</script>',
'submit' => array('title' => $this->l('Save'))
),
);
}

View File

@@ -385,7 +385,9 @@ class AdminProductsControllerCore extends AdminController
);
$objProduct = new Product();
$allServiceProducts = $objProduct->getServiceProducts();
$hotelServiceProducts = $objProduct->getServiceProducts(null, Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE);
$roomTypeServiceProducts = $objProduct->getServiceProducts(null, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
$allServiceProducts = array_merge($roomTypeServiceProducts, $hotelServiceProducts);
$serviceProducts = array();
foreach ($allServiceProducts as $serviceProduct) {
$serviceProducts[$serviceProduct['id_product']] = $serviceProduct['name'];
@@ -3000,8 +3002,6 @@ class AdminProductsControllerCore extends AdminController
$objRoomType = new HotelRoomType();
$objRoomType->id_product = $product->id;
$objRoomType->id_hotel = $id_hotel;
$idBedTypes = Tools::getValue('id_bed_types', array());
$objRoomType->id_bed_types = json_encode($idBedTypes);
$objRoomType->save();
}
}
@@ -3108,7 +3108,9 @@ class AdminProductsControllerCore extends AdminController
$objRoomType = new HotelRoomType();
if ($hotelRoomType = $objRoomType->getRoomTypeInfoByIdProduct($obj->id)) {
$allServiceProducts = $obj->getServiceProducts();
$hotelServiceProducts = $obj->getServiceProducts(null, Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE);
$roomTypeServiceProducts = $obj->getServiceProducts(null, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
$allServiceProducts = array_merge($roomTypeServiceProducts, $hotelServiceProducts);
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice();

View File

@@ -226,14 +226,24 @@ class AdminStatsControllerCore extends AdminStatsTabController
if ($granularity == 'day') {
$sales = array();
if ($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(
'SELECT LEFT(`invoice_date`, 10) AS date, SUM(total_paid_tax_excl / o.conversion_rate) AS sales
'SELECT LEFT(`invoice_date`, 10) AS date, SUM(total_paid_tax_excl / o.`conversion_rate`) AS sales
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
WHERE os.logable = 1'. (($date_from && $date_to) ? ' AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"' : '').'
AND EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)
GROUP BY LEFT(`invoice_date`, 10)'
)) {
@@ -249,10 +259,20 @@ class AdminStatsControllerCore extends AdminStatsTabController
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
WHERE os.logable = 1'. (($date_from && $date_to) ? ' AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"' : '').'
AND EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)
GROUP BY LEFT(`invoice_date`, 7)'
)) {
@@ -260,7 +280,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
foreach ($result as $row) {
$sales[strtotime($row['date'].'-01')] = $row['sales'];
}
}
}
return $sales;
} else {
@@ -273,8 +293,22 @@ class AdminStatsControllerCore extends AdminStatsTabController
FROM`'._DB_PREFIX_.'htl_booking_detail` hbd
GROUP BY hbd.`id_order`
) t ON (t.`id_order` = o.`id_order`)
WHERE os.logable = 1'. (($date_from && $date_to) ? ' AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"' : '').
HotelBranchInformation::addHotelRestriction($id_hotel)
WHERE os.logable = 1'. (($date_from && $date_to) ? ' AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"' : '').'
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)'
);
}
}
@@ -304,8 +338,22 @@ class AdminStatsControllerCore extends AdminStatsTabController
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`)
WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1
'.Shop::addSqlRestriction(false, 'o')
.HotelBranchInformation::addHotelRestriction($id_hotel, 'hbd').'
'.Shop::addSqlRestriction(false, 'o').'
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)
GROUP BY LEFT(`invoice_date`, 10)')) {
foreach ($result as $row) {
$orders[strtotime($row['date'])] = $row['orders'];
@@ -320,8 +368,22 @@ class AdminStatsControllerCore extends AdminStatsTabController
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`)
WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1
'.Shop::addSqlRestriction(false, 'o')
.HotelBranchInformation::addHotelRestriction($id_hotel, 'hbd').'
'.Shop::addSqlRestriction(false, 'o').'
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)
GROUP BY LEFT(`invoice_date`, 7)')) {
foreach ($result as $row) {
$orders[strtotime($row['date'].'-01')] = $row['orders'];
@@ -333,10 +395,23 @@ class AdminStatsControllerCore extends AdminStatsTabController
SELECT COUNT(DISTINCT o.`id_order`) as orders
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`)
WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1
'.Shop::addSqlRestriction(false, 'o')
.HotelBranchInformation::addHotelRestriction($id_hotel, 'hbd'));
'.Shop::addSqlRestriction(false, 'o').'
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)');
}
return $orders;
@@ -502,20 +577,26 @@ class AdminStatsControllerCore extends AdminStatsTabController
od.`purchase_supplier_price` > 0,
od.`purchase_supplier_price`,
(od.`original_product_price` / `conversion_rate`) * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100
)) as total_purchase_price,
(
SELECT hbd.`id_hotel`
FROM`'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order` LIMIT 1
) AS id_hotel
)) as total_purchase_price
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"
AND os.logable = 1 AND EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
AND os.logable = 1
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)
GROUP BY LEFT(`invoice_date`, 10)')) {
@@ -536,10 +617,21 @@ class AdminStatsControllerCore extends AdminStatsTabController
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"
AND os.logable = 1 AND EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
AND os.logable = 1
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)'
);
}
@@ -557,10 +649,21 @@ class AdminStatsControllerCore extends AdminStatsTabController
LEFT JOIN `'._DB_PREFIX_.'order_return` orr ON (o.id_order = orr.id_order)
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state)
WHERE orr.`payment_mode` != "" AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00"
AND "'.pSQL($date_to).' 23:59:59" AND EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
AND "'.pSQL($date_to).' 23:59:59"
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)
GROUP BY LEFT(`invoice_date`, 10)')) {
@@ -583,10 +686,20 @@ class AdminStatsControllerCore extends AdminStatsTabController
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state)
WHERE orr.`payment_mode` != "" AND orr.`id_transaction` != ""
AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"
AND EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)'
);
}
@@ -597,24 +710,35 @@ class AdminStatsControllerCore extends AdminStatsTabController
$expenses = ($granularity == 'day' ? array() : 0);
$orders = Db::getInstance()->ExecuteS('
SELECT
LEFT(`invoice_date`, 10) as date,
total_paid_tax_incl / o.conversion_rate as total_paid_tax_incl,
total_shipping_tax_excl / o.conversion_rate as total_shipping_tax_excl,
o.module,
ad.id_country,
o.id_currency,
c.id_reference as carrier_reference,
(
SELECT hbd.`id_hotel`
FROM`'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order` LIMIT 1
) AS id_hotel
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'address` ad ON o.id_address_delivery = ad.id_address
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON o.id_carrier = c.id_carrier
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 HAVING 1'.HotelBranchInformation::addHotelRestriction($id_hotel));
SELECT
LEFT(`invoice_date`, 10) as date,
total_paid_tax_incl / o.conversion_rate as total_paid_tax_incl,
total_shipping_tax_excl / o.conversion_rate as total_shipping_tax_excl,
o.module,
ad.id_country,
o.id_currency,
c.id_reference as carrier_reference
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'address` ad ON o.id_address_delivery = ad.id_address
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON o.id_carrier = c.id_carrier
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 HAVING 1
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel, 'spod').'
)'.(!$id_hotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)'
);
foreach ($orders as $order) {
// Add flat fees for this order
@@ -865,10 +989,21 @@ class AdminStatsControllerCore extends AdminStatsTabController
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON os.`id_order_state` = o.`current_state`
WHERE o.`invoice_date` BETWEEN "'.pSQL(date('Y-m-d', strtotime('-'.($daysForAvgOrderVal + 1).' day'))).' 00:00:00"
AND "'.pSQL(date('Y-m-d')).' 23:59:59" AND os.`logable` = 1 AND EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotels).'
AND "'.pSQL(date('Y-m-d')).' 23:59:59" AND os.`logable` = 1
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotels).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotels, 'spod').'
)'.(!$idHotels ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)');
$value = Tools::displayPrice($row['orders'] ? $row['total_paid_tax_excl'] / $row['orders'] : 0, $currency).' ('.$this->l('tax excl.').')';
@@ -1651,7 +1786,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
$totalServicesRevenue = 0;
// Calculate services revenue
$servicesRevenueSql = 'SELECT SUM((rtspod.`total_price_tax_excl` / o.`conversion_rate`) / DATEDIFF(hbd.`date_to`, hbd.`date_from`))
FROM `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rtspod
FROM `'._DB_PREFIX_.'service_product_order_detail` rtspod
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
ON (rtspod.`id_htl_booking_detail` = hbd.`id`)
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`)
@@ -2141,7 +2276,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
THEN ((od.`original_product_price` / o.`conversion_rate`) * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100) / (IF (od.`product_price_calculation_method` = '.Product::PRICE_CALCULATION_METHOD_PER_BOOKING.', DATEDIFF(hbd.`date_to`, hbd.`date_from`), 1))
END
), 0)
FROM `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rtspod
FROM `'._DB_PREFIX_.'service_product_order_detail` rtspod
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
ON (rtspod.`id_htl_booking_detail` = hbd.`id`)
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rtspod.`id_product`)
@@ -2448,11 +2583,21 @@ class AdminStatsControllerCore extends AdminStatsTabController
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
WHERE 1 ' .
($invalidOrderStates ? ' AND o.`current_state` NOT IN ('.implode(',', $invalidOrderStates).')' : '') .
(($dateFrom && $dateTo) ? ' AND o.`date_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"' : '').
' AND EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
(($dateFrom && $dateTo) ? ' AND o.`date_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"' : '').'
AND (
EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
) OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel, 'spod').'
)'.(!$idHotel ? ' OR EXISTS (
SELECT 1
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
)' : '').'
)';
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
}

View File

@@ -62,6 +62,7 @@ class CartControllerCore extends FrontController
$this->id_product_attribute = (int)Tools::getValue('id_product_attribute', Tools::getValue('ipa'));
$this->customization_id = (int)Tools::getValue('id_customization');
$this->qty = abs(Tools::getValue('qty', 1));
$this->id_hotel = abs(Tools::getValue('id_hotel', null));
$this->id_address_delivery = (int)Tools::getValue('id_address_delivery');
}
@@ -178,7 +179,32 @@ class CartControllerCore extends FrontController
$this->context->cookie->avail_rooms = $total_available_rooms;
}
} else {
$result = $this->context->cart->deleteProduct($this->id_product, $this->id_product_attribute, $this->customization_id, $this->id_address_delivery);
$idProductOption = Tools::getValue('id_product_option', null);
if ($product->selling_preference_type == Product::SELLING_PREFERENCE_STANDALONE) {
$objServiceProductCartDetail = new ServiceProductCartDetail();
$result = $objServiceProductCartDetail->removeCartServiceProduct(
$this->context->cart->id,
$this->id_product,
false,
false,
false,
$idProductOption
);
} elseif ($product->selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE
|| $product->selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE
) {
$objServiceProductCartDetail = new ServiceProductCartDetail();
$result = $objServiceProductCartDetail->removeCartServiceProduct(
$this->context->cart->id,
$this->id_product,
false,
$this->id_hotel,
false,
$idProductOption ? $idProductOption : null
);
}
}
if ($result) {
@@ -269,7 +295,6 @@ class CartControllerCore extends FrontController
{
$mode = (Tools::getIsset('update') && $this->id_product) ? 'update' : 'add';
$operator = Tools::getValue('op', 'up');
$id_cart = $this->context->cart->id;
$id_guest = $this->context->cart->id_guest;
@@ -432,19 +457,86 @@ class CartControllerCore extends FrontController
}
}
} else {
$obj_htl_cart_booking_data = new HotelCartBookingData();
if ($product->service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
$objHotelCartBookingData = new HotelCartBookingData();
$idProductOption = Tools::getValue('id_product_option');
if ($product->selling_preference_type == Product::SELLING_PREFERENCE_STANDALONE) {
// if can be added without room type then we can directly add product in cart.
if (!$product->allow_multiple_quantity) {
// check if product already exists in cart.
if ($id_cart) {
if (cart::getProductQtyInCart($id_cart, $product->id)) {
$this->errors[] = Tools::displayError('You can only order one quantity for this product.');
if ($operator == 'up') {
if ($product->allow_multiple_quantity) {
if ($id_cart) {
$quantityInCart = Cart::getProductQtyInCart(
$id_cart,
$this->id_product
);
}
$finalQuantity = $this->qty;
if (isset($quantityInCart)) {
$finalQuantity += $quantityInCart;
}
if ($product->max_quantity && $finalQuantity > $product->max_quantity) {
$this->errors[] = Tools::displayError(sprintf('You can now add more than %d quantity for this product in the cart.', $product->max_quantity));
}
} else {
if ($id_cart) {
if (cart::getProductQtyInCart($id_cart, $product->id)) {
$this->errors[] = Tools::displayError('You can only order one quantity for this product.');
}
}
}
if (ServiceProductOption::productHasOptions($this->id_product)) {
if (!$idProductOption) {
$this->errors[] = Tools::displayError('Cannot add service without a option.');
} else {
if (!ServiceProductOption::productHasOptions($this->id_product, $idProductOption)) {
$this->errors[] = Tools::displayError('The selected option is not available.');
}
}
}
}
} elseif ($product->selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE
|| $product->selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE
) {
$id_hotel = Tools::getValue('id_hotel');
if ($operator == 'up') {
if ($id_hotel) {
$objServiceProductCartDetail = new ServiceProductCartDetail();
$productCartDetail = array();
if ($cartDetail = $objServiceProductCartDetail->getServiceProductsInCart(
$id_cart,
[$product->selling_preference_type],
$id_hotel,
null,
null,
$this->id_product
)) {
$productCartDetail = array_shift($cartDetail);
}
if ($product->allow_multiple_quantity) {
$finalQuantity = $this->qty;
if (isset($productCartDetail) && $productCartDetail) {
$finalQuantity += $productCartDetail['quantity'];
}
if ($product->max_quantity && $finalQuantity > $product->max_quantity) {
$this->errors[] = Tools::displayError(sprintf('You can not add more than %d quantity for this product in the cart.', $product->max_quantity));
}
} elseif ($productCartDetail) {
$this->errors[] = Tools::displayError('You can only order one quantity for this product.');
}
if (ServiceProductOption::productHasOptions($this->id_product)) {
if (!$idProductOption) {
$this->errors[] = Tools::displayError('Cannot add product without a option.');
} else {
if (!ServiceProductOption::productHasOptions($this->id_product, $idProductOption)) {
$this->errors[] = Tools::displayError('The selected option is not available.');
}
}
}
} else {
$this->errors[] = Tools::displayError('Cannot add product without a hotel.');
}
}
} else {
$this->errors[] = Tools::displayError('cannot add product without room in cart');
$this->errors[] = Tools::displayError('Can not add product without room in cart');
}
}
@@ -511,7 +603,6 @@ class CartControllerCore extends FrontController
/*
* To add Rooms in hotel cart
*/
if ($product->booking_product) {
$objHotelCartBookingData = new HotelCartBookingData();
$roomDemand = json_decode(Tools::getValue('roomDemands'), true);
@@ -544,19 +635,43 @@ class CartControllerCore extends FrontController
$this->availQty = $total_available_rooms + $req_rm;
}
$this->context->cookie->avail_rooms = $this->availQty;
} else {
$update_quantity = $this->context->cart->updateQty(
$this->qty,
} elseif ($product->selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE
|| $product->selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE
) {
$objServiceProductCartDetail = new ServiceProductCartDetail();
$update_quantity = $objServiceProductCartDetail->updateCartServiceProduct(
$this->context->cart->id,
$this->id_product,
$this->id_product_attribute,
$this->customization_id,
$operator,
$this->id_address_delivery
$this->qty,
$id_hotel,
false,
isset($idProductOption) ? $idProductOption : null
);
if ($operator == 'up') {
$this->context->cookie->currentAddedProduct = json_encode(array(
'id_product' => $this->id_product,
'qty' => $this->qty
'id_hotel' => $id_hotel,
'qty' => $this->qty,
'id_product_option' => isset($idProductOption) ? $idProductOption : null
));
}
} elseif ($product->selling_preference_type == Product::SELLING_PREFERENCE_STANDALONE) {
$objServiceProductCartDetail = new ServiceProductCartDetail();
$update_quantity = $objServiceProductCartDetail->updateCartServiceProduct(
$this->context->cart->id,
$this->id_product,
$operator,
$this->qty,
false,
false,
isset($idProductOption) ? $idProductOption : null
);
if ($operator == 'up') {
$this->context->cookie->currentAddedProduct = json_encode(array(
'id_product' => $this->id_product,
'qty' => $this->qty,
'id_product_option' => isset($idProductOption) ? $idProductOption : null
));
}
}
@@ -649,13 +764,14 @@ class CartControllerCore extends FrontController
}
if (empty($this->errors)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct(
$idCartBooking,
$idServiceProduct,
$qty,
$objServiceProductCartDetail = new ServiceProductCartDetail();
if ($objServiceProductCartDetail->updateCartServiceProduct(
$this->context->cart->id,
$operator
$idServiceProduct,
$operator,
$qty,
false,
$idCartBooking
)) {
$this->ajaxDie(json_encode(array(
'hasError' => false

View File

@@ -135,8 +135,8 @@ class GuestTrackingControllerCore extends FrontController
'extraDemands' => $extraDemands,
));
}
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -145,7 +145,8 @@ class GuestTrackingControllerCore extends FrontController
$dateTo,
0,
0,
$useTax
$useTax,
0
)) {
$this->context->smarty->assign(array(
'useTax' => $useTax,
@@ -215,7 +216,7 @@ class GuestTrackingControllerCore extends FrontController
include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
$objHtlBranchInfo = new HotelBranchInformation();
$objBookingDetail = new HotelBookingDetail();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objRoomType = new HotelRoomType();
$anyBackOrder = 0;
@@ -252,6 +253,8 @@ class GuestTrackingControllerCore extends FrontController
$order->hook_orderdetaildisplayed = Hook::exec('displayOrderDetail', array('order' => $order));
// enter the details of the booking the order
$standaloneServiceProducts = array();
$hotelServiceProducts = array();
if ($hotelresInstalled) {
if ($orderProducts = $order->getProducts()) {
$total_demands_price_te = 0;
@@ -266,10 +269,11 @@ class GuestTrackingControllerCore extends FrontController
if (in_array($type_value['product_id'], $processedProducts)) {
continue;
}
$product = new Product($type_value['product_id'], false, $this->context->language->id);
if ($type_value['is_booking_product']) {
$processedProducts[] = $type_value['product_id'];
$product = new Product($type_value['product_id'], false, $this->context->language->id);
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
@@ -407,19 +411,23 @@ class GuestTrackingControllerCore extends FrontController
$cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name'];
// add additional services products in hotel detail.
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to']
$data_v['date_to'],
0,
0,
null,
0
);
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $additionalServicesPriceTI = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $additionalServicesPriceTI = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -428,12 +436,13 @@ class GuestTrackingControllerCore extends FrontController
$data_v['date_to'],
$data_v['id_room'],
1,
1
1,
0
);
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $additionalServicesPriceTE = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $additionalServicesPriceTE = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -442,13 +451,14 @@ class GuestTrackingControllerCore extends FrontController
$data_v['date_to'],
$data_v['id_room'],
1,
0,
0
);
// get auto added price to be displayed with room price
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -464,7 +474,7 @@ class GuestTrackingControllerCore extends FrontController
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -487,9 +497,9 @@ class GuestTrackingControllerCore extends FrontController
$value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6));
$value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6));
}
} else if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) {
} elseif ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) {
if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) {
$total_convenience_fee_ti += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$total_convenience_fee_ti += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
$type_value['product_id'],
0,
@@ -501,7 +511,7 @@ class GuestTrackingControllerCore extends FrontController
1,
1
);
$total_convenience_fee_te += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$total_convenience_fee_te += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
$type_value['product_id'],
0,
@@ -514,18 +524,29 @@ class GuestTrackingControllerCore extends FrontController
1
);
}
} else {
// get all products that are independent.
if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
$product = new Product($type_value['product_id'], false, $this->context->language->id);
$cover_image_arr = $product->getCover($type_value['product_id']);
} else if ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE) {
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default');
} else {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
}
$cartServiceProducts[] = $type_value;
if (!empty($cover_image_arr)) {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default');
} else {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
}
$hotelProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($idOrder, $type_value['id_order_detail'], $type_value['product_id']);
foreach ($hotelProducts as $hotelProduct) {
$hotelServiceProducts[] = array_merge($type_value, $hotelProduct);
}
} else if ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_STANDALONE) {
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default');
} else {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
}
$standaloneProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($idOrder, $type_value['id_order_detail'], $type_value['product_id']);
foreach ($standaloneProducts as $standaloneProduct) {
$standaloneServiceProducts[] = array_merge($type_value, $standaloneProduct);
}
}
}
@@ -542,8 +563,10 @@ class GuestTrackingControllerCore extends FrontController
$customerGuestDetail = new OrderCustomerGuestDetail($id_customer_guest_detail);
}
$idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id);
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
$objHotelBranchInformation = null;
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) {
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
}
$hotelAddressInfo = HotelBranchInformation::getAddress($idHotel);
$objHotelBranchRefundRules = new HotelBranchRefundRules();
@@ -559,6 +582,8 @@ class GuestTrackingControllerCore extends FrontController
$order->back_ord_msg = Configuration::get('WK_BO_MESSAGE');
$order->order_has_invoice = $order->hasInvoice();
$order->cart_htl_data = $cartHotelData;
$order->hotel_service_products = $hotelServiceProducts;
$order->standalone_service_products = $standaloneServiceProducts;
$order->customerGuestDetail = $customerGuestDetail;
$order->obj_hotel_branch_information = $objHotelBranchInformation;
$order->hotel_address_info = $hotelAddressInfo;
@@ -566,7 +591,6 @@ class GuestTrackingControllerCore extends FrontController
//end
Hook::exec('actionOrderDetail', array('carrier' => $order->carrier, 'order' => $order));
}
}

View File

@@ -120,8 +120,8 @@ class OrderConfirmationControllerCore extends FrontController
$orderTotalInfo['total_products_ti'] = 0;
$orderTotalInfo['total_rooms_te'] = 0;
$orderTotalInfo['total_rooms_ti'] = 0;
$orderTotalInfo['total_service_products_te'] = 0;
$orderTotalInfo['total_service_products_ti'] = 0;
$orderTotalInfo['total_standalone_products_te'] = 0;
$orderTotalInfo['total_standalone_products_ti'] = 0;
$orderTotalInfo['total_auto_add_services_te'] = 0;
$orderTotalInfo['total_auto_add_services_ti'] = 0;
$orderTotalInfo['total_services_te'] = 0;
@@ -145,9 +145,11 @@ class OrderConfirmationControllerCore extends FrontController
$orderTotalInfo['total_order_amount'] = 0;
$hotelCartBookingData = new HotelCartBookingData();
$objBookingDemand = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$cart_service_products = array();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$cart_standalone_service_products = array();
$cart_hotel_service_products = array();
$cart_htl_data = array();
foreach ($cartOrders as $cartOrder) {
$idOrder = $cartOrder['id_order'];
$objCartOrder = new Order($idOrder);
@@ -155,13 +157,7 @@ class OrderConfirmationControllerCore extends FrontController
if (!empty($orderProducts)) {
foreach ($orderProducts as $type_key => $type_value) {
if (in_array($type_value['product_id'], $processed_product)) {
continue;
}
$processed_product[] = $type_value['product_id'];
$product = new Product($type_value['product_id'], false, $this->context->language->id);
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
@@ -176,6 +172,11 @@ class OrderConfirmationControllerCore extends FrontController
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($idOrder, $customer->id_guest, $type_value['product_id']);
}
if ($rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id'])) {
if (in_array($type_value['product_id'], $processed_product)) {
continue;
}
$processed_product[] = $type_value['product_id'];
$cart_htl_data[$type_key]['id_order'] = $idOrder;
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
@@ -283,18 +284,22 @@ class OrderConfirmationControllerCore extends FrontController
$cart_htl_data[$type_key]['hotel_name'] = $data_v['hotel_name'];
// add additional services products in hotel detail.
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to']
$data_v['date_to'],
0,
0,
null,
0
);
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0;
}
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $extraDemandPriceTI = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $extraDemandPriceTI = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -303,12 +308,13 @@ class OrderConfirmationControllerCore extends FrontController
$data_v['date_to'],
$data_v['id_room'],
1,
1
1,
0
);
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0;
}
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $extraDemandPriceTE = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $extraDemandPriceTE = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -317,13 +323,14 @@ class OrderConfirmationControllerCore extends FrontController
$data_v['date_to'],
$data_v['id_room'],
1,
0,
0
);
// get auto added price to be displayed with room price
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0;
}
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -339,7 +346,7 @@ class OrderConfirmationControllerCore extends FrontController
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0;
}
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -355,7 +362,7 @@ class OrderConfirmationControllerCore extends FrontController
$totalRoomsBooked += 1;
}
} else if ($product->service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
} else if ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE) {
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
@@ -363,31 +370,63 @@ class OrderConfirmationControllerCore extends FrontController
} else {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
}
// $orderTotalInfo['total_service_products_te'] += $type_value['total_price_tax_excl'];
// $orderTotalInfo['total_service_products_ti'] += $type_value['total_price_tax_incl'];
$cart_service_products[] = $type_value;
$serviceProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($idOrder, $type_value['id_order_detail'], $type_value['product_id']);
foreach ($serviceProducts as $serviceProduct) {
$type_value['total_price_tax_excl'] = $serviceProduct['total_price_tax_excl'];
$type_value['total_price_tax_incl'] = $serviceProduct['total_price_tax_incl'];
$type_value['product_quantity'] = $serviceProduct['quantity'];
$type_value['option_name'] = $serviceProduct['option_name'];
$type_value['location'] = $serviceProduct['option_name'];
if ($hotelInfo = $objHtlBranchInfo->hotelBranchesInfo($this->context->language->id, 2, 1, $serviceProduct['id_hotel'])) {
$type_value['hotel_location'] = $hotelInfo['hotel_name'].', '.$hotelInfo['city'].
($hotelInfo['state_name']?', '.$hotelInfo['state_name']:'').', '.
$hotelInfo['country_name'].', '.$hotelInfo['postcode'];
}
$cart_hotel_service_products[] = $type_value;
}
} else if ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_STANDALONE) {
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default');
} else {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
}
$serviceProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($idOrder, $type_value['id_order_detail'], $type_value['product_id']);
foreach ($serviceProducts as $serviceProduct) {
$type_value['unit_price_tax_excl'] = $serviceProduct['unit_price_tax_excl'];
$type_value['unit_price_tax_incl'] = $serviceProduct['unit_price_tax_incl'];
$type_value['total_price_tax_excl'] = $serviceProduct['total_price_tax_excl'];
$type_value['total_price_tax_incl'] = $serviceProduct['total_price_tax_incl'];
$type_value['product_quantity'] = $serviceProduct['quantity'];
$type_value['option_name'] = $serviceProduct['option_name'];
$cart_standalone_service_products[] = $type_value;
}
}
}
if (!empty($cart_service_products)) {
$this->context->smarty->assign('cart_service_products', $cart_service_products);
if (!empty($cart_hotel_service_products)) {
$this->context->smarty->assign('cart_hotel_service_products', $cart_hotel_service_products);
}
if (!empty($cart_standalone_service_products)) {
$this->context->smarty->assign('cart_standalone_service_products', $cart_standalone_service_products);
}
}
if (!$objCartOrder->hasInvoice()) {
$orders_has_invoice = 0;
}
$orderTotalInfo['total_standalone_products_ti'] += ($objCartOrder->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE)+$objCartOrder->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE));
$orderTotalInfo['total_standalone_products_te'] += ($objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE)+$objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE));
$orderTotalInfo['total_wrapping'] += $objCartOrder->total_wrapping;
$orderTotalInfo['total_rooms_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, true);
$orderTotalInfo['total_rooms_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, true);
$orderTotalInfo['total_auto_add_services_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
$orderTotalInfo['total_auto_add_services_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
$orderTotalInfo['total_services_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0);
$orderTotalInfo['total_services_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0);
$orderTotalInfo['total_convenience_fee_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
$orderTotalInfo['total_convenience_fee_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
// $orderTotalInfo['total_service_products_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
// $orderTotalInfo['total_service_products_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
$orderTotalInfo['total_auto_add_services_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
$orderTotalInfo['total_auto_add_services_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
$orderTotalInfo['total_services_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0);
$orderTotalInfo['total_services_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0);
$orderTotalInfo['total_convenience_fee_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
$orderTotalInfo['total_convenience_fee_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
$orderTotalInfo['total_discounts'] += $objCartOrder->total_discounts;
$orderTotalInfo['total_discounts_te'] += $objCartOrder->total_discounts_tax_excl;
$orderTotalInfo['total_tax'] += $objCartOrder->total_paid_tax_incl - $objCartOrder->total_paid_tax_excl;
@@ -395,15 +434,16 @@ class OrderConfirmationControllerCore extends FrontController
$orderTotalInfo['total_paid_real'] += $objCartOrder->total_paid_real;
}
$totalTaxIncl = $orderTotalInfo['total_rooms_ti'] + $orderTotalInfo['total_services_ti'] + $orderTotalInfo['total_convenience_fee_ti'] + $orderTotalInfo['total_auto_add_services_ti'] + $orderTotalInfo['total_demands_price_ti'];
$totalTaxExcl = $orderTotalInfo['total_rooms_te'] + $orderTotalInfo['total_services_te'] + $orderTotalInfo['total_convenience_fee_te'] + $orderTotalInfo['total_auto_add_services_te'] + $orderTotalInfo['total_demands_price_te'];
$totalTaxIncl = $orderTotalInfo['total_rooms_ti'] + $orderTotalInfo['total_services_ti'] + $orderTotalInfo['total_convenience_fee_ti'] + $orderTotalInfo['total_auto_add_services_ti'] + $orderTotalInfo['total_demands_price_ti'] + $orderTotalInfo['total_standalone_products_ti'];
$totalTaxExcl = $orderTotalInfo['total_rooms_te'] + $orderTotalInfo['total_services_te'] + $orderTotalInfo['total_convenience_fee_te'] + $orderTotalInfo['total_auto_add_services_te'] + $orderTotalInfo['total_demands_price_te'] + $orderTotalInfo['total_standalone_products_te'];
$orderTotalInfo['total_tax_without_discount'] = $totalTaxIncl - $totalTaxExcl;
}
$this->context->smarty->assign('orderTotalInfo', $orderTotalInfo);
$this->context->smarty->assign('orders_has_invoice', $orders_has_invoice);
}
if (!empty($cart_htl_data)) {
$this->context->smarty->assign('cart_htl_data', $cart_htl_data);
}
@@ -423,6 +463,8 @@ class OrderConfirmationControllerCore extends FrontController
'objOrderCurrency' => (new Currency($order->id_currency)),
'use_tax' => Configuration::get('PS_TAX'),
'group_use_tax' => (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC),
'order_history' => $order->getHistory((int)$this->context->language->id, false, true),
'overbooking_order_states' => OrderState::getOverBookingStates()
)
);

View File

@@ -61,6 +61,7 @@ class OrderDetailControllerCore extends FrontController
$carrier = new Carrier((int)$order->id_carrier, (int)$order->id_lang);
$addressInvoice = new Address((int)$order->id_address_invoice);
$addressDelivery = new Address((int)$order->id_address_delivery);
$addressTax = new Address((int)$order->id_address_tax);
$inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
@@ -87,11 +88,14 @@ class OrderDetailControllerCore extends FrontController
$objBookingDetail = new HotelBookingDetail();
$objRoomType = new HotelRoomType();
$objBookingDemand = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$anyBackOrder = 0;
$processedProducts = array();
$cartHotelData = array();
$cartServiceProducts = array();
$hotelServiceProducts = array();
$standaloneServiceProducts = array();
$serviceProductsFormatted = array();
$total_demands_price_te = 0;
$total_demands_price_ti = 0;
$total_convenience_fee_te = 0;
@@ -99,27 +103,26 @@ class OrderDetailControllerCore extends FrontController
$roomTypes = array();
$objOrderReturn = new OrderReturn();
$refundedAmount = 0;
if ($refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($order->id, 0, 1)) {
$refundedAmount = $objOrderReturn->getRefundedAmount($order->id);
}
$refundedAmount = $objOrderReturn->getRefundedAmount($order->id);
$refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($order->id, 0, 1);
$refundReqProducts = $objOrderReturn->getOrderRefundRequestedProducts($order->id, 0, 1);
if (!empty($products)) {
foreach ($products as $type_key => $type_value) {
if (in_array($type_value['product_id'], $processedProducts)) {
continue;
}
$product = new Product($type_value['product_id'], false, $this->context->language->id);
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'home_default');
} else {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'home_default');
}
if ($type_value['is_booking_product']) {
$processedProducts[] = $type_value['product_id'];
$product = new Product($type_value['product_id'], false, $this->context->language->id);
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'home_default');
} else {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'home_default');
}
if (isset($customer->id)) {
$obj_cart = new Cart($order->id_cart);
$order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $obj_cart->id_guest, $type_value['product_id'], $customer->id);
@@ -127,7 +130,7 @@ class OrderDetailControllerCore extends FrontController
$order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']);
}
$cartHotelData[$type_key]['id_product'] = $type_value['product_id'];
$cartHotelData[$type_key]['cover_img'] = $cover_img;
$cartHotelData[$type_key]['cover_img'] = $type_value['cover_img'];
$objBookingDemand = new HotelBookingDemands();
@@ -269,19 +272,23 @@ class OrderDetailControllerCore extends FrontController
$cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name'];
// add additional services products in hotel detail.
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$id_order,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to']
$data_v['date_to'],
0,
0,
null,
0
);
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $additionalServicesPriceTI = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $additionalServicesPriceTI = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$id_order,
0,
0,
@@ -290,12 +297,13 @@ class OrderDetailControllerCore extends FrontController
$data_v['date_to'],
$data_v['id_room'],
1,
1
1,
0
);
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $additionalServicesPriceTE = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $additionalServicesPriceTE = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$id_order,
0,
0,
@@ -304,13 +312,14 @@ class OrderDetailControllerCore extends FrontController
$data_v['date_to'],
$data_v['id_room'],
1,
0,
0
);
// get auto added price to be displayed with room price
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$id_order,
0,
0,
@@ -326,7 +335,7 @@ class OrderDetailControllerCore extends FrontController
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$id_order,
0,
0,
@@ -349,9 +358,9 @@ class OrderDetailControllerCore extends FrontController
$value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6));
$value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6));
}
} else if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) {
} else if ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) {
if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) {
$total_convenience_fee_ti += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$total_convenience_fee_ti += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$id_order,
$type_value['product_id'],
0,
@@ -359,11 +368,11 @@ class OrderDetailControllerCore extends FrontController
0,
0,
0,
1,
1,
1,
1
);
$total_convenience_fee_te += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$total_convenience_fee_te += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$id_order,
$type_value['product_id'],
0,
@@ -376,35 +385,46 @@ class OrderDetailControllerCore extends FrontController
1
);
}
} else {
// get all products that are independent.
if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
$product = new Product($type_value['product_id'], false, $this->context->language->id);
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default');
} else {
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
} else if ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE) {
$hotelProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($id_order, $type_value['id_order_detail'], $type_value['product_id']);
foreach ($hotelProducts as $hotelProduct) {
$hotelServiceProducts[] = array_merge($type_value, $hotelProduct);
if (!isset($serviceProductsFormatted[$hotelProduct['id_product']])) {
$serviceProductsFormatted[$hotelProduct['id_product']] = array(
'id_product' => $hotelProduct['id_product'],
'name' => $hotelProduct['name'],
'options' => array()
);
}
$cartServiceProducts[] = $type_value;
$hotelProduct['refund_denied'] = 0;
if (isset($hotelProduct['refund_info'])
&& ($hotelProduct['refund_info']['refunded'] && !$hotelProduct['refund_info']['id_customization'])
) {
$hotelProduct['refund_denied'] = 1;
}
$serviceProductsFormatted[$hotelProduct['id_product']]['options'][] = $hotelProduct;
}
} else if ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_STANDALONE) {
$standaloneProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($id_order, $type_value['id_order_detail'], $type_value['product_id']);
foreach ($standaloneProducts as $standaloneProduct) {
$standaloneServiceProducts[] = array_merge($type_value, $standaloneProduct);
if (!isset($serviceProductsFormatted[$standaloneProduct['id_product']])) {
$serviceProductsFormatted[$standaloneProduct['id_product']] = array(
'id_product' => $standaloneProduct['id_product'],
'name' => $standaloneProduct['name'],
'options' => array()
);
}
$serviceProductsFormatted[$standaloneProduct['id_product']]['options'][] = $standaloneProduct;
}
}
$roomTypes[$type_value['id_product']] = $type_value;
}
$redirectTermsLink = $this->context->link->getCMSLink(new CMS(3, $this->context->language->id), null, $this->context->language->id);
}
$objHotelBookingDetail = new HotelBookingDetail();
$htlBookingDetail = $objHotelBookingDetail->getOrderCurrentDataByOrderId($order->id);
$idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id);
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
$hotelAddressInfo = HotelBranchInformation::getAddress($idHotel);
$objHotelBranchRefundRules = new HotelBranchRefundRules();
$hotelRefundRules = $objHotelBranchRefundRules->getHotelRefundRules($idHotel, 0, 1);
$this->context->smarty->assign(
array(
@@ -420,13 +440,25 @@ class OrderDetailControllerCore extends FrontController
'order_has_invoice' => $order->hasInvoice(),
'cart_htl_data' => $cartHotelData,
'cart_service_products' => $cartServiceProducts,
'obj_hotel_branch_information' => $objHotelBranchInformation,
'hotel_address_info' => $hotelAddressInfo,
'hotel_refund_rules' => $hotelRefundRules,
'hotel_service_products' => $hotelServiceProducts,
'standalone_service_products' => $standaloneServiceProducts,
'service_products_formatted' => $serviceProductsFormatted,
'view_on_map' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
)
);
if ($idHotel = $addressTax->id_hotel) {
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
$hotelAddressInfo = HotelBranchInformation::getAddress($idHotel);
$objHotelBranchRefundRules = new HotelBranchRefundRules();
$hotelRefundRules = $objHotelBranchRefundRules->getHotelRefundRules($idHotel, 0, 1);
$this->context->smarty->assign(array(
'obj_hotel_branch_information' => $objHotelBranchInformation,
'hotel_address_info' => $hotelAddressInfo,
'hotel_refund_rules' => $hotelRefundRules,
));
}
$this->context->smarty->assign(
array(
'hasOrderPaid' => $order->hasBeenPaid(),
@@ -434,7 +466,8 @@ class OrderDetailControllerCore extends FrontController
'refund_allowed' => (int) $order->isReturnable(),
'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id),
'refundReqBookings' => $refundReqBookings,
'completeRefundRequestOrCancel' => $order->hasCompletelyRefunded(0, 1),
'refundReqProducts' => $refundReqProducts,
'completeRefundRequestOrCancel' => $order->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG),
'refundedAmount' => $refundedAmount,
'shop_name' => strval(Configuration::get('PS_SHOP_NAME')),
'order' => $order,
@@ -518,8 +551,8 @@ class OrderDetailControllerCore extends FrontController
'extraDemands' => $extraDemands,
));
}
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
0,
@@ -528,7 +561,8 @@ class OrderDetailControllerCore extends FrontController
$dateTo,
0,
0,
$useTax
$useTax,
0
)) {
$this->context->smarty->assign(array(
'useTax' => $useTax,
@@ -552,10 +586,11 @@ class OrderDetailControllerCore extends FrontController
$idOrder = Tools::getValue('id_order');
$idsHtlBooking = Tools::getValue('bookings_to_refund');
$idServiceProductOrderDetails = Tools::getValue('id_service_product_order_detail');
$cancellationReason = trim(Tools::getValue('cancellation_reason'));
if (!$idsHtlBooking) {
$this->errors[] = Tools::displayError('Please select at least on room for cancellation.');
if (!$idsHtlBooking && !$idServiceProductOrderDetails) {
$this->errors[] = Tools::displayError('Please select at least on room/product for cancellation.');
}
if (!$cancellationReason) {
@@ -568,23 +603,33 @@ class OrderDetailControllerCore extends FrontController
$objOrder = new Order($idOrder);
if (!(Validate::isLoadedObject($objOrder) && $objOrder->id_customer == $this->context->customer->id)) {
$this->errors[] = Tools::displayError('Something went wrong. Please try later.');
} elseif ($idsHtlBooking) {
foreach ($idsHtlBooking as $idHtlBooking) {
$objHotelBookingDetail = new HotelBookingDetail($idHtlBooking);
if ($objHotelBookingDetail->id_customer != $objOrder->id_customer) {
$this->errors[] = Tools::displayError('Something went wrong. Please try later.');
break;
}
} else {
if ($idsHtlBooking) {
foreach ($idsHtlBooking as $idHtlBooking) {
$objHotelBookingDetail = new HotelBookingDetail($idHtlBooking);
if ($objHotelBookingDetail->id_customer != $objOrder->id_customer) {
$this->errors[] = Tools::displayError('Something went wrong. Please try later.');
break;
}
// the room has already been checked in/checked out, room will not be able to be cancelled by the customer
if ($objHotelBookingDetail->id_status != HotelBookingDetail::STATUS_ALLOTED) {
$this->errors[] = Tools::displayError('Some selected rooms have already been checked-in/checked-out.');
break;
}
// the room has already been checked in/checked out, room will not be able to be cancelled by the customer
if ($objHotelBookingDetail->id_status != HotelBookingDetail::STATUS_ALLOTED) {
$this->errors[] = Tools::displayError('Some selected rooms have already been checked-in/checked-out.');
break;
}
if (OrderReturn::getOrdersReturnDetail($objOrder->id, 0, $idHtlBooking)) {
$this->errors[] = Tools::displayError('Some selected rooms have already been requested for cancellation.');
break;
if (OrderReturn::getOrdersReturnDetail($objOrder->id, 0, $idHtlBooking)) {
$this->errors[] = Tools::displayError('Some selected rooms have already been requested for cancellation.');
break;
}
}
}
if ($idServiceProductOrderDetails) {
foreach ($idServiceProductOrderDetails as $idServiceProductOrderDetail) {
if (OrderReturn::getOrdersReturnDetail($objOrder->id, 0, 0, $idServiceProductOrderDetail)) {
$this->errors[] = Tools::displayError('Some selected rooms have already been requested for cancellation.');
break;
}
}
}
}
@@ -600,22 +645,39 @@ class OrderDetailControllerCore extends FrontController
$objOrderReturn->refunded_amount = 0;
$objOrderReturn->save();
if ($objOrderReturn->id) {
foreach ($idsHtlBooking as $idHtlBooking) {
$objHtlBooking = new HotelBookingDetail($idHtlBooking);
$numDays = $objHtlBooking->getNumberOfDays(
$objHtlBooking->date_from,
$objHtlBooking->date_to
);
$objOrderReturnDetail = new OrderReturnDetail();
$objOrderReturnDetail->id_order_return = $objOrderReturn->id;
$objOrderReturnDetail->id_order_detail = $objHtlBooking->id_order_detail;
$objOrderReturnDetail->product_quantity = $numDays;
$objOrderReturnDetail->id_htl_booking = $idHtlBooking;
$objOrderReturnDetail->refunded_amount = 0;
if (!$objOrder->getCartRules() && $objOrder->getTotalPaid() <= 0) {
$objOrderReturnDetail->id_customization = 1;
if ($idsHtlBooking) {
foreach ($idsHtlBooking as $idHtlBooking) {
$objHtlBooking = new HotelBookingDetail($idHtlBooking);
$numDays = $objHtlBooking->getNumberOfDays(
$objHtlBooking->date_from,
$objHtlBooking->date_to
);
$objOrderReturnDetail = new OrderReturnDetail();
$objOrderReturnDetail->id_order_return = $objOrderReturn->id;
$objOrderReturnDetail->id_order_detail = $objHtlBooking->id_order_detail;
$objOrderReturnDetail->product_quantity = $numDays;
$objOrderReturnDetail->id_htl_booking = $idHtlBooking;
$objOrderReturnDetail->refunded_amount = 0;
if (!$objOrder->getCartRules() && $objOrder->getTotalPaid() <= 0) {
$objOrderReturnDetail->id_customization = 1;
}
$objOrderReturnDetail->save();
}
}
if ($idServiceProductOrderDetails) {
foreach ($idServiceProductOrderDetails as $idServiceProductOrderDetail) {
$objServiceProductOrderDetail = new ServiceProductOrderDetail($idServiceProductOrderDetail);
$objOrderReturnDetail = new OrderReturnDetail();
$objOrderReturnDetail->id_order_return = $objOrderReturn->id;
$objOrderReturnDetail->id_order_detail = $objServiceProductOrderDetail->id_order_detail;
$objOrderReturnDetail->product_quantity = $objServiceProductOrderDetail->quantity;
$objOrderReturnDetail->id_service_product_order_detail = $idServiceProductOrderDetail;
$objOrderReturnDetail->refunded_amount = 0;
if (!$objOrder->getCartRules() && $objOrder->getTotalPaid() <= 0) {
$objOrderReturnDetail->id_customization = 1;
}
$objOrderReturnDetail->save();
}
$objOrderReturnDetail->save();
}
}
@@ -624,22 +686,28 @@ class OrderDetailControllerCore extends FrontController
if (!$objOrder->getCartRules() && $objOrder->getTotalPaid() <= 0) {
// Process refund in booking tables
foreach ($idsHtlBooking as $idHtlBooking) {
$objHtlBooking = new HotelBookingDetail($idHtlBooking);
if (!$objHtlBooking->processRefundInBookingTables()) {
$this->errors[] = Tools::displayError('An error occurred while cancelling the booking.');
if ($idsHtlBooking) {
foreach ($idsHtlBooking as $idHtlBooking) {
$objHtlBooking = new HotelBookingDetail($idHtlBooking);
if (!$objHtlBooking->processRefundInBookingTables()) {
$this->errors[] = Tools::displayError('An error occurred while cancelling the booking.');
}
}
}
if ($idServiceProductOrderDetails) {
foreach ($idServiceProductOrderDetails as $idServiceProductOrderDetail) {
$objServiceProductOrderDetail = new ServiceProductOrderDetail($idServiceProductOrderDetail);
if (!$objServiceProductOrderDetail->processRefundInTables()) {
$this->errors[] = Tools::displayError('An error occurred while cancelling the product.');
}
}
}
// complete the booking refund directly in the refund request
$objOrderReturn->changeIdOrderReturnState(Configuration::get('PS_ORS_REFUNDED'));
// if all bookings are getting cancelled/Refunded then Cancel/Refund the order also
$idOrderState = 0;
if ($objOrder->hasCompletelyRefunded(Order::ORDER_COMPLETE_REFUND_FLAG)) {
$idOrderState = Configuration::get('PS_OS_REFUND');
} elseif ($objOrder->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_FLAG)) {
$idOrderState = Configuration::get('PS_OS_CANCELED');
}
$idOrderState = $objOrder->getOrderCompleteRefundStatus();
if ($idOrderState) {
$objOrderHistory = new OrderHistory();

View File

@@ -383,6 +383,8 @@ class OrderOpcControllerCore extends ParentOrderController
$this->ajaxDie($this->getCustomerGuestDetail());
exit;
break;
case 'getOpcData':
$this->ajaxDie($this->getOpcData());
default:
throw new PrestaShopException('Unknown method "'.Tools::getValue('method').'"');
}
@@ -423,11 +425,7 @@ class OrderOpcControllerCore extends ParentOrderController
*/
public function initContent()
{
// validate room types before payment by customer
if ($orderRestrictErr = HotelCartBookingData::validateCartBookings()) {
$this->errors = array_merge($this->errors, $orderRestrictErr);
}
$this->_assignCheckoutValidationVars();
parent::initContent();
if (Tools::getValue('submitGuestDetails')) {
@@ -496,14 +494,12 @@ class OrderOpcControllerCore extends ParentOrderController
// $objGlobalDemand = new HotelRoomTypeGlobalDemand();
// $allDemands = $objGlobalDemand->getAllDemands();
// $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$this->_assignCheckoutVars();
$this->context->smarty->assign(
array(
'orderRestrictErr' => count($orderRestrictErr) ? 1 : 0,
// 'allDemands' => $allDemands,
// 'defaultcurrencySign' => $objCurrency->sign,
'THEME_DIR' => _THEME_DIR_,
'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => Configuration::get('PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN'),
'free_shipping' => $free_shipping,
'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0,
'countries' => $countries,
@@ -586,51 +582,7 @@ class OrderOpcControllerCore extends ParentOrderController
$this->addJS(_THEME_JS_DIR_ . 'advanced-payment-api.js');
$this->setTemplate(_PS_THEME_DIR_ . 'order-opc-advanced.tpl');
} else {
// set used objects in the below code
// $objBookingDetail = new HotelBookingDetail();
// $objHtlRoomType = new HotelRoomType();
$cartProducts = $this->context->cart->getProducts();
if (!empty($cartProducts)) {
if ($cartBookingInfo = HotelCartBookingData::getHotelCartBookingData()) {
$this->context->smarty->assign('cart_htl_data', $cartBookingInfo);
}
$objHotelServiceProductCartDetail = new HotelServiceProductCartDetail();
if ($normalCartProduct = $objHotelServiceProductCartDetail->getHotelProducts($this->context->cart->id, 0, 0, 0, null, null, true)) {
$this->context->smarty->assign('cart_normal_data', $normalCartProduct);
}
// For Advanced Payment work
$objAdvPayment = new HotelAdvancedPayment();
if ($objAdvPayment->isAdvancePaymentAvailableForCurrentCart()) {
if (Tools::isSubmit('submitAdvPayment')) {
if (Tools::getValue('payment_type') == Order::ORDER_PAYMENT_TYPE_ADVANCE) {
$this->context->cart->is_advance_payment = 1;
} else {
$this->context->cart->is_advance_payment = 0;
}
$this->context->cart->save();
Tools::redirect($this->context->link->getPageLink('order-opc'));
}
// set if advance payment is selected by the customer
if ($this->context->cart->is_advance_payment) {
$this->context->smarty->assign('is_advance_payment', 1);
}
// get advance payment amount and send data to the template
$advPaymentAmount = $this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT);
$this->context->smarty->assign(array(
'advance_payment_active'=> 1,
'advPaymentAmount'=> $advPaymentAmount,
'dueAmount'=> ($this->context->cart->getOrderTotal() - $advPaymentAmount),
));
}
}
$this->_assignShoppingCart();
$this->setTemplate(_PS_THEME_DIR_.'order-opc.tpl');
}
}
@@ -1024,21 +976,29 @@ class OrderOpcControllerCore extends ParentOrderController
}
}
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$objServiceProductCartDetail = new ServiceProductCartDetail();
$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'],
$cartBookings = $objCartBookingData->getHotelCartRoomsInfoByRoomType($this->context->cart->id, $idProduct,$dateFrom, $dateTo);
foreach($cartBookings as &$cartBookingData) {
$cartBookingData['selected_service'] = $objServiceProductCartDetail->getServiceProductsInCart(
$cartBookingData['id_cart'],
[],
null,
$cartBookingData['id'],
null,
null,
null,
null,
0,
null,
null
null,
1
);
}
$this->context->smarty->assign(array(
'roomTypeServiceProducts' => $roomTypeServiceProducts,
'cartRooms' => $cartRooms
'cartRooms' => $cartBookings
));
}
}
@@ -1175,4 +1135,21 @@ class OrderOpcControllerCore extends ParentOrderController
$this->context->cart->save();
}
}
public function getOpcData()
{
$response = array('success' => false);
if ($this->context->cart->getProducts()) {
$this->_assignCheckoutValidationVars();
$this->_assignCheckoutVars();
$this->_assignShoppingCart();
$response['success'] = true;
$response['shopping_cart'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'shopping-cart.tpl');
$response['cart_total_block'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'cart-total-block.tpl');
} else {
$response['reload'] = 1;
}
return json_encode($response);
}
}

View File

@@ -57,6 +57,8 @@ class OrderReturnControllerCore extends FrontController
) {
$isCanceledBookings = true;
}
$refundReqProducts = $objOrderReturn->getOrderRefundRequestedProducts($objOrderReturn->id_order, $objOrderReturn->id);
$voucher = '';
if (Validate::isLoadedObject($objCartRule = new CartRule($objOrderReturn->id_return_type))) {
$voucher = $objCartRule->name[$this->context->language->id];
@@ -66,6 +68,7 @@ class OrderReturnControllerCore extends FrontController
array (
'orderReturnInfo' => (array)$objOrderReturn,
'refundReqBookings' => $refundReqBookings,
'refundReqProducts' => $refundReqProducts,
'isCanceledBookings' => $isCanceledBookings,
'orderInfo' => (array) $objOrder,
'orderCurrency' => (array) $orderCurrency,

View File

@@ -289,6 +289,101 @@ class ParentOrderControllerCore extends FrontController
return true;
}
protected function _assignCheckoutVars()
{
$show_option_allow_separate_package = (!$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE'));
$advanced_payment_api = (bool)Configuration::get('PS_ADVANCED_PAYMENT_API');
$this->context->smarty->assign(array(
'THEME_DIR' => _THEME_DIR_,
'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => Configuration::get('PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN'),
'show_option_allow_separate_package' => $show_option_allow_separate_package,
'advanced_payment_api' => $advanced_payment_api
));
}
protected function _assignCheckoutValidationVars()
{
if ($orderRestrictErr = HotelCartBookingData::validateCartBookings()) {
$this->errors = array_merge($this->errors, $orderRestrictErr);
}
$this->context->smarty->assign(array(
'orderRestrictErr' => count($orderRestrictErr) ? 1 : 0,
));
}
protected function _assignShoppingCart()
{
$summary = $this->context->cart->getSummaryDetails();
$cartProducts = $this->context->cart->getProducts();
if (!empty($cartProducts)) {
if ($cartBookingInfo = HotelCartBookingData::getHotelCartBookingData()) {
$this->context->smarty->assign('cart_htl_data', $cartBookingInfo);
}
$objServiceProductCartDetail = new ServiceProductCartDetail();
if ($hotelProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[Product::SELLING_PREFERENCE_HOTEL_STANDALONE, Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE],
$idHotel = null,
0,
null,
null,
null,
null,
0,
null,
0,
null,
1
)) {
$this->context->smarty->assign('hotel_products', $hotelProducts);
}
$standaloneProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[Product::SELLING_PREFERENCE_STANDALONE]
);
if (count($standaloneProducts)) {
$this->context->smarty->assign('standalone_products', $standaloneProducts);
}
// For Advanced Payment work
$objAdvPayment = new HotelAdvancedPayment();
if ($objAdvPayment->isAdvancePaymentAvailableForCurrentCart()) {
if (Tools::isSubmit('submitAdvPayment')) {
if (Tools::getValue('payment_type') == Order::ORDER_PAYMENT_TYPE_ADVANCE) {
$this->context->cart->is_advance_payment = 1;
} else {
$this->context->cart->is_advance_payment = 0;
}
$this->context->cart->save();
Tools::redirect($this->context->link->getPageLink('order-opc'));
}
// set if advance payment is selected by the customer
if ($this->context->cart->is_advance_payment) {
$this->context->smarty->assign('is_advance_payment', 1);
}
// get advance payment amount and send data to the template
$advPaymentAmount = $this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT);
$this->context->smarty->assign(array(
'advance_payment_active'=> 1,
'advPaymentAmount'=> $advPaymentAmount,
'dueAmount'=> ($this->context->cart->getOrderTotal() - $advPaymentAmount),
));
}
}
$this->context->smarty->assign($summary);
$this->context->smarty->assign(array(
'HOOK_SHOPPING_CART' => Hook::exec('displayShoppingCartFooter', $summary),
'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('displayShoppingCart', $summary)
));
}
protected function _assignSummaryInformations()
{
$summary = $this->context->cart->getSummaryDetails();
@@ -352,9 +447,6 @@ class ParentOrderControllerCore extends FrontController
}
}
$show_option_allow_separate_package = (!$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE'));
$advanced_payment_api = (bool)Configuration::get('PS_ADVANCED_PAYMENT_API');
$this->context->smarty->assign($summary);
$this->context->smarty->assign(array(
'token_cart' => Tools::getToken(false),
@@ -369,9 +461,7 @@ class ParentOrderControllerCore extends FrontController
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,
'lastProductAdded' => $this->context->cart->getLastProduct(),
'displayVouchers' => $available_cart_rules,
'show_option_allow_separate_package' => $show_option_allow_separate_package,
'smallSize' => Image::getSize(ImageType::getFormatedName('small')),
'advanced_payment_api' => $advanced_payment_api
));
@@ -388,7 +478,14 @@ class ParentOrderControllerCore extends FrontController
$this->context->customer->logout();
Tools::redirect('');
} elseif (!Customer::getAddressesTotalById($this->context->customer->id)) {
$multi = (int)Tools::getValue('multi-shipping');
$objServiceProductCartDetail = new ServiceProductCartDetail();
if (count($objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[Product::SELLING_PREFERENCE_STANDALONE]
))) {
$multi = (int)Tools::getValue('multi-shipping');
Tools::redirect('index.php?controller=address&back='.urlencode('order.php?step=1'.($multi ? '&multi-shipping='.$multi : '')));
}
}
$customer = $this->context->customer;

View File

@@ -116,13 +116,17 @@ class ProductControllerCore extends FrontController
$this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
}
// redirect if the product is not available for front
if (!$this->product->show_at_front) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
$objHotelRoomType = new HotelRoomType();
$hotelRoomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->product->id);
$idHotel = (int) $hotelRoomInfo['id_hotel'];
if (!HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
} else if (!$this->product->booking_product || ($this->product->booking_product && !$this->product->show_at_front)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
if ($hotelRoomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->product->id)) {
$idHotel = (int) $hotelRoomInfo['id_hotel'];
if (!HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
}
if (!Validate::isLoadedObject($this->product)) {
@@ -462,7 +466,7 @@ class ProductControllerCore extends FrontController
}
$this->assignBookingFormVars($this->product->id, $date_from, $date_to, $occupancy_value);
$this->assignServiceProductVars();
$this->assignRoomServiceProductVars();
// product price after imposing feature prices...
if ($useTax) {
@@ -491,6 +495,8 @@ class ProductControllerCore extends FrontController
if (Tools::getValue('error')) {
$this->context->smarty->assign('error', Tools::getValue('error'));
}
} else {
$this->assignServiceProductVars();
}
// send all the common variables for all type of products
@@ -541,7 +547,7 @@ class ProductControllerCore extends FrontController
$this->setTemplate(_PS_THEME_DIR_.'product.tpl');
}
public function assignServiceProductVars()
public function assignRoomServiceProductVars()
{
// get service products for room type
$p = 1;
@@ -784,13 +790,16 @@ class ProductControllerCore extends FrontController
}
$product['name'] = $objServiceProduct->name;
$product['allow_multiple_quantity'] = $objServiceProduct->allow_multiple_quantity;
$productPrice = $objRoomTypeServiceProductPrice->getServicePrice(
$productPrice = Product::getServiceProductPrice(
$product['id_product'],
0,
false,
$idProduct,
$useTax,
$product['quantity'],
$dateFrom,
$dateTo,
$useTax
$dateTo
);
$product['price'] = $productPrice;
$serviceProductsPrice += $productPrice;
@@ -832,6 +841,68 @@ class ProductControllerCore extends FrontController
return true;
}
public function assignServiceProductVars(
$idProductOption = false,
$quantity = 1,
$idHotel = false
) {
$smartyVars = array();
if (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $this->product->selling_preference_type
|| Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $this->product->selling_preference_type
) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
if ($associatedHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($this->product->id)['hotel']) {
foreach ($associatedHotels as $key => $hotel) {
if (Validate::isLoadedObject($objHotel = new HotelBranchInformation($hotel, $this->context->language->id))) {
$associatedHotels[$key] = array('id_hotel' => $hotel, 'name' => $objHotel->hotel_name);
} else {
unset($associatedHotels[$key]);
}
}
$smartyVars['associated_hotels'] = $associatedHotels;
}
}
if ($idHotel) {
$smartyVars['service_id_hotel'] = $idHotel;
}
$useTax = HotelBookingDetail::useTax();
$objServiceProductOption = new ServiceProductOption();
if ($serviceProductOptions = $objServiceProductOption->getProductOptions($this->product->id)) {
foreach ($serviceProductOptions as &$serviceProductOption) {
if ($idProductOption == null) {
$idProductOption = $serviceProductOption['id_product_option'];
}
$serviceProductOption['price'] = RoomTypeServiceProductPrice::getPrice(
$this->product->id,
$idHotel,
$serviceProductOption['id_product_option'],
$useTax,
1
);
}
}
$smartyVars['product_option'] = $serviceProductOptions;
$smartyVars['service_price'] = RoomTypeServiceProductPrice::getPrice(
$this->product->id,
$idHotel,
$idProductOption,
$useTax,
$quantity
);
if ($quantity) {
$smartyVars['quantity'] = $quantity;
}
if ($idProductOption) {
$smartyVars['id_product_option'] = $idProductOption;
}
$this->context->smarty->assign($smartyVars);
return true;
}
/**
* Assign price and tax to the template
*/
@@ -1301,35 +1372,45 @@ class ProductControllerCore extends FrontController
{
$response = array('status' => false);
$idProduct = (int) Tools::getValue('id_product');
$dateFrom = Tools::getValue('room_check_in');
$dateTo = Tools::getValue('room_check_out');
$occupancy = Tools::getValue('occupancy');
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
if (!Validate::isOccupancy($occupancy)) {
$occupancy = array();
if ($this->product->booking_product) {
$dateFrom = Tools::getValue('room_check_in');
$dateTo = Tools::getValue('room_check_out');
$occupancy = Tools::getValue('occupancy');
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
if (!Validate::isOccupancy($occupancy)) {
$occupancy = array();
}
} else {
$occupancy = Tools::getValue('qty', 1);
}
$roomTypeDemands = Tools::getValue('room_type_demands');
$roomServiceProducts = Tools::getValue('room_service_products');
$dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom));
$dateTo = date('Y-m-d H:i:s', strtotime($dateTo));
$this->assignRoomServiceProductVars();
if ($this->assignBookingFormVars(
$idProduct,
$dateFrom,
$dateTo,
$occupancy,
$roomTypeDemands,
$roomServiceProducts
)) {
}
} else {
$occupancy = Tools::getValue('qty', 1);
$idHotel = Tools::getValue('service_id_hotel');
$id_product_option = Tools::getValue('id_product_option');
$quantity = Tools::getValue('service_product_qty');
$this->assignServiceProductVars(
$id_product_option,
$quantity,
$idHotel
);
}
$roomTypeDemands = Tools::getValue('room_type_demands');
$roomServiceProducts = Tools::getValue('room_service_products');
$dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom));
$dateTo = date('Y-m-d H:i:s', strtotime($dateTo));
$this->assignServiceProductVars();
if ($this->assignBookingFormVars(
$idProduct,
$dateFrom,
$dateTo,
$occupancy,
$roomTypeDemands,
$roomServiceProducts
)) {
$html = $this->context->smarty->fetch('_partials/booking-form.tpl');
$response['status'] = true;
$response['html_booking_form'] = $html;
}
$html = $this->context->smarty->fetch('_partials/booking-form.tpl');
$response['status'] = true;
$response['html_booking_form'] = $html;
$this->ajaxDie(json_encode($response));
}

View File

@@ -1260,7 +1260,7 @@ CREATE TABLE `PREFIX_order_detail` (
`group_reduction` DECIMAL(10, 2) NOT NULL DEFAULT '0.000000',
`product_quantity_discount` decimal(20,6) NOT NULL DEFAULT '0.000000',
`is_booking_product` tinyint(1) NOT NULL DEFAULT '0',
`product_service_type` tinyint(1) NOT NULL DEFAULT '1',
`selling_preference_type` tinyint(1) NOT NULL DEFAULT '1',
`product_auto_add` tinyint(1) NOT NULL DEFAULT '0',
`product_price_addition_type` tinyint(1) NOT NULL DEFAULT '0',
`product_allow_multiple_quantity` tinyint(1) unsigned NOT NULL DEFAULT '1',
@@ -1359,12 +1359,14 @@ CREATE TABLE `PREFIX_order_return` (
CREATE TABLE `PREFIX_order_return_detail` (
`id_order_return_detail` int(10) unsigned NOT NULL auto_increment,
`id_order_return` int(10) unsigned NOT NULL,
`id_htl_booking` int(11) NOT NULL,
`id_htl_booking` int(11) NOT NULL,
`id_service_product_order_detail` int(11) NOT NULL,
`refunded_amount` decimal(20,6) NOT NULL DEFAULT '0.000000',
`id_order_detail` int(10) unsigned NOT NULL DEFAULT '0',
`id_customization` int(10) unsigned NOT NULL DEFAULT '0',
`product_quantity` int(10) unsigned NOT NULL DEFAULT '0',
KEY `id_htl_booking` (`id_htl_booking`),
KEY `id_service_product_order_detail` (`id_service_product_order_detail`),
PRIMARY KEY (`id_order_return_detail`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
@@ -1417,6 +1419,7 @@ CREATE TABLE `PREFIX_order_slip_detail` (
`id_order_slip` int(10) unsigned NOT NULL,
`id_order_detail` int(10) unsigned NOT NULL,
`id_htl_booking` int(10) unsigned NOT NULL,
`id_service_product_order_detail` int(10) unsigned NOT NULL,
`product_quantity` int(10) unsigned NOT NULL DEFAULT '0',
`unit_price_tax_excl` DECIMAL(20, 6) NULL,
`unit_price_tax_incl` DECIMAL(20, 6) NULL,
@@ -1424,7 +1427,7 @@ CREATE TABLE `PREFIX_order_slip_detail` (
`total_price_tax_incl` DECIMAL(20, 6),
`amount_tax_excl` DECIMAL(20, 6) DEFAULT NULL,
`amount_tax_incl` DECIMAL(20, 6) DEFAULT NULL,
PRIMARY KEY (`id_order_slip`,`id_htl_booking`)
PRIMARY KEY (`id_order_slip`,`id_htl_booking`,`id_service_product_order_detail`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
CREATE TABLE `PREFIX_order_state` (
@@ -1556,7 +1559,7 @@ CREATE TABLE `PREFIX_product` (
`auto_add_to_cart` tinyint(1) NOT NULL DEFAULT '0',
`price_addition_type` tinyint(1) NOT NULL DEFAULT '1',
`show_at_front` tinyint(1) NOT NULL DEFAULT '1',
`service_product_type` tinyint(1) NOT NULL DEFAULT '1',
`selling_preference_type` tinyint(1) NOT NULL DEFAULT '1',
`price_display_method` tinyint(1) NOT NULL DEFAULT '1',
`available_date` date NOT NULL DEFAULT '0000-00-00',
`condition` ENUM('new', 'used', 'refurbished') NOT NULL DEFAULT 'new',

View File

@@ -970,6 +970,9 @@
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_DISPLAY_CONTACT" name="PS_CUSTOMER_SERVICE_DISPLAY_CONTACT">
<value>1</value>
</configuration>
<configuration id="PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE" name="PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE">
<value>0</value>
</configuration>
<configuration id="PS_CUSTOMER_GUEST_MAX_LIMIT" name="PS_CUSTOMER_GUEST_MAX_LIMIT">
<value>5</value>

View File

@@ -41,8 +41,8 @@ set `id_address_tax` = `id_address_invoice`;
ALTER TABLE `PREFIX_order_detail`
ADD `is_booking_product` tinyint(1) NOT NULL DEFAULT '0' AFTER `product_quantity_discount`,
ADD `product_service_type` tinyint(1) NOT NULL DEFAULT '1' AFTER `is_booking_product`,
ADD `product_auto_add` tinyint(1) NOT NULL DEFAULT '0' AFTER `product_service_type`,
ADD `selling_preference_type` tinyint(1) NOT NULL DEFAULT '1' AFTER `is_booking_product`,
ADD `product_auto_add` tinyint(1) NOT NULL DEFAULT '0' AFTER `selling_preference_type`,
ADD `product_price_addition_type` tinyint(1) NOT NULL DEFAULT '0' AFTER `product_auto_add`,
ADD `product_allow_multiple_quantity` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `product_price_addition_type`,
ADD `product_price_calculation_method` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `product_allow_multiple_quantity`;
@@ -86,8 +86,8 @@ ADD `price_calculation_method` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `m
ADD `auto_add_to_cart` tinyint(1) NOT NULL DEFAULT '0' AFTER `available_for_order`,
ADD `price_addition_type` tinyint(1) NOT NULL DEFAULT '1' AFTER `auto_add_to_cart`,
ADD `show_at_front` tinyint(1) NOT NULL DEFAULT '1' AFTER `price_addition_type`,
ADD `service_product_type` tinyint(1) NOT NULL DEFAULT '1' AFTER `show_at_front`,
ADD `price_display_method` tinyint(1) NOT NULL DEFAULT '1' AFTER `service_product_type`,
ADD `selling_preference_type` tinyint(1) NOT NULL DEFAULT '1' AFTER `show_at_front`,
ADD `price_display_method` tinyint(1) NOT NULL DEFAULT '1' AFTER `selling_preference_type`,
ADD `booking_product` tinyint(1) NOT NULL DEFAULT '1' AFTER `is_virtual`;
ALTER TABLE `PREFIX_product_shop`

View File

@@ -512,6 +512,14 @@ function changeOverbookingOrderAction()
$('#PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY').closest('.form-group').show();
}
function changeStandardProductAddressType()
{
if (getE('PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE').value == STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM)
$('#conf_id_PS_STANDARD_PRODUCT_ORDER_ADDRESS').closest('.form-group').show();
else
$('#conf_id_PS_STANDARD_PRODUCT_ORDER_ADDRESS').closest('.form-group').hide();
}
function disableZipFormat()
{
if ($('#need_zip_code_on').prop('checked') == false)

View File

@@ -550,20 +550,58 @@ product_tabs['Informations'] = new function(){
this.switchProductType = function(){
$('#service_product_type').on('change',function(){
if (parseInt($(this).val()) == with_room_type) {
$('#associated_hotel_rooms_tree').show('fast');
$('#selling_preference_type').on('change',function(){
if (parseInt($(this).val()) == SELLING_PREFERENCE_WITH_ROOM_TYPE) {
$('#associated_hotel_tree').hide('fast').find('input').each(function() {
$(this).attr('data-name', $(this).attr('name'));
$(this).removeAttr('name');
});
$('#associated_hotel_rooms_tree').show('fast').find('input').each(function() {
$(this).attr('name', $(this).attr('data-name'));
$(this).removeAttr('data-name');
});
$('#auto_add_to_cart_container').show('fast');
$('#show_at_front_container').show('fast');
$('#product_options').show('fast');
} else if (parseInt($(this).val()) == SELLING_PREFERENCE_HOTEL_STANDALONE) {
$('#associated_hotel_rooms_tree').hide('fast').find('input').each(function() {
$(this).attr('data-name', $(this).attr('name'));
$(this).removeAttr('name');
});
$('#associated_hotel_tree').show('fast').find('input').each(function() {
$(this).attr('name', $(this).attr('data-name'));
$(this).removeAttr('data-name');
});
$('#auto_add_to_cart_container').hide('fast');
$('#show_at_front_container').show('fast');
$('#product_options').show('fast');
} else if (parseInt($(this).val()) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE) {
$('#associated_hotel_rooms_tree').show('fast').find('input').each(function() {
$(this).attr('name', $(this).attr('data-name'));
$(this).removeAttr('data-name');
});
$('#associated_hotel_tree').show('fast').find('input').each(function() {
$(this).attr('name', $(this).attr('data-name'));
$(this).removeAttr('data-name');
});
$('#auto_add_to_cart_container').hide('fast');
$('#show_at_front_container').show('fast');
$('#product_options').show('fast');
} else if (parseInt($(this).val()) == SELLING_PREFERENCE_STANDALONE) {
$('#associated_hotel_rooms_tree').hide('fast').find('input').each(function() {
$(this).attr('data-name', $(this).attr('name'));
$(this).removeAttr('name');
});
$('#associated_hotel_tree').hide('fast').find('input').each(function() {
$(this).attr('data-name', $(this).attr('name'));
$(this).removeAttr('name');
});
$('#auto_add_to_cart_container').hide('fast');
$('#show_at_front_container').show('fast');
$('#product_options').show('fast');
$('#independent_product_info').hide('fast');
} else {
$('#associated_hotel_rooms_tree').hide('fast');
$('#show_at_front_container').hide('fast');
$('#product_options').hide('fast');
$('#independent_product_info').show('fast');
}
});
$('#selling_preference_type').trigger('change');
$('#simple_product').attr('checked', true);
$('input[name="type_product"]').on('click', function(e)
@@ -615,6 +653,122 @@ product_tabs['Features'] = new function(){
}
}
product_tabs['Quantities'] = new function(){
var self = this;
this.ajaxCall = function(data){
data.ajaxProductQuantity = 1;
data.id_product = id_product;
data.token = token;
data.ajax = 1;
data.controller = "AdminNormalProducts";
data.action = "productQuantity";
$.ajax({
type: "POST",
url: "ajax-tab.php",
data: data,
dataType: 'json',
async : true,
beforeSend: function(xhr, settings)
{
$('.product_quantities_button').attr('disabled', 'disabled');
},
complete: function(xhr, status)
{
$('.product_quantities_button').removeAttr('disabled');
},
success: function(msg)
{
if (msg.error)
{
showErrorMessage(msg.error);
return;
}
showSuccessMessage(quantities_ajax_success);
},
error: function(jqXHR, textStatus, errorThrown)
{
if (textStatus != 'error' || errorThrown != '')
showErrorMessage(textStatus + ': ' + errorThrown);
}
});
};
this.refreshQtyAvailabilityForm = function()
{
if ($('#depends_on_stock_0').prop('checked'))
{
$('.available_quantity').find('input').show();
$('.available_quantity').find('span').hide();
}
else
{
$('.available_quantity').find('input').hide();
$('.available_quantity').find('span').show();
}
};
this.onReady = function(){
$('#available_date').datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
$('.depends_on_stock').click(function(e)
{
self.refreshQtyAvailabilityForm();
self.ajaxCall( { actionQty: 'depends_on_stock', value: $(this).val() } );
if($(this).val() == 0)
$('.available_quantity input').trigger('change');
});
$('.advanced_stock_management').click(function(e)
{
var val = 0;
if ($(this).prop('checked'))
val = 1;
self.ajaxCall({actionQty: 'advanced_stock_management', value: val});
if (val == 1)
{
$(this).val(1);
$('#depends_on_stock_1').attr('disabled', false);
}
else
{
$(this).val(0);
$('#depends_on_stock_1').attr('disabled', true);
$('#depends_on_stock_0').attr('checked', true);
self.ajaxCall({actionQty: 'depends_on_stock', value: 0});
self.refreshQtyAvailabilityForm();
}
self.refreshQtyAvailabilityForm();
});
$('.available_quantity').find('input').change(function(e, init_val)
{
self.ajaxCall({actionQty: 'set_qty', id_product_attribute: $(this).parent().attr('id').split('_')[1], value: $(this).val()});
});
$('.out_of_stock').click(function(e)
{
self.refreshQtyAvailabilityForm();
self.ajaxCall({actionQty: 'out_of_stock', value: $(this).val()});
});
if (display_multishop_checkboxes)
ProductMultishop.checkAllQuantities();
$('.pack_stock_type').click(function(e)
{
self.refreshQtyAvailabilityForm();
self.ajaxCall({actionQty: 'pack_stock_type', value: $(this).val()});
});
self.refreshQtyAvailabilityForm();
};
}
/**
* Update the product image list position buttons
*

File diff suppressed because it is too large Load Diff

View File

@@ -71,7 +71,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">Thank you for booking with <strong>{hotel_hotel_name}</strong>!</span>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">{order_header_line_html}</span>
</font>
</td>
</tr>

View File

@@ -1,147 +1,166 @@
{if isset($list)}
<table class="table table-recap extra-demand-table">
<thead>
<tr>
<th colspan="3">{l s='Extra Demands Details'}</th>
</tr>
<tr>
<th>{l s='Room Type'}</th>
<th>{l s='Name'}</th>
<th>{l s='Total'} <br /> {l s='(Tax excl.)'}</th>
</tr>
</thead>
<tbody>
{if isset($list)}
{foreach from=$list key=data_k item=data_v}
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
{if isset($rm_v['extra_demands']) && $rm_v['extra_demands']}
{assign var=roomCount value=1}
{foreach $rm_v['extra_demands'] as $roomDemand}
{foreach name=demandRow from=$roomDemand['extra_demands'] item=demand}
{if !isset($room_demand_exists)}
{assign var=room_demand_exists value=1}
{/if}
<tr>
{if $smarty.foreach.demandRow.first}
<td class="text-center" rowspan="{$roomDemand['extra_demands']|count}">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['name']}<br>
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}<br>
<strong>{l s='Room'} - {$roomCount}</strong>
</font>
</td>
{/if}
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$demand['name']}
</font>
</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{convertPrice price=$demand['total_price_tax_excl']}
</font>
</td>
</tr>
{/foreach}
{assign var=roomCount value=$roomCount+1}
{/foreach}
{/if}
{/foreach}
{/foreach}
{/if}
{if !isset($room_demand_exists)}
<tr>
<td colspan="3">{l s='No facilities requested'}</td>
</tr>
{/if}
</tbody>
</table>
<br><br>
<table class="table table-recap extra-demand-table">
<thead>
<tr>
<th colspan="4">{l s='Additional services Details'}</th>
</tr>
<tr>
<th>{l s='Room Type'}</th>
<th>{l s='Name'}</th>
<th>{l s='Qty'}</th>
<th>{l s='Total'}</th>
</tr>
</thead>
<tbody>
{if isset($list)}
{foreach from=$list key=data_k item=data_v}
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
{if isset($rm_v['additional_services']) && $rm_v['additional_services']}
{assign var=roomCount value=1}
{foreach $rm_v['additional_services'] as $roomService}
{foreach name=serviceRow from=$roomService['additional_services'] item=service}
{if !isset($room_additinal_services_exists)}
{assign var=room_additinal_services_exists value=1}
{/if}
<tr>
{if $smarty.foreach.serviceRow.first}
<td class="text-center" rowspan="{$roomService['additional_services']|count}">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['name']}<br>
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}<br>
<strong>{l s='Room'} - {$roomCount}</strong>
</font>
</td>
{/if}
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$service['name']}
</font>
</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{if $service['allow_multiple_quantity']}
{$service['quantity']}
{else}
{l s='--'}
{/if}
</font>
</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{convertPrice price=$service['total_price_tax_excl']}
</font>
</td>
</tr>
{/foreach}
{assign var=roomCount value=$roomCount+1}
{/foreach}
{/if}
{/foreach}
{/foreach}
{/if}
{if !isset($room_additinal_services_exists)}
<tr>
<td colspan="4">{l s='No service requested'}</td>
</tr>
{/if}
</tbody>
</table>
{if isset($list) && $list}
<table class="table table-recap room-extra-demand-table">
<thead>
<tr>
<th colspan="3" class="table-caption">{l s='Room Extra Demands Detail'}</th>
</tr>
<tr>
<th>{l s='Room Type'}</th>
<th>{l s='Name'}</th>
<th>{l s='Total'} <br /> {l s='(Tax excl.)'}</th>
</tr>
</thead>
<tbody>
{foreach from=$list key=data_k item=data_v}
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
{if isset($rm_v['extra_demands']) && $rm_v['extra_demands']}
{assign var=roomCount value=1}
{foreach $rm_v['extra_demands'] as $roomDemand}
{foreach name=demandRow from=$roomDemand['extra_demands'] item=demand}
{if !isset($room_demand_exists)}
{assign var=room_demand_exists value=1}
{/if}
<tr>
{if $smarty.foreach.demandRow.first}
<td rowspan="{$roomDemand['extra_demands']|count}">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['name']}<br>
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}<br>
<strong>{l s='Room'} - {$roomCount}</strong>
</font>
</td>
{/if}
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$demand['name']}
</font>
</td>
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
{convertPrice price=$demand['total_price_tax_excl']}
</font>
</td>
</tr>
{/foreach}
{assign var=roomCount value=$roomCount+1}
{/foreach}
{/if}
{/foreach}
{/foreach}
{if !isset($room_demand_exists)}
<tr>
<th colspan="3" class="table-caption">{l s='No room extra demands added.'}</th>
</tr>
{/if}
</tbody>
</table>
<table class="table table-recap room-extra-service-table">
<thead>
<tr>
<th colspan="4" class="table-caption">{l s='Rooms Services Detail'}</th>
</tr>
<tr>
<th>{l s='Room Type'}</th>
<th>{l s='Name'}</th>
<th>{l s='Qty'}</th>
<th>{l s='Total'}</th>
</tr>
</thead>
<tbody>
{foreach from=$list key=data_k item=data_v}
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
{if isset($rm_v['additional_services']) && $rm_v['additional_services']}
{assign var=roomCount value=1}
{foreach $rm_v['additional_services'] as $roomService}
{foreach name=serviceRow from=$roomService['additional_services'] item=service}
{if !isset($room_additinal_services_exists)}
{assign var=room_additinal_services_exists value=1}
{/if}
<tr>
{if $smarty.foreach.serviceRow.first}
<td rowspan="{$roomService['additional_services']|count}">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['name']}<br>
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}<br>
<strong>{l s='Room'} - {$roomCount}</strong>
</font>
</td>
{/if}
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$service['name']}
</font>
</td>
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
{if $service['allow_multiple_quantity']}
{$service['quantity']}
{else}
{l s='--'}
{/if}
</font>
</td>
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
{convertPrice price=$service['total_price_tax_excl']}
</font>
</td>
</tr>
{/foreach}
{assign var=roomCount value=$roomCount+1}
{/foreach}
{/if}
{/foreach}
{/foreach}
{if !isset($room_additinal_services_exists)}
<tr>
<th colspan="4" class="table-caption">{l s='No room services added.'}</th>
</tr>
{/if}
</tbody>
</table>
<style>
.extra-demand-table {
{if !isset($room_demand_exists)}
.room-extra-demand-table {
display: none;
}
{/if}
{if !isset($room_additinal_services_exists)}
.room-extra-service-table {
display: none;
}
{else}
.room-extra-demand-table {
margin-bottom: 20px;
}
{/if}
.room-extra-demand-table, .room-extra-service-table {
width:100%;
border-collapse:collapse;
padding:5px;
}
.extra-demand-table th {
.room-extra-demand-table th, .room-extra-service-table th {
border:1px solid #D6D4D4;
background-color: #fbfbfb;
color: #333;
font-family: Arial;
font-size: 13px;
padding: 7px 5px;
text-align:left;
padding: 7px 7px 5px 10px;
text-align:left;
}
.extra-demand-table td {
.room-extra-demand-table th.table-caption, .room-extra-service-table th.table-caption {
text-align: left;
padding:10px;
}
.room-extra-demand-table td, .room-extra-service-table td {
border:1px solid #D6D4D4;
padding:5px;
text-align:left;
padding: 5px 5px 5px 10px;
}
</style>
{/if}

View File

@@ -1,20 +1,30 @@
{if isset($list)}
{l s='Extra Demands Details'}
{if isset($list) && $list}
{l s='Room Extra Demands Detail'}
{l s='Room Type'}
{l s='Extra demand name'}
{l s='Name'}
{l s='Total'} {l s='(Tax excl.)'}
{foreach from=$list key=data_k item=data_v}
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
{if isset($rm_v['extra_demands']) && $rm_v['extra_demands']}
{assign var=roomCount value=1}
{foreach $rm_v['extra_demands'] as $roomDemand}
{foreach name=demandRow from=$roomDemand['extra_demands'] item=demand}
{if !isset($room_demand_exists)}
{assign var=room_demand_exists value=1}
{/if}
{if $smarty.foreach.demandRow.first}
{$data_v['name']}
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}
{l s='Room'} - {$roomCount}
{/if}
{$demand['name']}
@@ -27,4 +37,56 @@
{/if}
{/foreach}
{/foreach}
{if !isset($room_demand_exists)}
{l s='No room extra demands added.'}
{/if}
{l s='Rooms Services Detail'}
{l s='Room Type'}
{l s='Name'}
{l s='Qty'}
{l s='Total'}
{foreach from=$list key=data_k item=data_v}
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
{if isset($rm_v['additional_services']) && $rm_v['additional_services']}
{assign var=roomCount value=1}
{foreach $rm_v['additional_services'] as $roomService}
{foreach name=serviceRow from=$roomService['additional_services'] item=service}
{if !isset($room_additinal_services_exists)}
{assign var=room_additinal_services_exists value=1}
{/if}
{if $smarty.foreach.serviceRow.first}
{$data_v['name']}
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}
{l s='Room'} - {$roomCount}
{/if}
{$service['name']}
{if $service['allow_multiple_quantity']}
{$service['quantity']}
{else}
{l s='--'}
{/if}
{convertPrice price=$service['total_price_tax_excl']}
{/foreach}
{assign var=roomCount value=$roomCount+1}
{/foreach}
{/if}
{/foreach}
{/foreach}
{if !isset($room_additinal_services_exists)}
{l s='No room services added.'}
{/if}
{/if}

View File

@@ -0,0 +1,60 @@
{if isset($list) && $list}
<table class="table table-recap room-booking-table">
<thead>
<tr>
<th colspan="9" class="table-caption">{l s='Rooms Bookings Detail'}</th>
</tr>
<tr>
<th>{l s="Room Num"}</th>
<th>{l s="Room Type"}</th>
<th>{l s="Hotel"}</th>
<th>{l s="Duration"}</th>
</tr>
</thead>
{foreach from=$list key=data_k item=data_v}
<tr>
<td>
{$data_v['room_num']}
</td>
<td>
{$data_v['room_type_name']}
</td>
<td>
{$data_v['hotel_name']}
</td>
<td>
{$data_v['date_from']|date_format:"%d-%b-%G"} To {$data_v['date_to']|date_format:"%d-%b-%G"}
</td>
</tr>
{/foreach}
</table>
<style>
.room-booking-table {
width:100%;
border-collapse:collapse;
padding:5px;
}
.room-booking-table th {
border:1px solid #D6D4D4;
background-color: #fbfbfb;
color: #333;
font-family: Arial;
font-size: 13px;
padding: 7px 7px 5px 10px;
text-align:left;
}
.room-booking-table th.table-caption {
text-align: left;
padding:10px;
}
.room-booking-table td {
border:1px solid #D6D4D4;
padding:5px;
text-align:left;
padding: 5px 5px 5px 10px;
}
.pull-right {
float: right;
}
</style>
{/if}

View File

@@ -0,0 +1,22 @@
{if isset($list) && $list}
{l s="Room Num"}
{l s="Room Type"}
{l s="Hotel"}
{l s="Duration"}
{foreach from=$list key=data_k item=data_v}
{$data_v['room_num']}
{$data_v['room_type_name']}
{$data_v['hotel_name']}
{$data_v['date_from']|date_format:"%d-%b-%G"} To {$data_v['date_to']|date_format:"%d-%b-%G"}
{/foreach}
{/if}

View File

@@ -0,0 +1,60 @@
{if isset($list) && $list}
<table class="table table-recap room-booking-table">
<thead>
<tr>
<th colspan="9" class="table-caption">{l s='Rooms Bookings Detail'}</th>
</tr>
<tr>
<th>{l s="Room Type"}</th>
<th>{l s="Hotel"}</th>
<th>{l s="Rooms Qty"}</th>
<th>{l s="Duration"}</th>
</tr>
</thead>
{foreach from=$list key=data_k item=data_v}
<tr>
<td>
{$data_v['room_type_name']}
</td>
<td>
{$data_v['hotel_name']}
</td>
<td>
{$data_v['num_rooms']}
</td>
<td>
{$data_v['date_from']|date_format:"%d-%b-%G"} To {$data_v['date_to']|date_format:"%d-%b-%G"}
</td>
</tr>
{/foreach}
</table>
<style>
.room-booking-table {
width:100%;
border-collapse:collapse;
padding:5px;
}
.room-booking-table th {
border:1px solid #D6D4D4;
background-color: #fbfbfb;
color: #333;
font-family: Arial;
font-size: 13px;
padding: 7px 7px 5px 10px;
text-align:left;
}
.room-booking-table th.table-caption {
text-align: left;
padding:10px;
}
.room-booking-table td {
border:1px solid #D6D4D4;
padding:5px;
text-align:left;
padding: 5px 5px 5px 10px;
}
.pull-right {
float: right;
}
</style>
{/if}

View File

@@ -0,0 +1,25 @@
{if isset($list) && $list}
{l s='Rooms Bookings Detail'}
{l s="Room Type"}
{l s="Hotel"}
{l s="Rooms Qty"}
{l s="Duration"}
{foreach from=$list key=data_k item=data_v}
{$data_v['room_type_name']}
{$data_v['hotel_name']}
{$data_v['num_rooms']}
{$data_v['date_from']|date_format:"%d-%b-%G"} To {$data_v['date_to']|date_format:"%d-%b-%G"}
{/foreach}
{/if}

View File

@@ -1,132 +0,0 @@
{if isset($list)}
{foreach from=$list key=data_k item=data_v}
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
<tr>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<img src="{$data_v['cover_img']}" class="img-responsive" />
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['name']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['hotel_name']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>
{$rm_v['adults']} {l s='Adults'}, {$rm_v['children']} {l s='Children'}
</strong>
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{convertPrice price=$rm_v['avg_paid_unit_price_tax_excl']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$rm_v['num_rm']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$rm_v['data_form']|date_format:"%d-%b-%G"}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$rm_v['data_to']|date_format:"%d-%b-%G"}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{convertPrice price=$rm_v['amount_tax_excl']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
{/foreach}
{/foreach}
{/if}
<style>
.pull-right {
float: right;
}
</style>

View File

@@ -1,97 +0,0 @@
{if isset($list) && $list}
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Image</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Name</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Unit Price</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Qty</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Total</th>
</tr>
<tbody>
<tr>
<td colspan="5" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
{foreach from=$list key=key item=product}
<tr>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<img src="{$product['cover_img']}" class="img-responsive" />
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['name']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{convertPrice price=$product['unit_price']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['quantity']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{convertPrice price=$product['price']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
{/foreach}
</td>
</tr>
</tbody>
</table>
</font>
</td>
</tr>
<style>
.pull-right {
float: right;
}
</style>
{/if}

View File

@@ -0,0 +1,83 @@
{if isset($list) && $list}
<table class="table table-recap room-booking-table">
<thead>
<tr>
<th colspan="9" class="table-caption">{l s='Rooms Booking Detail'}</th>
</tr>
<tr>
<th>{l s="Room Image"}</th>
<th>{l s="Room Description"}</th>
<th>{l s="Hotel"}</th>
<th>{l s="Room Capcity"}</th>
<th>{l s="Unit Price"}</th>
<th>{l s="Rooms Qty"}</th>
<th>{l s="Check-in Date"}</th>
<th>{l s="Check-out Date"}</th>
<th>{l s="Total"}</th>
</tr>
</thead>
{foreach from=$list key=data_k item=data_v}
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
<tr>
<td>
<img src="{$data_v['cover_img']}" class="img-responsive" />
</td>
<td >
{$data_v['name']}
</td>
<td >
{$data_v['hotel_name']}
</td>
<td >
{$rm_v['adults']} {l s='Adults'}, {$rm_v['children']} {l s='Children'}
</td>
<td>
{convertPrice price=$rm_v['avg_paid_unit_price_tax_excl']}
</td>
<td>
{$rm_v['num_rm']}
</td>
<td>
{assign var="is_full_date" value=($show_full_date && ($rm_v['data_form']|date_format:'%D' == $rm_v['data_to']|date_format:'%D'))}
{$rm_v['data_form']|date_format:"%d-%b-%G"}{if $is_full_date} {$rm_v['data_form']|date_format:"%I:%M %p"}{/if}
</td>
<td>
{$rm_v['data_to']|date_format:"%d-%b-%G"}{if $is_full_date} {$rm_v['data_to']|date_format:"%I:%M %p"}{/if}
</td>
<td>
{convertPrice price=$rm_v['amount_tax_excl']}
</td>
</tr>
{/foreach}
{/foreach}
</table>
<style>
.room-booking-table {
width:100%;
border-collapse:collapse;
padding:5px;
}
.room-booking-table th {
border:1px solid #D6D4D4;
background-color: #fbfbfb;
color: #333;
font-family: Arial;
font-size: 13px;
padding: 7px 7px 5px 10px;
text-align:left;
}
.room-booking-table th.table-caption {
text-align: left;
padding:10px;
}
.room-booking-table td {
border:1px solid #D6D4D4;
padding:5px;
text-align:left;
padding: 5px 5px 5px 10px;
}
.pull-right {
float: right;
}
</style>
{/if}

View File

@@ -87,7 +87,7 @@
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
Order canceled&nbsp;-&nbsp;<a href="{history_url}" target="_blank" style="color:#337ff1">{order_name}</a>
</p>
<span style="color:#777">Your order with the reference <span style="color:#333"><strong>{order_name}</strong></span> from <span style="color:#333"><strong>{hotel_hotel_name}</strong></span> has been canceled.</span>
<span style="color:#777">Your order with the reference <span style="color:#333"><strong>{order_name}</strong></span> has been canceled.</span>
</font>
</td>
<td width="10" style="padding:7px 0">&nbsp;</td>
@@ -111,20 +111,10 @@
<p style="margin:3px 0 0px;">
<span style="color:#333"><strong>Order reference:</strong></span> {order_name}<br />
<span style="color:#333"><strong>Order total:</strong></span> {total_paid}<br />
<span style="color:#333"><strong>Total Rooms:</strong></span> {num_rooms}<br />
</p>
</font>
<br/>
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="margin:3px 0 0px;font-weight:500;font-size:18px;padding-bottom: 10px;">
Hotel details:
</p>
<p style="margin:3px 0 0px;">
<span style="color:#333"><strong>Hotel Name:</strong></span> {hotel_hotel_name}<br />
<span style="color:#333"><strong>Hotel Phone:</strong></span> {hotel_phone}<br />
<span style="color:#333"><strong>Hotel Email:</strong></span> {hotel_email}<br />
</p>
</font>
{order_hotel_detail_html}
</td>
<td width="10" style="padding:7px 0">&nbsp;</td>
</tr>

View File

@@ -55,7 +55,7 @@
</style>
</head>
<body style="-webkit-text-size-adjust:none;background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
<body style="-webkit-text-size-adjust:none;background-color:#fff;width:800px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
<table class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
<tr>
<td class="space" style="width:20px;padding:7px 0">&nbsp;</td>
@@ -73,7 +73,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">Thank you for booking with <strong>{hotel_name}</strong>!</span>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">{order_header_line_html}</span>
</font>
</td>
</tr>
@@ -100,216 +100,26 @@
</table>
</td>
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Image</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Description</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Room Capcity</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Unit Price</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Rooms Qty</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-in Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-out Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Total</th>
</tr>
<tbody>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
&nbsp;&nbsp;{cart_booking_data_html}
</td>
</tr>
</tbody>
</table>
</font>
{cart_booking_data_html}
</td>
</tr>
<tr>
<td style="text-align:center;color:#777;padding:7px 0">
<td style="padding:7px 0">
{extra_demands_details_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Rooms Cost</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{room_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Extra Services Cost </strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{additional_service_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Convenience Fees</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_convenience_fee_te}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Tax</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_order_tax}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Discounts</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_discounts}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Final Booking Amount</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="4" face="Open-sans, sans-serif" color="#555454">
{total_paid}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</font>
{normal_products_data_html}
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
<td style="padding:7px 0">
{order_total_info_html}
</td>
</tr>
<tr>
<td class="linkbelow" style="padding:7px 0">

View File

@@ -3,39 +3,16 @@ Hi {firstname} {lastname},
Thank you for booking with <strong>{hotel_name}</strong>!
Order details
Order: {order_name} Placed on {date}
Room Image
Room Description
Hotel
Room Capcity
Unit Price
Rooms Qty
Check-in Date
Check-out Date
Total
{cart_booking_data_text}
{extra_demands_details_text}
{normal_products_data_txt}
{discounts}
Total Rooms Cost
{total_products}
Total Extra Services Cost
{total_extra_demands_te}
Total Rooms Tax
{total_tax_paid}
Extra Services Tax
{extra_demands_tax}
Discounts
{total_discounts}
Final Booking Amount
{total_paid}
{order_total_info_txt}
You can review your order and download your invoice from the
"Order history" [{history_url}] section of your

View File

@@ -72,7 +72,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">New bookings are created on <strong>{hotel_name}</strong>!</span>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">{order_header_line_html}</span>
</font>
</td>
</tr>
@@ -123,205 +123,26 @@
</td>
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Image</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Description</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Room Capcity</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Unit Price</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Rooms Qty</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-in Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-out Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Total</th>
</tr>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
&nbsp;&nbsp;{cart_booking_data_html}
</td>
</tr>
<td style="padding:7px 0">
{cart_booking_data_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{extra_demands_details_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{normal_products_data_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{order_total_info_html}
</td>
</tr>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
{extra_demands_details_html}
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Rooms Cost</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{room_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Extra Services Cost</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{additional_service_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Convenience Fees</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_convenience_fee_te}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Tax</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_order_tax}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Discounts</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_discounts}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Final Booking Amount</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="4" face="Open-sans, sans-serif" color="#555454">
{total_paid}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</font>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>

View File

@@ -10,39 +10,15 @@ Email: {customer_email}
Order details
Order: {order_name} Placed on {date}
Payment: {payment}
Room Image
Room Description
Hotel
Room Capcity
Unit Price
Rooms Qty
Check-in Date
Check-out Date
Total
{cart_booking_data_text}
{extra_demands_details_text}
{normal_products_data_txt}
{discounts}
Total Rooms Cost
{total_products}
Total Extra Services Cost
{total_extra_demands_te}
Total Rooms Tax
{total_tax_paid}
Extra Services Tax
{extra_demands_tax}
Discounts
{total_discounts}
Final Booking Amount
{total_paid}
{order_total_info_txt}
{shop_name} powered by Webkul&trade;

View File

@@ -0,0 +1,7 @@
{foreach $list as $cart_rule}
{$cart_rule['voucher_name']}
{$cart_rule['voucher_reduction']}
{/foreach}

View File

@@ -1,126 +1,126 @@
{foreach $list as $product}
<tr>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['reference']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>{$product['name']}</strong>
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['unit_price']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['quantity']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['price']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
{foreach $product['customization'] as $customization}
<tr>
<td colspan="2" style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>{$product['name']}</strong><br>
{$customization['customization_text']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['unit_price']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$customization['customization_quantity']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$customization['quantity']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
{/foreach}
<tr>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['reference']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>{$product['name']}</strong>
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['unit_price']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['quantity']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['price']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
{foreach $product['customization'] as $customization}
<tr>
<td colspan="2" style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td>
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>{$product['name']}</strong><br>
{$customization['customization_text']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$product['unit_price']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$customization['customization_quantity']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$customization['quantity']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
{/foreach}
{/foreach}

View File

@@ -0,0 +1,26 @@
{foreach $list as $product}
{$product['reference']}
{$product['name']}
{$product['unit_price']}
{$product['quantity']}
{$product['price']}
{foreach $product['customization'] as $customization}
{$product['name']}
{$customization['customization_text']}
{$product['unit_price']}
{$customization['customization_quantity']}
{$customization['quantity']}
{/foreach}
{/foreach}

View File

@@ -0,0 +1,82 @@
<table class="table table-recap order-total-info-table">
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
<tr>
<td>
<strong>{l s="Total Rooms Cost"}</strong>
</td>
<td>
{$list['room_price_tax_excl']}
</td>
</tr>
{/if}
{if isset($list['has_standalone_products']) && $list['has_standalone_products']}
<tr>
<td>
<strong>{l s="Total Products Cost"}</strong>
</td>
<td>
{$list['service_products_price_tax_excl']}
</td>
</tr>
{/if}
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
<tr>
<td>
<strong>{l s="Total Extra Services Cost"}</strong>
</td>
<td>
{$list['additional_service_price_tax_excl']}
</td>
</tr>
{/if}
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
<tr>
<td>
<strong>{l s="Total Convenience Fees"}</strong>
</td>
<td>
{$list['total_convenience_fee_te']}
</td>
</tr>
{/if}
<tr>
<td>
<strong>{l s="Total Tax"}</strong>
</td>
<td>
{$list['total_order_tax']}
</td>
</tr>
<tr>
<td>
<strong>{l s="Discounts"}</strong>
</td>
<td>
{$list['total_discounts']}
</td>
</tr>
<tr>
<td>
<strong>{l s="Final Booking Amount"}</strong>
</td>
<td>
{$list['total_paid']}
</td>
</tr>
</table>
<style>
.order-total-info-table {
width: 100%;
border-collapse: collapse;
}
.order-total-info-table td {
border:1px solid #D6D4D4;
background-color: #fbfbfb;
font-family: Arial;
font-size: 13px;
padding: 7px 10px;
text-align:right;
color: #333;
}
</style>

View File

@@ -0,0 +1,21 @@
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
{l s="Total Rooms Cost"} {$list['room_price_tax_excl']}
{/if}
{if isset($list['has_standalone_products']) && $list['has_standalone_products']}
{l s="Total Products Cost"} {$list['service_products_price_tax_excl']}
{/if}
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
{l s="Total Extra Services Cost"} {$list['additional_service_price_tax_excl']}
{/if}
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
{l s="Total Convenience Fees"} {$list['total_convenience_fee_te']}
{/if}
{l s="Total Tax"} {$list['total_order_tax']}
{l s="Discounts"} {$list['total_discounts']}
{l s="Final Booking Amount"} {$list['total_paid']}

View File

@@ -0,0 +1,21 @@
{if isset($list['for_admin']) && $list['for_admin']}
{if isset($list['hotel_name']) && $list['hotel_name']}
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
{l s='New bookings are created on'} <strong>{$list['hotel_name']}</strong>!
{else}
{l s='New order is created on'} <strong>{$list['hotel_name']}</strong>!
{/if}
{else}
{l s='New order is created'}!
{/if}
{else}
{if isset($list['hotel_name']) && $list['hotel_name']}
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
{l s='Thank you for booking with'} <strong>{$list['hotel_name']}</strong>!
{else}
{l s='Thank you for order with'} <strong>{$list['hotel_name']}</strong>!
{/if}
{else}
{l s='Thank you for your order'}!
{/if}
{/if}

View File

@@ -0,0 +1,21 @@
{if isset($list['for_admin']) && $list['for_admin']}
{if isset($list['hotel_name']) && $list['hotel_name']}
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
{l s='New bookings are created on'} {$list['hotel_name']}!
{else}
{l s='New order is created on'} {$list['hotel_name']}!
{/if}
{else}
{l s='New order is created'}!
{/if}
{else}
{if isset($list['hotel_name']) && $list['hotel_name']}
{if isset($list['has_room_bookings']) && $list['has_room_bookings']}
{l s='Thank you for booking with'} {$list['hotel_name']}!
{else}
{l s='Thank you for order with'} {$list['hotel_name']}!
{/if}
{else}
{l s='Thank you for your order'}!
{/if}
{/if}

View File

@@ -0,0 +1,13 @@
{if isset($list['hotel_name']) && $list['hotel_name']}
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="margin:3px 0 0px;font-weight:500;font-size:18px;padding-bottom: 10px;">
{l s='Hotel details'}:
</p>
<p style="margin:3px 0 0px;">
<span style="color:#333"><strong>{l s='Hotel Name'}:</strong></span> {$list['hotel_name']}<br />
<span style="color:#333"><strong>{l s='Hotel Phone'}:</strong></span> {$list['hotel_phone']}<br />
<span style="color:#333"><strong>{l s='Hotel Email'}:</strong></span> {$list['hotel_email']}<br />
<span style="color:#333"><strong>{l s='Total Rooms'}:</strong></span> {$list['num_rooms']}<br />
</p>
</font>
{/if}

View File

@@ -0,0 +1,9 @@
{if isset($list['hotel_name']) && $list['hotel_name']}
{l s='Hotel details'}:
{l s='Hotel Name'}: {$list['hotel_name']}
{l s='Hotel Phone'}: {$list['hotel_phone']}
{l s='Hotel Email'}: {$list['hotel_email']}
{l s='Total Rooms'}: {$list['num_rooms']}
{/if}

View File

@@ -73,7 +73,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:capitalize;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">A request has been completed for the booking cancellation.</span>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">A request has been completed for the {refund_for_txt} cancellation.</span>
</font>
</td>
</tr>
@@ -105,20 +105,12 @@
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="margin:10px 0 7px;text-transform:uppercase;font-weight:500;font-size:16px;padding-bottom:0px">Booking details</p>
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Num</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Type</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Duration</th>
</tr>
{refundBookingHtml}
</tbody>
</table>
</font>
{refundBookingHtml}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{refundServiceProductsHtml}
</td>
</tr>
<tr>

View File

@@ -73,7 +73,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:capitalize;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">Your request for booking cancellation has been completed.</span>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">Your request for {refund_for_txt} cancellation has been completed.</span>
</font>
</td>
</tr>
@@ -104,20 +104,12 @@
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="margin:10px 0 7px;text-transform:uppercase;font-weight:500;font-size:16px;padding-bottom:0px">Booking details</p>
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Type</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Num. Rooms</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Duration</th>
</tr>
{refundBookingHtml}
</tbody>
</table>
</font>
{refundBookingHtml}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{refundServiceProductsHtml}
</td>
</tr>
<tr>

View File

@@ -73,7 +73,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:capitalize;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">A request has been denied for the booking cancellation.</span>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">A request has been denied for the {refund_for_txt} cancellation.</span>
</font>
</td>
</tr>
@@ -102,20 +102,12 @@
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="margin:10px 0 7px;text-transform:uppercase;font-weight:500;font-size:16px;padding-bottom:0px">Booking details</p>
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Num</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Type</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Duration</th>
</tr>
{refundBookingHtml}
</tbody>
</table>
</font>
{refundBookingHtml}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{refundServiceProductsHtml}
</td>
</tr>
<tr>

View File

@@ -73,7 +73,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:capitalize;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">Your request for booking cancellation has been denied.</span>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">Your request for {refund_for_txt} cancellation has been denied.</span>
</font>
</td>
</tr>
@@ -101,20 +101,12 @@
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="margin:10px 0 7px;text-transform:uppercase;font-weight:500;font-size:16px;padding-bottom:0px">Booking details</p>
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Type</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Num. Rooms</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Duration</th>
</tr>
{refundBookingHtml}
</tbody>
</table>
</font>
{refundBookingHtml}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{refundServiceProductsHtml}
</td>
</tr>
<tr>

View File

@@ -73,7 +73,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:capitalize;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">A request has been generated for booking cancellations.</span>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">A request has been generated for {refund_for_txt} cancellations.</span>
</font>
</td>
</tr>
@@ -103,20 +103,12 @@
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="margin:10px 0 7px;text-transform:uppercase;font-weight:500;font-size:16px;padding-bottom:0px">Requested Booking Cancellations</p>
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Num</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Type</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Duration</th>
</tr>
{refundBookingHtml}
</tbody>
</table>
</font>
{refundBookingHtml}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{refundServiceProductsHtml}
</td>
</tr>
<tr>

View File

@@ -73,7 +73,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:capitalize;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">Your request for booking cancellation has been submitted successfully.</span>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">Your request for {refund_for_txt} cancellation has been submitted successfully.</span>
</font>
</td>
</tr>
@@ -101,20 +101,12 @@
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="margin:10px 0 7px;text-transform:uppercase;font-weight:500;font-size:16px;padding-bottom:0px">Booking details</p>
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Type</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Num. Rooms</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Duration</th>
</tr>
{refundBookingHtml}
</tbody>
</table>
</font>
{refundBookingHtml}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{refundServiceProductsHtml}
</td>
</tr>
<tr>

View File

@@ -104,210 +104,22 @@
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Image</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Description</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Room Capcity</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Unit Price</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Rooms Qty</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-in Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-out Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Total</th>
</tr>
<tbody>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
&nbsp;&nbsp;{cart_booking_data_html}
</td>
</tr>
</tbody>
</table>
</font>
{cart_booking_data_html}
</td>
</tr>
<tr>
<td style="text-align:center;color:#777;padding:7px 0">
<td style="padding:7px 0">
{extra_demands_details_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Rooms Cost</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{room_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Extra Services Cost </strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{additional_service_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Convenience Fees</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_convenience_fee_te}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Tax</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_order_tax}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Discounts</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_discounts}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Final Booking Amount</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="4" face="Open-sans, sans-serif" color="#555454">
{total_paid}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</font>
{normal_products_data_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{order_total_info_html}
</td>
</tr>
<tr>

View File

@@ -9,37 +9,15 @@ Order: {order_name} Placed on {date}
Payment: {payment}
Status: {order_status}
Room Image
Room Description
Hotel
Room Capcity
Unit Price
Rooms Qty
Check-in Date
Check-out Date
Total
{cart_booking_data_text}
{extra_demands_details_text}
Total Rooms Cost
{total_products}
{normal_products_data_txt}
Total Extra Services Cost
{total_extra_demands_te}
{discounts}
Discounts
{total_discounts}
Total Rooms Tax
{total_tax_paid}
Extra Services Tax
{extra_demands_tax}
Final Booking Amount
{total_paid}
{order_total_info_txt}
You can review your order and download your invoice from the
"Order history" [{history_url}] section of your

View File

@@ -126,205 +126,26 @@
</td>
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Image</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Description</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Room Capcity</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Unit Price</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Rooms Qty</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-in Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-out Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Total</th>
</tr>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
&nbsp;&nbsp;{cart_booking_data_html}
</td>
</tr>
<td style="padding:7px 0">
{cart_booking_data_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{extra_demands_details_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{normal_products_data_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
{order_total_info_html}
</td>
</tr>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
{extra_demands_details_html}
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Rooms Cost</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{room_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Extra Services Cost</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{additional_service_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Convenience Fees</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_convenience_fee_te}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Tax</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_order_tax}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Discounts</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_discounts}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Final Booking Amount</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="4" face="Open-sans, sans-serif" color="#555454">
{total_paid}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</font>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>

View File

@@ -14,38 +14,14 @@ Order: {order_name} Placed on {date}
Payment: {payment}
Status: {order_status}
Room Image
Room Description
Hotel
Room Capcity
Unit Price
Rooms Qty
Check-in Date
Check-out Date
Total
{cart_booking_data_text}
{extra_demands_details_text}
{normal_products_data_txt}
{discounts}
Total Rooms Cost
{total_products}
Total Extra Services Cost
{total_extra_demands_te}
Discounts
{total_discounts}
Total Rooms Tax
{total_tax_paid}
Extra Services Tax
{extra_demands_tax}
Final Booking Amount
{total_paid}
{order_total_info_txt}
{shop_name} powered by Webkul&trade;

View File

@@ -71,7 +71,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">Thank you for booking with <strong>{hotel_hotel_name}</strong>!</span>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">{order_header_line_html}</span>
</font>
</td>
</tr>

View File

@@ -71,7 +71,7 @@
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {firstname} {lastname},</span><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">Thank you for booking with <strong>{hotel_hotel_name}</strong>!</span>
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">{order_header_line_html}</span>
</font>
</td>
</tr>

View File

@@ -1,63 +0,0 @@
{if isset($list)}
{foreach from=$list key=data_k item=data_v}
<tr>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['room_num']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['room_type_name']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['hotel_name']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['date_from']|date_format:"%d-%b-%G"} To {$data_v['date_to']|date_format:"%d-%b-%G"}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
{/foreach}
{/if}
<style>
.pull-right {
float: right;
}
</style>

View File

@@ -1,63 +0,0 @@
{if isset($list)}
{foreach from=$list key=data_k item=data_v}
<tr>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['room_type_name']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['hotel_name']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['num_rooms']}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td style="border:1px solid #D6D4D4;">
<table class="table">
<tr>
<td width="10">&nbsp;</td>
<td align="right" class="text-center">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{$data_v['date_from']|date_format:"%d-%b-%G"} To {$data_v['date_to']|date_format:"%d-%b-%G"}
</font>
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
{/foreach}
{/if}
<style>
.pull-right {
float: right;
}
</style>

View File

@@ -0,0 +1,66 @@
{if isset($list) && $list}
<table class="table table-recap service-product-table"><!-- Title -->
<tr>
<th colspan="5" class="table-caption">{l s='Service Products Detail'}</th>
</tr>
<tr>
<th>{l s='Image'}</th>
<th>{l s='Name'}</th>
<th>{l s='Unit Price'}</th>
<th>{l s='Qty'}</th>
<th>{l s='Total'}</th>
</tr>
<tbody>
{foreach from=$list key=key item=product}
<tr>
<td>
<img src="{$product['cover_img']}" class="img-responsive" />
</td>
<td>
{$product['name']}{if isset($product['option_name']) && $product['option_name']} : {$product['option_name']}{/if}
</td>
<td>
{convertPrice price=$product['unit_price_tax_excl']}
</td>
<td>
{$product['quantity']}
</td>
<td>
{convertPrice price=$product['total_price_tax_excl']}
</td>
</tr>
{/foreach}
</tbody>
</table>
<style>
<style>
.pull-right {
float: right;
}
.service-product-table {
width:100%;
border-collapse:collapse;
padding:5px;
}
.service-product-table th {
border:1px solid #D6D4D4;
background-color: #fbfbfb;
color: #333;
font-family: Arial;
font-size: 13px;
padding: 7px 7px 5px 10px;
text-align:left;
}
.service-product-table th.table-caption {
text-align: left;
padding:10px;
}
.service-product-table td {
border:1px solid #D6D4D4;
padding: 5px 5px 5px 10px;
text-align:left;
}
</style>
</style>
{/if}

View File

@@ -0,0 +1,26 @@
{if isset($list) && $list}
{l s='Image'}
{l s='Name'}
{l s='Unit Price'}
{l s='Qty'}
{l s='Total'}
{foreach from=$list key=key item=product}
<img src="{$product['cover_img']}" class="img-responsive" />
{$product['name']}{if isset($product['option_name']) && $product['option_name']} : {$product['option_name']}{/if}
{convertPrice price=$product['unit_price_tax_excl']}
{$product['quantity']}
{convertPrice price=$product['total_price_tax_excl']}
{/foreach}
{/if}

View File

@@ -0,0 +1,60 @@
{if isset($list['service_products']) && $list['service_products']}
<table class="table table-recap service-products-table">
<thead>
<tr>
<th colspan="9" class="table-caption">{l s='Service Products Detail'}</th>
</tr>
<tr>
<th>{l s="Product name"}</th>
{if isset($list['is_hotel_products']) && $list['is_hotel_products']}
<th>{l s="Hotel"}</th>
{/if}
<th>{l s="Quantity"}</th>
</tr>
</thead>
{foreach $list['service_products'] as $product}
<tr>
<td>
{$product['name']}{if isset($product['option_name']) && $product['option_name']} : {$product['option_name']}{/if}
</td>
{if isset($list['is_hotel_products']) && $list['is_hotel_products']}
<td>
{$product['hotel_name']}
</td>
{/if}
<td>
{$product['quantity']}
</td>
</tr>
{/foreach}
</table>
<style>
.service-products-table {
width:100%;
border-collapse:collapse;
padding:5px;
}
.service-products-table th {
border:1px solid #D6D4D4;
background-color: #fbfbfb;
color: #333;
font-family: Arial;
font-size: 13px;
padding: 7px 7px 5px 10px;
text-align:left;
}
.service-products-table th.table-caption {
text-align: left;
padding:10px;
}
.service-products-table td {
border:1px solid #D6D4D4;
padding:5px;
text-align:left;
padding: 5px 5px 5px 10px;
}
.pull-right {
float: right;
}
</style>
{/if}

View File

@@ -0,0 +1,24 @@
{if isset($list['service_products']) && $list['service_products']}
{l s='Service Products Detail'}
{l s="Product name"}
{if isset($list['is_hotel_products']) && $list['is_hotel_products']}
{l s="Hotel"}
{/if}
{l s="Quantity"}
{foreach $list['service_products'] as $product}
{$product['name']}{if isset($product['option_name']) && $product['option_name']} : {$product['option_name']}{/if}
{if isset($list['is_hotel_products']) && $list['is_hotel_products']}
{$product['hotel_name']}
{/if}
{$product['quantity']}
{/foreach}
{/if}

View File

@@ -51,7 +51,7 @@ class BankwirePaymentModuleFrontController extends ModuleFrontController
}
// check all service products are available
RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
ServiceProductCartDetail::validateServiceProductsInCart();
$restrict_order = false;
/*Check Order restrict condition before Payment by the customer*/

View File

@@ -50,7 +50,7 @@ class BankwireValidationModuleFrontController extends ModuleFrontController
die($this->module->l('This payment method is not available.', 'validation'));
// check all service products are available
RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
ServiceProductCartDetail::validateServiceProductsInCart();
// Check Order restrict condition before Payment by the customer
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {

View File

@@ -64,8 +64,10 @@ $(document).ready(function() {
$("#header .shopping_cart a:first").hover(
function() {
if (ajaxCart.nb_total_products > 0 || parseInt($('.ajax_cart_quantity').html()) > 0)
$("#header .cart_block").stop(true, true).slideDown(450);
if (!is_touch_enabled) {
if (ajaxCart.nb_total_products > 0 || parseInt($('.ajax_cart_quantity').html()) > 0)
$("#header .cart_block").stop(true, true).slideDown(450);
}
},
function() {
setTimeout(function() {
@@ -125,17 +127,16 @@ var ajaxCart = {
dateFormat: 'DD-MM-YYYY',
dateFormatFull: 'DD-MM-YYYY HH:mm:ss',
nb_total_products: 0,
//override every button in the page in relation to the cart
overrideButtonsInThePage: function() {
_overrideButtonsInThePage: function () {
//for every 'add' buttons...
$(document).off('click', '.ajax_add_to_cart_button').on('click', '.ajax_add_to_cart_button', function(e) {
$(document).off('click', '.ajax_add_to_cart_button').on('click', '.ajax_add_to_cart_button', function (e) {
e.preventDefault();
var idProduct = parseInt($(this).data('id-product'));
var idProductAttribute = parseInt($(this).data('id-product-attribute'));
var dateFrom = $(this).attr('cat_rm_check_in');
var dateTo = $(this).attr('cat_rm_check_out');
var occupancy = getBookingOccupancyDetails($(this).closest('.booking_room_fields'));
var occupancy = getBookingOccupancyDetails($(this).closest('.booking_room_fields'), true);
/* By Webkul
* Note : In our case minimalQuantity is taken from Qty. field
*/
@@ -145,25 +146,30 @@ var ajaxCart = {
// if (!minimalQuantity)
// minimalQuantity = 1;
if ($(this).prop('disabled') != 'disabled' && occupancy)
ajaxCart.add(idProduct, idProductAttribute, false, this, occupancy, null, dateFrom, dateTo);
ajaxCart.add(idProduct, false, idProductAttribute, false, this, occupancy, null, dateFrom, dateTo, 1);
});
//for product page 'add' button...
if ($('.cart_block').length) {
$(document).off('click', '#add_to_cart button').on('click', '#add_to_cart button', function(e) {
$(document).off('click', '#add_to_cart button').on('click', '#add_to_cart button', function (e) {
e.preventDefault();
var booking_product = $('#product_page_booking_product').val()
var date_from = $('#room_check_in').val();
var date_to = $('#room_check_out').val();
var occupancy = getBookingOccupancyDetails($(this).closest('.booking_room_fields'));
var id_hotel = $('#service_id_hotel').length ? $('#service_id_hotel').val() : 0;
var occupancy = getBookingOccupancyDetails($(this).closest('.booking_room_fields'), parseInt(booking_product));
if (occupancy) {
ajaxCart.add($('#product_page_product_id').val(), $('#idCombination').val(), true, null, occupancy, null, date_from, date_to);
ajaxCart.add($('#product_page_product_id').val(), id_hotel, $('[name="id_product_option"]:checked').val(), true, null, occupancy, null, date_from, date_to, booking_product);
}
});
}
/*
* By webkul to delete a single room from cart datewise
*/
$(document).on('click', '.rooms_remove_container .remove_rooms_from_cart_link', function(e) {
$(document).on('click', '.rooms_remove_container .remove_rooms_from_cart_link', function (e) {
e.preventDefault();
var id_product = $(this).attr('id_product');
// this condition is added by webkul to delete a single room form current cart.
@@ -179,8 +185,16 @@ var ajaxCart = {
}
});
$(document).on('click', '.ajax_remove_product_option', function (e) {
e.preventDefault();
var id_product = $(this).attr('id_product');
var id_hotel = $(this).attr('id_hotel');
var id_product_option = $(this).attr('id_product_option');
ajaxCart.remove(id_product, id_hotel, id_product_option);
});
//for 'delete' buttons in the cart block...
$(document).off('click', '.cart_block_list .ajax_cart_block_remove_link').on('click', '.cart_block_list .ajax_cart_block_remove_link', function(e) {
$(document).off('click', '.cart_block_list .ajax_cart_block_remove_link').on('click', '.cart_block_list .ajax_cart_block_remove_link', function (e) {
e.preventDefault();
// Customized product management
var customizationId = 0;
@@ -188,15 +202,16 @@ var ajaxCart = {
var productAttributeId = 0;
var customizableProductDiv = $($(this).parent().parent()).find("div[data-id^=deleteCustomizableProduct_]");
var idAddressDelivery = false;
var idHotel = 0;
if (customizableProductDiv && $(customizableProductDiv).length) {
var ids = customizableProductDiv.data('id').split('_');
if (typeof(ids[1]) != 'undefined') {
if (typeof (ids[1]) != 'undefined') {
customizationId = parseInt(ids[1]);
productId = parseInt(ids[2]);
if (typeof(ids[3]) != 'undefined')
if (typeof (ids[3]) != 'undefined')
productAttributeId = parseInt(ids[3]);
if (typeof(ids[4]) != 'undefined')
if (typeof (ids[4]) != 'undefined')
idAddressDelivery = parseInt(ids[4]);
}
}
@@ -204,15 +219,17 @@ var ajaxCart = {
// Common product management
if (!customizationId) {
//retrieve idProduct and idCombination from the displayed product in the block cart
var firstCut = $(this).parent().parent().data('id').replace('cart_block_product_', '');
var firstCut = $(this).closest('dt').data('id').replace('cart_block_product_', '');
firstCut = firstCut.replace('deleteCustomizableProduct_', '');
ids = firstCut.split('_');
productId = parseInt(ids[0]);
if (typeof(ids[1]) != 'undefined')
if (typeof (ids[1]) != 'undefined')
productAttributeId = parseInt(ids[1]);
if (typeof(ids[2]) != 'undefined')
if (typeof (ids[2]) != 'undefined')
idAddressDelivery = parseInt(ids[2]);
if (typeof (ids[3]) != 'undefined')
idHotel = parseInt(ids[3]);
}
/*by webkul*/
@@ -229,9 +246,15 @@ var ajaxCart = {
}
// Removing product from the cart
ajaxCart.remove(productId, productAttributeId, customizationId, idAddressDelivery, dateFrom, dateTo);
ajaxCart.remove(productId, idHotel, productAttributeId, customizationId, idAddressDelivery, dateFrom, dateTo);
});
},
get overrideButtonsInThePage() {
return this._overrideButtonsInThePage;
},
set overrideButtonsInThePage(value) {
this._overrideButtonsInThePage = value;
},
// try to expand the cart
expand: function() {
@@ -322,7 +345,7 @@ var ajaxCart = {
// close fancybox
updateFancyBox: function() {},
// add a product in the cart via ajax
add: function(idProduct, idCombination, addedFromProductPage, callerElement, occupancy, whishlist, dateFrom, dateTo) {
add: function(idProduct, idHotel, idCombination, addedFromProductPage, callerElement, occupancy, whishlist, dateFrom, dateTo, booking_product) {
if (addedFromProductPage && !checkCustomizations()) {
if (contentOnly) {
var productUrl = window.document.location.href + '';
@@ -364,25 +387,30 @@ var ajaxCart = {
req.append('token', static_token);
req.append('id_customization', ((typeof customizationId !== 'undefined') ? customizationId : 0));
if (parseInt(idCombination) && idCombination != null){
req.append('ipa', parseInt(idCombination));
req.append('id_product_option', parseInt(idCombination));
}
req.append('id_hotel', idHotel);
// get the selected extra demands by customer
if (typeof dateFrom != 'undefined')
req.append('dateFrom', dateFrom);
if (typeof dateTo != 'undefined')
req.append('dateTo', dateTo);
if (parseInt(booking_product)) {
// get the selected extra demands by customer
if (typeof dateFrom != 'undefined')
req.append('dateFrom', dateFrom);
if (typeof dateTo != 'undefined')
req.append('dateTo', dateTo);
if (occupancy_required_for_booking) {
req.append('occupancy', JSON.stringify(occupancy));
if (occupancy_required_for_booking) {
req.append('occupancy', JSON.stringify(occupancy));
} else {
req.append('qty', ((occupancy && occupancy != null) ? occupancy : '1'));
}
var roomDemands = getRoomsExtraDemands();
req.append('roomDemands', JSON.stringify(roomDemands) );
req.append('serviceProducts', JSON.stringify(getRoomsServiceProducts()) );
} else {
req.append('qty', ((occupancy && occupancy != null) ? occupancy : '1'));
}
var roomDemands = getRoomsExtraDemands();
req.append('roomDemands', JSON.stringify(roomDemands) );
req.append('serviceProducts', JSON.stringify(getRoomsServiceProducts()) );
//send the ajax request to the server
$.ajax({
type: 'POST',
@@ -397,14 +425,13 @@ var ajaxCart = {
contentType: false,
processData: false,
success: function(jsonData, textStatus, jqXHR) {
/*by webkul checking and setting availability of rooms*/
/*for product page add to cart quantity management*/
if (pagename == 'product') {
resetRoomtypeServices();
if (jsonData.avail_rooms == 0) {
disableRoomTypeDemands(1);
}
resetRoomtypeServices();
BookingForm.refresh(true);
}
@@ -446,23 +473,6 @@ var ajaxCart = {
if (jsonData.crossSelling)
$('.crossseling').html(jsonData.crossSelling);
// if (idCombination)
// $(jsonData.products).each(function() {
// if (this.id != undefined && this.id == parseInt(idProduct) && this.idCombination == parseInt(idCombination))
// if (contentOnly)
// window.parent.ajaxCart.updateLayer(this);
// else
// ajaxCart.updateLayer(this);
// });
// else
// $(jsonData.products).each(function() {
// if (this.id != undefined && this.id == parseInt(idProduct))
// if (contentOnly)
// window.parent.ajaxCart.updateLayer(this);
// else {
// ajaxCart.updateLayer(this);
// }
// });
if (jsonData.last_added_product) {
ajaxCart.updateLayer(jsonData.last_added_product);
@@ -576,52 +586,6 @@ var ajaxCart = {
}
ajaxCart.updateCart(jsonData);
// // add appliance to whishlist module
// if (whishlist && !jsonData.errors)
// WishlistAddProductCart(whishlist[0], idProduct, idCombination, whishlist[1]);
// if (!jsonData.hasError) {
// if (contentOnly)
// window.parent.ajaxCart.updateCartInformation(jsonData, addedFromProductPage);
// else
// ajaxCart.updateCartInformation(jsonData, addedFromProductPage);
// if (jsonData.crossSelling)
// $('.crossseling').html(jsonData.crossSelling);
// if (idCombination)
// $(jsonData.products).each(function() {
// if (this.id != undefined && this.id == parseInt(idProduct) && this.idCombination == parseInt(idCombination))
// if (contentOnly)
// window.parent.ajaxCart.updateLayer(this);
// else
// ajaxCart.updateLayer(this);
// });
// else
// $(jsonData.products).each(function() {
// if (this.id != undefined && this.id == parseInt(idProduct))
// if (contentOnly)
// window.parent.ajaxCart.updateLayer(this);
// else
// ajaxCart.updateLayer(this);
// });
// if (contentOnly)
// parent.$.fancybox.close();
// } else {
// if (contentOnly)
// window.parent.ajaxCart.updateCart(jsonData);
// else
// ajaxCart.updateCart(jsonData);
// if (addedFromProductPage)
// $('#add_to_cart button').removeProp('disabled').removeClass('disabled');
// else
// $(callerElement).removeProp('disabled');
// }
// emptyCustomizations();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
if (!onlineFlag) {
@@ -650,7 +614,7 @@ var ajaxCart = {
},
//remove a product from the cart via ajax
remove: function(idProduct, idCombination, customizationId, idAddressDelivery, dateFrom, dateTo) {
remove: function(idProduct, idHotel, idCombination, customizationId, idAddressDelivery, dateFrom, dateTo) {
//send the ajax request to the server
$.ajax({
type: 'POST',
@@ -661,7 +625,7 @@ var ajaxCart = {
async: true,
cache: false,
dataType: "json",
data: 'controller=cart&delete=1&dateFrom=' + dateFrom + '&dateTo=' + dateTo + '&id_product=' + idProduct + '&ipa=' + ((idCombination != null && parseInt(idCombination)) ? idCombination : '') + ((customizationId && customizationId != null) ? '&id_customization=' + customizationId : '') + '&id_address_delivery=' + idAddressDelivery + '&token=' + static_token + '&ajax=true',
data: 'controller=cart&delete=1&dateFrom=' + dateFrom + '&dateTo=' + dateTo + '&id_product=' + idProduct + '&id_hotel=' + idHotel + '&id_product_option=' + ((idCombination != null && parseInt(idCombination)) ? idCombination : '') + ((customizationId && customizationId != null) ? '&id_customization=' + customizationId : '') + '&id_address_delivery=' + idAddressDelivery + '&token=' + static_token + '&ajax=true',
success: function(jsonData) {
if (pagename == 'product') {
disableRoomTypeDemands(0);
@@ -689,7 +653,7 @@ var ajaxCart = {
}
}
if (pagename == 'orderopc') {
location.reload();
updateOpcData();
}
ajaxCart.updateCart(jsonData);
@@ -729,8 +693,8 @@ var ajaxCart = {
//look for a product to delete...
$('.cart_block_list:first dl.products dt').each(function() {
//retrieve idProduct and idCombination from the displayed product in the block cart
var domIdProduct = $(this).data('id');
var firstCut = domIdProduct.replace('cart_block_product_', '');
var productDomId = $(this).data('id');
var firstCut = productDomId.replace('cart_block_product_', '');
var ids = firstCut.split('_');
//try to know if the current product is still in the new list
@@ -738,10 +702,21 @@ var ajaxCart = {
for (aProduct in jsonData.products) {
//we've called the variable aProduct because IE6 bug if this variable is called product
//if product has attributes
if (jsonData.products[aProduct]['id'] == ids[0] && (!ids[1] || jsonData.products[aProduct]['idCombination'] == ids[1])) {
stayInTheCart = true;
// update the product customization display (when the product is still in the cart)
ajaxCart.hideOldProductCustomizations(jsonData.products[aProduct], domIdProduct);
if ((parseInt(jsonData.products[aProduct]['selling_preference_type']) == SELLING_PREFERENCE_HOTEL_STANDALONE
|| parseInt(jsonData.products[aProduct]['selling_preference_type']) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE)
&& (typeof jsonData.products[aProduct]['hotel_wise_data'] != 'undefined' && jsonData.products[aProduct]['hotel_wise_data'].length)
) {
$.each(jsonData.products[aProduct]['hotel_wise_data'], function() {
if (!ids[3] || (ids[3] == this.id_hotel)) {
stayInTheCart = true;
}
});
} else {
if (jsonData.products[aProduct]['id'] == ids[0] && (!ids[1] || jsonData.products[aProduct]['idCombination'] == ids[1])) {
stayInTheCart = true;
// update the product customization display (when the product is still in the cart)
ajaxCart.hideOldProductCustomizations(jsonData.products[aProduct], productDomId);
}
}
}
//remove product if it's no more in the cart
@@ -774,7 +749,7 @@ var ajaxCart = {
}
},
hideOldProductCustomizations: function(product, domIdProduct) {
hideOldProductCustomizations: function(product, productDomId) {
var customizationList = $('ul[data-id="customization_' + product['id'] + '_' + product['idCombination'] + '"]');
if (customizationList.length > 0) {
$(customizationList).find("li").each(function() {
@@ -791,11 +766,11 @@ var ajaxCart = {
});
}
var removeLinks = $('.deleteCustomizableProduct[data-id="' + domIdProduct + '"]').find('.ajax_cart_block_remove_link');
var removeLinks = $('.deleteCustomizableProduct[data-id="' + productDomId + '"]').find('.ajax_cart_block_remove_link');
if (!product.hasCustomizedDatas && !removeLinks.length)
$('div[data-id="' + domIdProduct + '"]' + ' span.remove_link').html('<a class="ajax_cart_block_remove_link" rel="nofollow" href="' + baseUri + '?controller=cart&amp;delete=1&amp;id_product=' + product['id'] + '&amp;ipa=' + product['idCombination'] + '&amp;token=' + static_token + '"> </a>');
$('div[data-id="' + productDomId + '"]' + ' span.remove_link').html('<a class="ajax_cart_block_remove_link" rel="nofollow" href="' + baseUri + '?controller=cart&amp;delete=1&amp;id_product=' + product['id'] + '&amp;ipa=' + product['idCombination'] + '&amp;token=' + static_token + '"> </a>');
if (product.is_gift)
$('div[data-id="' + domIdProduct + '"]' + ' span.remove_link').html('');
$('div[data-id="' + productDomId + '"]' + ' span.remove_link').html('');
},
doesCustomizationStillExist: function(product, customizationId) {
@@ -834,8 +809,9 @@ var ajaxCart = {
},
// Update product quantity
updateProductQuantity: function(product, quantity) {
$('dt[data-id=cart_block_product_' + product.id + '_' + (product.idCombination ? product.idCombination : '0') + '_' + (product.idAddressDelivery ? product.idAddressDelivery : '0') + '] .quantity').fadeTo('fast', 0, function() {
updateProductQuantity: function(product, quantity , hotel_wise_data = null) {
var productDomId = product.id + '_' + (product.idCombination ? product.idCombination : '0') + '_' + (product.idAddressDelivery ? product.idAddressDelivery : '0') + '_' + ((hotel_wise_data && typeof(hotel_wise_data.id_hotel) != 'undefined') ? hotel_wise_data.id_hotel : '0');
$('dt[data-id="cart_block_product_' + productDomId + '"] .quantity').fadeTo('fast', 0, function() {
$(this).text(quantity);
$(this).fadeTo('fast', 1, function() {
$(this).fadeTo('fast', 0, function() {
@@ -856,7 +832,7 @@ var ajaxCart = {
$(jsonData.products).each(function(key, value) {
//fix ie6 bug (one more item 'undefined' in IE6)
if (this.id != undefined) {
if (!this.booking_product && this.service_product_type != 2) {
if (!this.booking_product && parseInt(this.selling_preference_type) == SELLING_PREFERENCE_WITH_ROOM_TYPE) {
return;
}
//create a container for listing the products and hide the 'no product in the cart' message (only if the cart was empty)
@@ -864,171 +840,278 @@ var ajaxCart = {
$('.cart_block_no_products').before('<dl class="products"></dl>');
$('.cart_block_no_products').hide();
}
//if product is not in the displayed cart, add a new product's line
var domIdProduct = this.id + '_' + (this.idCombination ? this.idCombination : '0') + '_' + (this.idAddressDelivery ? this.idAddressDelivery : '0');
var domIdProductAttribute = this.id + '_' + (this.idCombination ? this.idCombination : '0');
var productId = parseInt(this.id);
if ($('dt[data-id="cart_block_product_' + domIdProduct + '"]').length == 0) {
var productAttributeId = (this.hasAttributes ? parseInt(this.attributes) : 0);
var content = '<dt class="unvisible" data-id="cart_block_product_' + domIdProduct + '">';
var name = $.trim($('<span />').html(this.name).text());
name = (name.length > 30 ? name.substring(0, 27) + '...' : name);
content += '<a class="cart-images" href="' + this.link + '" title="' + name + '"><img src="' + this.image_cart + '" alt="' + this.name + '"></a>';
content += '<div class="cart-info">';
content += '<div class="product-name">';
content += '<a href="' + this.link + '" title="' + this.name + '" class="cart_block_product_name">' + name + '</a>';
content += '</div>';
if (this.hasAttributes)
content += '<div class="product-atributes"><a href="' + this.link + '" title="' + this.name + '">' + this.attributes + '</a></div>';
if (typeof(freeProductTranslation) != 'undefined') {
content += '<div class="cart-info-sec rm_product_info_' + productId + '">';
content += '<span class="product_info_label">Price:</span>';
content += '<span class="price product_info_data" ttl_prod_price="' + this.bookingData.total_room_type_amount + '">&nbsp;';
content += formatCurrency(parseFloat(this.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank);
content += '</span>';
content += '</div>';
if (parseInt(this.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE
|| parseInt(this.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE
) {
if (typeof value.hotel_wise_data != 'undefined' && value.hotel_wise_data.length) {
$(value.hotel_wise_data).each(function(i, val) {
ajaxCart.addProductRow(value, val);
});
}
content += '<div class="cart-info-sec rm_product_info_' + productId + '">';
content += '<span class="product_info_label">' + total_qty_txt + ':</span>';
content += '<span class="quantity-formated">';
content += '<span class="quantity product_info_data">';
if (this.booking_product)
content += this.bookingData.total_num_rooms;
else
content += this.cart_quantity;
content += '</span>';
content += '</span>';
content += '</div>';
content += '</div>';
if (typeof(this.is_gift) == 'undefined' || this.is_gift == 0)
content += '<span class="remove_link"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseUri + '?controller=cart&amp;delete=1&amp;id_product=' + productId + '&amp;token=' + static_token + (this.hasAttributes ? '&amp;ipa=' + parseInt(this.idCombination) : '') + '"> </a></span>';
else
content += '<span class="remove_link"></span>';
content += '<div style="clear:both;"></div>';
// data for rooms only
if (this.booking_product) {
content += '<div id="booking_dates_container_' + productId + '" class="cart_prod_cont">';
content += '<div class="table-responsive">';
content += '<table class="table">';
content += '<tbody>';
content += '<tr>';
content += '<th>' + duration_txt + '</th>';
content += '<th>' + qty_txt + '.</th>';
content += '<th>' + price_txt + '</th>';
content += '<th>&nbsp;</th>';
content += '</tr>';
if (this.bookingData.date_diff !== 'undefined') {
$.each(this.bookingData.date_diff, function(date_diff_k, date_diff_v) {
from = $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v.data_form));
to = $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v.data_to));
let dateFormatToUse = from == to ? ajaxCart.dateFormatFull : ajaxCart.dateFormat;
content += '<tr class="rooms_remove_container">';
content += '<td>' + moment(new Date(date_diff_v.data_form)).format(dateFormatToUse) + '&nbsp;-&nbsp;' + moment(new Date(date_diff_v.data_to)).format(dateFormatToUse) + '</td>';
content += '<td class="num_rooms_in_date">' + date_diff_v.num_rm + '</td>';
content += '<td>' + formatCurrency(parseFloat(date_diff_v.amount) + parseFloat(date_diff_v.demand_price), currency_format, currency_sign, currency_blank) + '</td>';
content += '<td>';
content += '<a class="remove_rooms_from_cart_link" href="#" rm_price=' + date_diff_v.amount + ' id_product=' + productId + ' date_from=' + date_diff_v.data_form + ' date_to=' + date_diff_v.data_to + ' num_rooms=' + date_diff_v.num_rm + ' title="' + remove_rm_title + '"></a>';
content += '</td>';
content += '</tr>';
});
}
content += '</tbody>';
content += '</table>';
content += '</div>';
content += '</div>';
}
content += '</dt>';
if (this.hasAttributes)
content += '<dd data-id="cart_block_combination_of_' + domIdProduct + '" class="unvisible">';
if (this.hasCustomizedDatas)
content += ajaxCart.displayNewCustomizedDatas(this);
if (this.hasAttributes) content += '</dd>';
$('.cart_block dl.products').append(content);
} else {
ajaxCart.addProductRow(value);
}
//else update the product's line
else {
//by webkul to update rooms information on new room add to cart
if (this.booking_product) {
var booking_dates_content = '';
// $("#booking_dates_container_"+this.id).empty();
$("#booking_dates_container_" + this.id).find("table.table tbody tr.rooms_remove_container").remove();
var product_price_float = this.price_float;
if (this.bookingData.date_diff !== 'undefined') {
$.each(this.bookingData.date_diff, function(date_diff_k1, date_diff_v1) {
from = $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v1.data_form));
to = $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v1.data_to));
let dateFormatToUse = from == to ? ajaxCart.dateFormatFull : ajaxCart.dateFormat;
booking_dates_content += '<tr class="rooms_remove_container">';
booking_dates_content += '<td>' + moment(new Date(date_diff_v1.data_form)).format(dateFormatToUse) + '&nbsp;-&nbsp;' + moment(new Date(date_diff_v1.data_to)).format(dateFormatToUse) + '</td>';
booking_dates_content += '<td class="num_rooms_in_date">' + date_diff_v1.num_rm + '</td>';
booking_dates_content += '<td>' + formatCurrency(parseFloat(date_diff_v1.amount) + parseFloat(date_diff_v1.demand_price), currency_format, currency_sign, currency_blank) + '</td>';
booking_dates_content += '<td>';
booking_dates_content += '<a class="remove_rooms_from_cart_link" href="#" rm_price=' + date_diff_v1.amount + ' id_product=' + productId + ' date_from=' + date_diff_v1.data_form + ' date_to=' + date_diff_v1.data_to + ' num_rooms=' + date_diff_v1.num_rm + ' title="' + remove_rm_title + '"></a>';
booking_dates_content += '</td>';
booking_dates_content += '</tr>';
});
}
$("#booking_dates_container_" + this.id).find("table.table tbody").append(booking_dates_content);
}
//end
var jsonProduct = this;
if ($.trim($('dt[data-id="cart_block_product_' + domIdProduct + '"] .quantity').html()) != jsonProduct.quantity || $.trim($('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').html()) != jsonProduct.priceByLine) {
// Usual product
if (!this.is_gift) {
$('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').text(formatCurrency(parseFloat(this.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank));
$('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').attr('ttl_prod_price', this.bookingData.total_room_type_amount);
} else
$('dt[data-id="cart_block_product_' + domIdProduct + '"] .price').html(freeProductTranslation);
//cart_booking_data[key].total_num_rooms argument sent to update num of rooms instead of quantity
if (this.booking_product) {
ajaxCart.updateProductQuantity(jsonProduct, this.bookingData.total_num_rooms);
} else {
ajaxCart.updateProductQuantity(jsonProduct, jsonProduct.quantity);
}
// Customized product
if (jsonProduct.hasCustomizedDatas) {
customizationFormatedDatas = ajaxCart.displayNewCustomizedDatas(jsonProduct);
if (!$('ul[data-id="customization_' + domIdProductAttribute + '"]').length) {
if (jsonProduct.hasAttributes)
$('dd[data-id="cart_block_combination_of_' + domIdProduct + '"]').append(customizationFormatedDatas);
else
$('.cart_block dl.products').append(customizationFormatedDatas);
} else {
$('ul[data-id="customization_' + domIdProductAttribute + '"]').html('');
$('ul[data-id="customization_' + domIdProductAttribute + '"]').append(customizationFormatedDatas);
}
}
}
}
$('.cart_block dl.products .unvisible').slideDown(450).removeClass('unvisible');
var removeLinks = $('dt[data-id="cart_block_product_' + domIdProduct + '"]').find('a.ajax_cart_block_remove_link');
if (this.hasCustomizedDatas && removeLinks.length)
$(removeLinks).each(function() {
$(this).remove();
});
}
});
},
addProductRow: function(product, hotel_wise_data) {
//if product is not in the displayed cart, add a new product's line
var productDomId = product.id + '_' + (product.idCombination ? product.idCombination : '0') + '_' + (product.idAddressDelivery ? product.idAddressDelivery : '0') + '_' + ((hotel_wise_data && typeof(hotel_wise_data.id_hotel) != 'undefined') ? hotel_wise_data.id_hotel : '0');
var productAttributeDomId = product.id + '_' + (product.idCombination ? product.idCombination : '0');
var productId = parseInt(product.id);
if ($('dt[data-id="cart_block_product_' + productDomId + '"]').length == 0) {
var productAttributeId = (product.hasAttributes ? parseInt(product.attributes) : 0);
var content = '<dt class="unvisible" data-id="cart_block_product_' + productDomId + '">';
var name = $.trim($('<span />').html(product.name).text());
name = (name.length > 30 ? name.substring(0, 27) + '...' : name);
content += '<a class="cart-images" href="' + product.link + '" title="' + name + '"><img src="' + product.image_cart + '" alt="' + product.name + '"></a>';
content += '<div class="cart-info">';
content += '<div class="product-name">';
content += '<a href="' + product.link + '" title="' + product.name + '" class="cart_block_product_name">' + name + '</a>';
content += '</div>';
if ((parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE
|| parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE)
&& (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.length)
) {
content += '<div class="hotel-name">' + hotel_wise_data.hotel_name + '</div>';
}
if (product.hasAttributes)
content += '<div class="product-atributes"><a href="' + product.link + '" title="' + product.name + '">' + product.attributes + '</a></div>';
if (typeof(freeProductTranslation) != 'undefined') {
content += '<div class="cart-info-sec rm_product_info_' + productId + '">';
content += '<span class="product_info_label">Price:</span>';
content += '<span class="price product_info_data">&nbsp;';
if (product.booking_product) {
content += formatCurrency(parseFloat(product.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank);
}else if ((parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE
|| parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE)
&& (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.length)
) {
content += formatCurrency(parseFloat(hotel_wise_data.amount), currency_format, currency_sign, currency_blank);
} else {
content += formatCurrency(parseFloat(product.amount), currency_format, currency_sign, currency_blank);
}
content += '</span>';
content += '</div>';
}
content += '<div class="cart-info-sec rm_product_info_' + productId + '">';
content += '<span class="product_info_label">' + total_qty_txt + ':</span>';
content += '<span class="quantity-formated">';
content += '<span class="quantity product_info_data">';
if (product.booking_product) {
content += product.bookingData.total_num_rooms;
} else if (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.total_qty) {
content += hotel_wise_data.total_qty;
} else {
content += product.cart_quantity;
}
content += '</span>';
content += '</span>';
content += '</div>';
content += '</div>';
if (typeof(product.is_gift) == 'undefined' || product.is_gift == 0)
content += '<span class="remove_link"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseUri + '?controller=cart&amp;delete=1&amp;id_product=' + productId + '&amp;token=' + static_token + (product.hasAttributes ? '&amp;ipa=' + parseInt(product.idCombination) : '') + (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data && hotel_wise_data.id_hotel ? '&amp;id_hotel=' + parseInt(hotel_wise_data.id_hotel) : '') + '">&nbsp;</a></span>';
else
content += '<span class="remove_link"></span>';
content += '<div style="clear:both;"></div>';
// data for rooms only
if (product.booking_product) {
content += '<div id="booking_dates_container_' + productId + '" class="cart_prod_cont">';
content += '<div class="table-responsive">';
content += '<table class="table">';
content += '<tbody>';
content += '<tr>';
content += '<th>' + duration_txt + '</th>';
content += '<th>' + qty_txt + '.</th>';
content += '<th>' + price_txt + '</th>';
content += '<th>&nbsp;</th>';
content += '</tr>';
if (product.bookingData.date_diff !== 'undefined') {
$.each(product.bookingData.date_diff, function(date_diff_k, date_diff_v) {
from = $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v.data_form));
to = $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v.data_to));
let dateFormatToUse = from == to ? ajaxCart.dateFormatFull : ajaxCart.dateFormat;
content += '<tr class="rooms_remove_container">';
content += '<td>' + moment(new Date(date_diff_v.data_form)).format(dateFormatToUse) + '&nbsp;-&nbsp;' + moment(new Date(date_diff_v.data_to)).format(dateFormatToUse) + '</td>';
content += '<td class="num_rooms_in_date">' + date_diff_v.num_rm + '</td>';
content += '<td>' + formatCurrency(parseFloat(date_diff_v.amount) + parseFloat(date_diff_v.demand_price), currency_format, currency_sign, currency_blank) + '</td>';
content += '<td>';
content += '<a class="remove_rooms_from_cart_link" href="#" rm_price=' + date_diff_v.amount + ' id_product=' + productId + ' date_from=' + date_diff_v.data_form + ' date_to=' + date_diff_v.data_to + ' num_rooms=' + date_diff_v.num_rm + ' title="' + remove_rm_title + '"></a>';
content += '</td>';
content += '</tr>';
});
}
content += '</tbody>';
content += '</table>';
content += '</div>';
content += '</div>';
} else if (product.hasOptions) {
content += '<div class="table-responsive cart_prod_cont">';
content += '<table class="table">';
content += '<tbody>';
content += '<tr>';
content += '<th>' + variant_txt + '</th>';
content += '<th>' + qty_txt + '.</th>';
content += '<th>' + price_txt + '</th>';
content += '<th>&nbsp;</th>';
content += '</tr>';
if (parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE
|| parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE
) {
if (hotel_wise_data.options !== 'undefined') {
var options = hotel_wise_data.options;
}
} else if (parseInt(product.selling_preference_type) == SELLING_PREFERENCE_STANDALONE) {
if (product.options !== 'undefined') {
var options = product.options;
}
}
if (options !== 'undefined') {
$.each(options, function(data_k, data_v) {
content += '<tr class="product_option_row">';
content += '<td>' + data_v.option_name + '</td>';
content += '<td>' + data_v.quantity + '</td>';
content += '<td>' + formatCurrency(parseFloat(data_v.total_price_tax_excl), currency_format, currency_sign, currency_blank) + '</td>';
content += '<td class="text-right"><a class="ajax_remove_product_option" href="#" id_product="' + product.id_product + '" id_hotel="' + data_v.id_hotel + '" id_product_option="' + data_v.id_product_option + '" title="' + remove_rm_title + '">&nbsp;</a></td>';
content += '</tr>';
});
}
content += '</tbody>';
content += '</table>';
content += '</div>';
}
content += '</dt>';
if (product.hasAttributes)
content += '<dd data-id="cart_block_combination_of_' + productDomId + '" class="unvisible">';
if (product.hasCustomizedDatas)
content += ajaxCart.displayNewCustomizedDatas(product);
if (product.hasAttributes) content += '</dd>';
$('.cart_block dl.products').append(content);
}
//else update the product's line
else {
//by webkul to update rooms information on new room add to cart
if (product.booking_product) {
var booking_dates_content = '';
// $("#booking_dates_container_"+product.id).empty();
$("#booking_dates_container_" + product.id).find("table.table tbody tr.rooms_remove_container").remove();
var product_price_float = product.price_float;
if (product.bookingData.date_diff !== 'undefined') {
$.each(product.bookingData.date_diff, function(date_diff_k1, date_diff_v1) {
from = $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v1.data_form));
to = $.datepicker.formatDate(ajaxCart.dateFormat, new Date(date_diff_v1.data_to));
let dateFormatToUse = from == to ? ajaxCart.dateFormatFull : ajaxCart.dateFormat;
booking_dates_content += '<tr class="rooms_remove_container">';
booking_dates_content += '<td>' + moment(new Date(date_diff_v1.data_form)).format(dateFormatToUse) + '&nbsp;-&nbsp;' + moment(new Date(date_diff_v1.data_to)).format(dateFormatToUse) + '</td>';
booking_dates_content += '<td class="num_rooms_in_date">' + date_diff_v1.num_rm + '</td>';
booking_dates_content += '<td>' + formatCurrency(parseFloat(date_diff_v1.amount) + parseFloat(date_diff_v1.demand_price), currency_format, currency_sign, currency_blank) + '</td>';
booking_dates_content += '<td>';
booking_dates_content += '<a class="remove_rooms_from_cart_link" href="#" rm_price=' + date_diff_v1.amount + ' id_product=' + productId + ' date_from=' + date_diff_v1.data_form + ' date_to=' + date_diff_v1.data_to + ' num_rooms=' + date_diff_v1.num_rm + ' title="' + remove_rm_title + '"></a>';
booking_dates_content += '</td>';
booking_dates_content += '</tr>';
});
}
$("#booking_dates_container_" + product.id).find("table.table tbody").append(booking_dates_content);
} else if (product.hasOptions) {
$('dt[data-id="cart_block_product_' + productDomId + '"] .cart_prod_cont tr.product_option_row').remove();
var product_options_content = '';
if (parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE
|| parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE
) {
if (hotel_wise_data.options !== 'undefined') {
var options = hotel_wise_data.options;
}
} else if (parseInt(product.selling_preference_type) == SELLING_PREFERENCE_STANDALONE) {
if (product.options !== 'undefined') {
var options = product.options;
}
}
if (options !== 'undefined') {
$.each(options, function(data_k, data_v) {
product_options_content += '<tr class="product_option_row">';
product_options_content += '<td>' + data_v.option_name + '</td>';
product_options_content += '<td>' + data_v.quantity + '</td>';
product_options_content += '<td>' + formatCurrency(parseFloat(data_v.total_price_tax_excl), currency_format, currency_sign, currency_blank) + '</td>';
product_options_content += '<td class="text-right"><a class="ajax_remove_product_option" href="#" id_product="' + product.id_product + '" id_hotel="' + data_v.id_hotel + '" id_product_option="' + data_v.id_product_option + '" title="' + remove_rm_title + '">&nbsp;</a></td>';
product_options_content += '</tr>';
});
}
$('dt[data-id="cart_block_product_' + productDomId + '"] .cart_prod_cont table tbody').append(product_options_content);
}
//end
var jsonProduct = product;
if ($.trim($('dt[data-id="cart_block_product_' + productDomId + '"] .quantity').html()) != jsonProduct.quantity || $.trim($('dt[data-id="cart_block_product_' + productDomId + '"] .price').html()) != jsonProduct.priceByLine) {
// Usual product
if (!product.is_gift) {
if (product.booking_product) {
$('dt[data-id="cart_block_product_' + productDomId + '"] .price').text(formatCurrency(parseFloat(product.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank));
} else if ((parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE
|| parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE)
&& typeof(hotel_wise_data) != 'undefined'
) {
$('dt[data-id="cart_block_product_' + productDomId + '"] .price').text(formatCurrency(parseFloat(hotel_wise_data.amount), currency_format, currency_sign, currency_blank));
} else {
$('dt[data-id="cart_block_product_' + productDomId + '"] .price').text(formatCurrency(parseFloat(product.amount), currency_format, currency_sign, currency_blank));
}
} else
$('dt[data-id="cart_block_product_' + productDomId + '"] .price').html(freeProductTranslation);
//cart_booking_data[key].total_num_rooms argument sent to update num of rooms instead of quantity
if (product.booking_product) {
ajaxCart.updateProductQuantity(jsonProduct, product.bookingData.total_num_rooms);
} else if ((parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE
|| parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE
)
&& typeof(hotel_wise_data) != 'undefined'
&& hotel_wise_data.total_qty
) {
ajaxCart.updateProductQuantity(jsonProduct, hotel_wise_data.total_qty, hotel_wise_data);
} else {
ajaxCart.updateProductQuantity(jsonProduct, jsonProduct.cart_quantity);
}
// Customized product
if (jsonProduct.hasCustomizedDatas) {
customizationFormatedDatas = ajaxCart.displayNewCustomizedDatas(jsonProduct);
if (!$('ul[data-id="customization_' + productAttributeDomId + '"]').length) {
if (jsonProduct.hasAttributes)
$('dd[data-id="cart_block_combination_of_' + productDomId + '"]').append(customizationFormatedDatas);
else
$('.cart_block dl.products').append(customizationFormatedDatas);
} else {
$('ul[data-id="customization_' + productAttributeDomId + '"]').html('');
$('ul[data-id="customization_' + productAttributeDomId + '"]').append(customizationFormatedDatas);
}
}
}
}
$('.cart_block dl.products .unvisible').slideDown(450).removeClass('unvisible');
var removeLinks = $('dt[data-id="cart_block_product_' + productDomId + '"]').find('a.ajax_cart_block_remove_link');
if (product.hasCustomizedDatas && removeLinks.length)
$(removeLinks).each(function() {
$(product).remove();
});
},
displayNewCustomizedDatas: function(product) {
var content = '';
var productId = parseInt(product.id);
@@ -1083,13 +1166,16 @@ var ajaxCart = {
// change text labels according to product type
$('#layer_cart .layer_cart_room_txt').hide();
$('#layer_cart .layer_cart_product_txt').hide();
if(product.booking_product) {
if(parseInt(product.booking_product)) {
$('#layer_cart .layer_cart_room_txt').show();
} else {
$('#layer_cart .layer_cart_product_txt').show();
}
$('#layer_cart_product_title').text(product.name);
var product_name_txt = product.name;
if (typeof(product.id_product_option) !== 'undefined' && product.option_name) {
product_name_txt += ': ' + product.option_name;
}
$('#layer_cart_product_title').text(product_name_txt);
$('#layer_cart_product_attributes').text('');
if (product.hasAttributes && product.hasAttributes == true)
$('#layer_cart_product_attributes').html(product.attributes);
@@ -1099,22 +1185,30 @@ var ajaxCart = {
$('#layer_cart_product_time_duration').text(
product.date_from + ' - ' + product.date_to
);
let rooms = 0;
let adults = 0;
let children = 0;
let room_quantity_text = '';
if (occupancy_required_for_booking) {
$.each(product.occupancy, function(index, val) {
rooms++;
adults += parseInt(val.adults);
children += parseInt(val.children);
});
room_quantity_text = getRoomTypeGuestOccupancyFormated(adults, children, rooms);
$('#layer_cart_product_hotel_name').parent().hide();
var product_quantity_text = '';
if(parseInt(product.booking_product)) {
let rooms = 0;
let adults = 0;
let children = 0;
if (occupancy_required_for_booking) {
$.each(product.occupancy, function(index, val) {
rooms++;
adults += parseInt(val.adults);
children += parseInt(val.children);
});
product_quantity_text = getRoomTypeGuestOccupancyFormated(adults, children, rooms);
} else {
product_quantity_text = product.occupancy;
}
} else {
room_quantity_text = product.occupancy;
product_quantity_text = product.qty;
$('#layer_cart_product_unit_price').text(product.unit_price);
if (product.hotel_name) {
$('#layer_cart_product_hotel_name').text(product.hotel_name).parent().show();
}
}
$('#layer_cart_product_quantity').text(room_quantity_text);
$('#layer_cart_product_quantity').text(product_quantity_text);
$('.layer_cart_img').html('<img class="layer_cart_img img-responsive" src="' + product.image + '" alt="' + product.name + '" title="' + product.name + '" />');
@@ -1186,8 +1280,18 @@ var ajaxCart = {
$('.ajax_block_cart_total').text(jsonData.total);
$('.ajax_block_cart_total').attr('total_cart_price', jsonData.totalToPay);
$('.ajax_block_room_total').text(jsonData.room_total);
$('.ajax_block_nornal_products_total').text(jsonData.normalProductsTotal);
$('.ajax_block_room_total').text(jsonData.room_total_format);
if (jsonData.room_total) {
$('.ajax_block_room_total').parent().show();
} else {
$('.ajax_block_room_total').parent().hide();
}
$('.ajax_block_product_total').text(jsonData.normal_products_total_format);
if (jsonData.normal_products_total) {
$('.ajax_block_product_total').parent().show();
} else {
$('.ajax_block_product_total').parent().hide();
}
$('.ajax_cart_convenience_fee').text(jsonData.total_convenience_fee_format);
if (jsonData.total_convenience_fee) {
$('.ajax_cart_convenience_fee').parent().show();
@@ -1323,44 +1427,48 @@ function getRoomsServiceProducts()
return serviceProducts;
}
function getBookingOccupancyDetails(bookingform)
function getBookingOccupancyDetails(bookingform, booking_product)
{
let occupancy;
if (occupancy_required_for_booking) {
$('.booking_guest_occupancy_conatiner .dropdown').removeClass('open');
let selected_occupancy = $(bookingform).find(".occupancy_info_block.selected")
if (selected_occupancy.length) {
occupancy = [];
$(selected_occupancy).each(function(ind, element) {
if (parseInt($(element).find('.num_adults').val())) {
let child_ages = [];
$(element).find('.guest_child_age').each(function(index) {
if ($(this).val() > -1) {
child_ages.push($(this).val());
}
});
if ($(element).find('.num_children').val()) {
if (child_ages.length != $(element).find('.num_children').val()) {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
if (booking_product) {
if (occupancy_required_for_booking) {
$('.booking_guest_occupancy_conatiner .dropdown').removeClass('open');
let selected_occupancy = $(bookingform).find(".occupancy_info_block.selected")
if (selected_occupancy.length) {
occupancy = [];
$(selected_occupancy).each(function(ind, element) {
if (parseInt($(element).find('.num_adults').val())) {
let child_ages = [];
$(element).find('.guest_child_age').each(function(index) {
if ($(this).val() > -1) {
child_ages.push($(this).val());
}
});
if ($(element).find('.num_children').val()) {
if (child_ages.length != $(element).find('.num_children').val()) {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
}
}
occupancy.push({
'adults': $(element).find('.num_adults').val(),
'children': $(element).find('.num_children').val(),
'child_ages': child_ages
});
} else {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
}
occupancy.push({
'adults': $(element).find('.num_adults').val(),
'children': $(element).find('.num_children').val(),
'child_ages': child_ages
});
} else {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
}
});
});
} else {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
}
} else {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
occupancy = parseInt($(bookingform).find(".quantity_wanted").val());
}
} else {
occupancy = parseInt($(bookingform).find(".quantity_wanted").val());
occupancy = parseInt($('#service_product_qty').val());
}
return occupancy;

Some files were not shown because too many files have changed in this diff Show More