Added feature service products as normal product

This commit is contained in:
Shreesh Arora
2022-08-16 12:18:12 +05:30
parent c0ee4685ec
commit a02fceb331
230 changed files with 23845 additions and 7890 deletions

View File

@@ -43,7 +43,8 @@ class Adapter_ProductPriceCalculator
$with_ecotax = true,
$use_group_reduction = true,
Context $context = null,
$use_customer_price = true
$use_customer_price = true,
$id_roomtype = false
) {
return Product::getPriceStatic(
$id_product,
@@ -62,7 +63,8 @@ class Adapter_ProductPriceCalculator
$with_ecotax,
$use_group_reduction,
$context,
$use_customer_price
$use_customer_price,
$id_roomtype
);
}
}

View File

@@ -168,58 +168,15 @@ Tree.prototype =
expandAll : function($speed)
{
var idTree = this.$element.parent().find('.cattree.tree').first().attr('id');
if (typeof(idTree) != 'undefined' && !$('#'+idTree).hasClass('full_loaded'))
{
var selected = [];
that = this;
$('#'+idTree).find('.tree-selected input').each(
function()
{
selected.push($(this).val());
}
);
var name = $('#'+idTree).find('ul.tree input').first().attr('name');
var inputType = $('#'+idTree).find('ul.tree input').first().attr('type');
var useCheckBox = 0;
if (inputType == 'checkbox')
this.$element.find("label.tree-toggler").each(
function()
{
useCheckBox = 1;
$(this).parent().children(".icon-folder-close")
.removeClass("icon-folder-close")
.addClass("icon-folder-open");
$(this).parent().parent().children("ul.tree").show($speed);
}
$.get(
'ajax-tab.php',
{controller:'AdminProducts',token:currentToken,action:'getCategoryTree',type:idTree,fullTree:1,selected:selected, inputName:name,useCheckBox:useCheckBox},
function(content)
{
$('#' + idTree).html(content);
organizeTree();
$('#' + idTree).tree('init');
that.$element.find("label.tree-toggler").each(
function()
{
$(this).parent().children(".icon-folder-close")
.removeClass("icon-folder-close")
.addClass("icon-folder-open");
$(this).parent().parent().children("ul.tree").show($speed);
$('#'+idTree).addClass('full_loaded');
}
);
}
);
}
else
{
this.$element.find("label.tree-toggler").each(
function()
{
$(this).parent().children(".icon-folder-close")
.removeClass("icon-folder-close")
.addClass("icon-folder-open");
$(this).parent().parent().children("ul.tree").show($speed);
}
);
}
);
return $(this);
}

View File

@@ -0,0 +1,124 @@
{*
* 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)}
<div id="product-associations" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Associations" />
<h3>{l s='Associations'}</h3>
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Associations"}
<div id="no_default_category" class="alert alert-info">
{l s='Please select a default category.'}
</div>
<div class="alert alert-info">
{l s='To create new categories '} <a target="_blank" href="{$link->getAdminLink('AdminCategories')}">{l s='click here.'}</a>
</div>
<div class="form-group">
<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="category_block">
{l s='Associated categories'}
</label>
<div class="col-lg-9">
<div id="category_block">
{$category_tree}
</div>
{* <a class="btn btn-link bt-icon confirm_leave" href="{$link->getAdminLink('AdminCategories')|escape:'html':'UTF-8'}&amp;addcategory">
<i class="icon-plus-sign"></i> {l s='Create new category'} <i class="icon-external-link-sign"></i>
</a> *}
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3 alert alert-info">
{l s='Associations are used to display service product category wise on room type page when'} <a href="{$link->getAdminLink('AdminPPreferences')}#conf_id_PS_SERVICE_PRODUCT_CATEGORY_FILTER" target="_blank">{l s='Category filter'}</a> {l s='is enabled'}
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="id_category_default" type="default"}</span></div>
<label class="control-label col-lg-2" for="id_category_default">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The default category is the main category for your room type, and is displayed by default.'}">
{l s='Default category'}
</span>
</label>
<div class="col-lg-5">
<select id="id_category_default" name="id_category_default">
{foreach from=$selected_cat item=cat}
<option value="{$cat.id_category}" {if $id_category_default == $cat.id_category}selected="selected"{/if} >{$cat.name}</option>
{/foreach}
</select>
</div>
</div>
<!-- By webkul to hide unneccessary fields -->
<!-- <div class="form-group">
<label class="control-label col-lg-3" for="product_autocomplete_input">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='You can indicate existing products as accessories for this product.'}{l s='Start by typing the first letters of the product\'s name, then select the product from the drop-down list.'}{l s='Do not forget to save the product afterwards!'}">
{l s='Accessories'}
</span>
</label>
<div class="col-lg-5">
<input type="hidden" name="inputAccessories" id="inputAccessories" value="{foreach from=$accessories item=accessory}{$accessory.id_product}-{/foreach}" />
<input type="hidden" name="nameAccessories" id="nameAccessories" value="{foreach from=$accessories item=accessory}{$accessory.name|escape:'html':'UTF-8'}¤{/foreach}" />
<div id="ajax_choose_product">
<div class="input-group">
<input type="text" id="product_autocomplete_input" name="product_autocomplete_input" />
<span class="input-group-addon"><i class="icon-search"></i></span>
</div>
</div>
<div id="divAccessories">
{foreach from=$accessories item=accessory}
<div class="form-control-static">
<button type="button" class="btn btn-default delAccessory" name="{$accessory.id_product}">
<i class="icon-remove text-danger"></i>
</button>
{$accessory.name|escape:'html':'UTF-8'}{if !empty($accessory.reference)}&nbsp;{l s='(ref: %s)' sprintf=$accessory.reference}{/if}
</div>
{/foreach}
</div>
</div>
</div> -->
<!-- By webkul to hide unneccessary fields -->
<!-- <div class="form-group">
<label class="control-label col-lg-3" for="id_manufacturer">{l s='Manufacturer'}</label>
<div class="col-lg-5">
<select name="id_manufacturer" id="id_manufacturer">
<option value="0">- {l s='Choose (optional)'} -</option>
{if $product->id_manufacturer}
<option value="{$product->id_manufacturer}" selected="selected">{$product->manufacturer_name}</option>
{/if}
<option disabled="disabled">-</option>
</select>
</div>
<div class="col-lg-4">
<a class="btn btn-link bt-icon confirm_leave" style="margin-bottom:0" href="{$link->getAdminLink('AdminManufacturers')|escape:'html':'UTF-8'}&amp;addmanufacturer">
<i class="icon-plus-sign"></i> {l s='Create new manufacturer'} <i class="icon-external-link-sign"></i>
</a>
</div>
</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>
{/if}

View File

@@ -0,0 +1,188 @@
{*
* 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-features" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Features" />
<h3>{l s='Assign features to this room type'}</h3>
<div class="alert alert-info">
{l s='You can specify a value for each relevant feature regarding this room type. Empty fields will not be displayed.'}<br/>
{l s='You can either create a specific value, or select among the existing pre-defined values you\'ve previously added.'}
</div>
<table class="table">
<thead>
<tr>
<th></th>
<th><span class="title_box">{l s='Feature'}</span></th>
<th><span class="title_box">{l s='Feature Image'}</span></th>
<!-- <th><span class="title_box"><u>{l s='or'}</u> {l s='Customized value'}</span></th> --><!-- by webkul -->
</tr>
</thead>
<tbody>
{foreach from=$available_features item=available_feature}
<tr>
{foreach from=$available_feature.featureValues item=value}
<td>
<input type="checkbox" class="checkbox select_hotel_feature" name="feature_{$available_feature.id_feature}_check" value="{$value.id_feature_value}" {if $available_feature.current_item == $value.id_feature_value}checked="checked"{/if}/>
</td>
<td>{$available_feature.name}</td>
<td>
<input type="hidden" id="feature_{$available_feature.id_feature}_value" name="feature_{$available_feature.id_feature}_value" value="{$value.id_feature_value}">
<img class="img img-responsive" width="15px" src="{$base_url}img/rf/{$value.value}" title="Room image" />
</td>
{/foreach}
<!--<td>
{if sizeof($available_feature.featureValues)}
<select id="feature_{$available_feature.id_feature}_value" name="feature_{$available_feature.id_feature}_value"
onchange="$('.custom_{$available_feature.id_feature}_').val('');">
<option value="0">---</option>
{foreach from=$available_feature.featureValues item=value}
<option value="{$value.id_feature_value}"{if $available_feature.current_item == $value.id_feature_value}selected="selected"{/if} >
{$value.value|truncate:40}
</option>
{/foreach}
</select>
{else}
<input type="hidden" name="feature_{$available_feature.id_feature}_value" value="0" />
<span>{l s='N/A'} -
<a href="{$link->getAdminLink('AdminFeatures')|escape:'html':'UTF-8'}&amp;addfeature_value&amp;id_feature={$available_feature.id_feature}"
class="confirm_leave btn btn-link"><i class="icon-plus-sign"></i> {l s='Add pre-defined values first'} <i class="icon-external-link-sign"></i></a>
</span>
{/if} --><!-- By Webkul -->
</td>
<!-- <td>
<div class="row lang-0" style='display: none;'>
<div class="col-lg-9">
<textarea class="custom_{$available_feature.id_feature}_ALL textarea-autosize" name="custom_{$available_feature.id_feature}_ALL"
cols="40" style='background-color:#CCF' rows="1" onkeyup="{foreach from=$languages key=k item=language}$('.custom_{$available_feature.id_feature}_{$language.id_lang}').val($(this).val());{/foreach}" >{$available_feature.val[1].value|escape:'html':'UTF-8'|default:""}</textarea>
</div>
{if $languages|count > 1}
<div class="col-lg-3">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{l s='ALL'}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=language}
<li>
<a href="javascript:void(0);" onclick="restore_lng($(this),{$language.id_lang});">{$language.iso_code}</a>
</li>
{/foreach}
</ul>
</div>
{/if}
</div>
{foreach from=$languages key=k item=language}
{if $languages|count > 1}
<div class="row translatable-field lang-{$language.id_lang}">
<div class="col-lg-9">
{/if}
<textarea
class="custom_{$available_feature.id_feature}_{$language.id_lang} textarea-autosize"
name="custom_{$available_feature.id_feature}_{$language.id_lang}"
cols="40"
rows="1"
onkeyup="if (isArrowKey(event)) return ;$('#feature_{$available_feature.id_feature}_value').val(0);" >{$available_feature.val[$language.id_lang].value|escape:'html':'UTF-8'|default:""}</textarea>
{if $languages|count > 1}
</div>
<div class="col-lg-3">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{$language.iso_code}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="javascript:void(0);" onclick="all_languages($(this));">{l s='ALL'}</a></li>
{foreach from=$languages item=language}
<li>
<a href="javascript:hideOtherLanguage({$language.id_lang});">{$language.iso_code}</a>
</li>
{/foreach}
</ul>
</div>
</div>
{/if}
{/foreach}
</td> --><!-- By Webkul -->
</tr>
{foreachelse}
<tr>
<td colspan="3" style="text-align:center;"><i class="icon-warning-sign"></i> {l s='No features have been defined'}</td>
</tr>
{/foreach}
</tbody>
</table>
<a href="{$link->getAdminLink('AdminFeatures')|escape:'html':'UTF-8'}&amp;addfeature" class="btn btn-link confirm_leave button">
<i class="icon-plus-sign"></i> {l s='Add a new feature'} <i class="icon-external-link-sign"></i>
</a>
<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 type="text/javascript">
if (tabs_manager.allow_hide_other_languages)
hideOtherLanguage({$default_form_language});
{literal}
$(".textarea-autosize").autosize();
function all_languages(pos)
{
{/literal}
{if isset($languages) && is_array($languages)}
{foreach from=$languages key=k item=language}
pos.parents('td').find('.lang-{$language.id_lang}').addClass('nolang-{$language.id_lang}').removeClass('lang-{$language.id_lang}');
{/foreach}
{/if}
pos.parents('td').find('.translatable-field').hide();
pos.parents('td').find('.lang-0').show();
{literal}
}
function restore_lng(pos,i)
{
{/literal}
{if isset($languages) && is_array($languages)}
{foreach from=$languages key=k item=language}
pos.parents('td').find('.nolang-{$language.id_lang}').addClass('lang-{$language.id_lang}').removeClass('nolang-{$language.id_lang}');
{/foreach}
{/if}
{literal}
pos.parents('td').find('.lang-0').hide();
hideOtherLanguage(i);
}
</script>
{/literal}
{/if}

View File

@@ -0,0 +1,337 @@
{*
* 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
*}
{extends file="helpers/form/form.tpl"}
{block name="autoload_tinyMCE"}
// Execute when tab Informations has finished loading
tabs_manager.onLoad('Informations', function(){
tinySetup({
editor_selector :"autoload_rte",
setup : function(ed) {
ed.on('init', function(ed)
{
if (typeof ProductMultishop.load_tinymce[ed.target.id] != 'undefined')
{
if (typeof ProductMultishop.load_tinymce[ed.target.id])
tinyMCE.get(ed.target.id).hide();
else
tinyMCE.get(ed.target.id).show();
}
});
ed.on('keydown', function(ed, e) {
tinyMCE.triggerSave();
textarea = $('#'+tinymce.activeEditor.id);
var max = textarea.parent('div').find('span.counter').data('max');
if (max != 'none')
{
count = tinyMCE.activeEditor.getBody().textContent.length;
rest = max - count;
if (rest < 0)
textarea.parent('div').find('span.counter').html('<span style="color:red;">{l s='Maximum'} '+ max +' {l s='characters'} : '+rest+'</span>');
else
textarea.parent('div').find('span.counter').html(' ');
}
});
}
});
});
{/block}
{block name="defaultForm"}
<div class="row">
<div class="productTabs col-lg-2 col-md-3">
<div class="list-group">
{foreach $product_tabs key=numStep item=tab}
{if $tab.name != "Pack"}
<a class="list-group-item {if $tab.selected}active{/if}" id="link-{$tab.id}" href="{$tab.href|escape:'html':'UTF-8'}&amp;updateproduct">{$tab.name}</a>
{/if}
{/foreach}
</div>
</div>
<script type="text/javascript">
var id_product = {if isset($product->id)}{$product->id|intval}{else}0{/if};
var id_lang_default = {$id_lang_default|intval};
var product_type_pack = {Product::PTYPE_PACK|intval};
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 has_combinations = {$has_combinations|intval};
var empty_pack_msg = '{l s='This pack is empty. You will need to add at least one product to the pack before you can save.' js=1}';
var empty_name_msg = '{l s='The product name is empty. You will at least need to enter a name for the default language before you can save the product.' js=1}';
var empty_link_rewrite_msg = '{l s='The friendly URL is empty. You will at least need to enter a friendly URL for the default language before you can save the product.' slashes=1}';
var reload_tab_title = '{l s='Confirmation' slashes=1}';
var reload_tab_description = '{l s='A server error occurred while loading the tabs: some tabs could not be loaded.' js=1}'+'\n'+'{l s='Please try again by refreshing the page.' js=1}'+'\n'+'{l s='If you are still encountering this problem, please check your server logs or contact your hosting provider for assistance.' js=1}';
$('#product-tab-content-wait').show();
var post_data = {$post_data};
var save_error = {if $save_error}true{else}false{/if};
var error_heading_msg = '{l s='Error' js=1}';
var error_continue_msg = '{l s='Continue' js=1}';
var product_type = {$product_type};
{*var mce_maximum = '{l s='Maximum'}';*}
{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes}
var display_multishop_checkboxes = true;
{else}
var display_multishop_checkboxes = false;
{/if}
var tabs_to_preload = new Array();
var mod_evasive = {if isset($mod_evasive) && $mod_evasive}true{else}false{/if};
var mod_security = {if isset($mod_security) && $mod_security}true{else}false{/if};
$(document).ready(function()
{
{* if (product_type == product_type_pack)
{
$('a[id*="VirtualProduct"]').hide();
$('a[id*="Combinations"]').hide();
}
else if (product_type == product_type_virtual)
{
$('#hotel_selection').show();
$('a[id*="Quantities"]').hide();
$('a[id*="Configuration"]').show();
$('a[id*="Booking"]').show();
$('a[id*="Occupancy"]').show();
$('a[id*="ModuleHotelreservationsystem"]').show();
$('a[id*="Pack"]').hide();
$('a[id*="Shipping"]').hide();
$('a[id*="Combinations"]').hide();
}
else
{
$('#hotel_selection').hide();
$('a[id*="Quantities"]').show();
$('a[id*="Configuration"]').hide();
$('a[id*="Occupancy"]').hide();
$('a[id*="Booking"]').hide();
$('a[id*="ModuleHotelreservationsystem"]').hide();
$('a[id*="Pack"]').hide();
$('a[id*="VirtualProduct"]').hide();
}
updateTextInfo(product_type); *}
{* $('#desc-product-newCombination').hide(); *}
{* submenu binding *}
$(".productTabs a").click(function(e){
e.preventDefault();
// currentId is the current product tab id
currentId = false;
if ($(".productTabs a.active").length)
currentId = $(".productTabs a.active").attr('id').substr(5);
// id is the wanted producttab id
id = $(this).attr('id').substr(5);
// Update submit button value
var split_position = id.indexOf('-') + 1;
var btn_name = id.substr(split_position);
if ((btn_name == 'VirtualProduct' || btn_name == 'Pack') && $('#name_' + id_lang_default).val() == '')
{
alert(missing_product_name);
$('#name_' + id_lang_default).focus();
return false;
}
$('#key_tab').val(btn_name);
if ($(this).attr("id") != $(".productTabs a.active ").attr('id'))
{
$(".productTabs a").removeClass('active');
$("#product-tab-content-"+currentId).hide();
}
// if the tab has not already been loaded, load it now
tabs_manager.display(id, true);
tabs_manager.onLoad(id, function(){
$("#product-tab-content-"+id).show(0, function(){
$(this).trigger('displayed');
});
$("#link-"+id).addClass('active');
});
var languages = new Array();
if (btn_name == "Combinations")
{
$('#desc-product-new').hide();
$('#desc-product-newCombination').show();
populate_attrs();
}
else if (btn_name == "Attachments")
{
handleSaveButtons();
}
else
{
$('#desc-product-newCombination').hide();
// if pack is enabled, save button are visible only if pack is valid
if ($("input[name='id_product']").val() != 0 || btn_name != 'Informations')
handleSaveButtons();
}
$('.label-tooltip').tooltip();
});
$(".productTabs a.active").click();
// disable save if Associations tab is not loaded
if ($('#product-tab-content-Associations').hasClass('not-loaded'))
disableSave();
tabs_manager.onLoad('Associations', function(){
if ($("input[name='id_product']").val() != 0)
handleSaveButtons();
});
$('.confirm_leave').live('click', function(){
// Double quotes are necessary when the translated string has single quotes
return confirm("{l s='You will lose all unsaved modifications. Are you sure that you want to proceed?' js=1}");
});
$('#toolbar-footer').appendTo($('#product-tab-content-Informations').children('.product-tab'));
$('.product-tab-content').on('displayed', function(e) {
$('#toolbar-footer').appendTo($(this).children('.product-tab'));
});
});
// Listen to the load event that is fired each time an ajax call to load a tab has completed
$(window).bind("load", function() {
{* Fill an array with tabs that need to be preloaded *}
var tabs_to_preload = new Array();
{foreach $tabs_preloaded as $tab_name => $value}
{* If the tab was not given a loading priority number it will not be preloaded *}
{if (is_numeric($value))}
if ($("#product-tab-content-"+'{$tab_name}').hasClass('not-loaded'))
tabs_to_preload.push('{$tab_name}');
{/if}
{/foreach}
tabs_manager.tabs_to_preload = tabs_to_preload.slice(0);
tabs_manager.displayBulk(tabs_to_preload);
$('.productTabs').show();
$('#product-tab-content-wait').hide();
function checkIfProductTypeIsPack() {
var typeIsPack = $('#pack_product').is(':checked');
if (typeIsPack && $('#inputPackItems').val()=='' ) {
$('.pack-empty-warning').removeClass('alert-warning').addClass('alert-danger');
$('#curPackItemName').select2('open');
}
return typeIsPack;
}
$("#product_form").validate({
ignore: '.updateCurrentText',
rules: {
inputPackItems: {
required: {
depends: checkIfProductTypeIsPack
},
}
},
messages: {
inputPackItems: {
required: ""
}
},
// override jquery validate plugin defaults for bootstrap 3
highlight: function(element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight: function(element) {
$(element).closest('.form-group').removeClass('has-error');
},
errorElement: 'span',
errorClass: 'help-block',
errorPlacement: function(error, element) {
if(element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else {
error.insertAfter(element);
}
}
});
});
</script>
<script type="text/javascript">
// <![CDATA[
ThickboxI18nImage = "{l s='Image'}";
ThickboxI18nOf = "{l s='of'}";
ThickboxI18nClose = "{l s='Close'}";
ThickboxI18nOrEscKey = "{l s='(or "Esc")'}";
ThickboxI18nNext = "{l s='Next >'}";
ThickboxI18nPrev = "{l s='< Previous'}";
tb_pathToImage = "../img/loadingAnimation.gif";
//]]>
</script>
<div id="product-tab-content-wait" style="display:none">
<div id="loading"><i class="icon-refresh icon-spin"></i>&nbsp;{l s='Loading...'}</div>
</div>
<form id="product_form" class="form-horizontal col-lg-10 col-md-9" action="{$form_action|escape:'html':'UTF-8'}" method="post" enctype="multipart/form-data" name="product" novalidate>
<input type="hidden" name="id_product" value="{$id_product}" />
{* <input type="hidden" id="is_virtual" name="is_virtual" value="{$product->is_virtual|escape:'html':'UTF-8'}" /> *}
<!-- changed input field to make product virtual by default -->
<input type="hidden" id="is_virtual" name="is_virtual" value="1"/>
{if isset($smarty.request.page) && $smarty.request.page > 1}
<input type="hidden" id="page" name="page" value="{$smarty.request.page|intval}" />
{/if}
{if !$product->active && $product->isAssociatedToShop()}
<div class="alert alert-info draft">
{l s='Your product will be saved as a draft.'}
<a href="#" class="btn btn-default" onclick="submitAddProduct()" ><i class="icon-save"></i>&nbsp;{l s='Save'}</a>
<input type="hidden" name="submitAddProduct" id="submitAddProduct" />
</div>
{/if}
{* all input are here *}
{foreach $product_tabs key=numStep item=tab}
{if $tab.id != "Pack" }
<div id="product-tab-content-{$tab.id}" class="{if !$tab.selected}not-loaded{/if} product-tab-content" {if !$tab.selected}style="display:none"{/if}>
{if $tab.selected}
{$custom_form}
{/if}
</div>
{/if}
{/foreach}
<input type="hidden" name="id_product_attribute" id="id_product_attribute" value="0" />
<input type="hidden" name="key_tab" id="key_tab" value="Informations" />
</form>
</div>
{/block}

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/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 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/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../../../../');
exit;

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/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 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/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../../../');
exit;

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/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 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/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../../../../');
exit;

View File

@@ -0,0 +1,36 @@
{*
* 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
*}
{extends file="helpers/list/list_header.tpl"}
{block name=leadin}
{if isset($category_tree)}
<div class="bloc-leadin">
<div id="container_category_tree">
{$category_tree}
</div>
</div>
{/if}
{/block}

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/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 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/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../../../../');
exit;

View File

@@ -0,0 +1,55 @@
{*
* 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($nodes)}
{$nodes}
{/if}
<script type="text/javascript">
{if isset($selected_categories) && !empty($selected_categories)}
{assign var=imploded_selected_categories value='","'|implode:$selected_categories}
var selected_categories = new Array("{$imploded_selected_categories}");
$('#{$id_tree}').tree('collapseAll');
$('#{$id_tree}').find(":input").each(
function()
{
if ($.inArray($(this).val(), selected_categories) != -1)
{
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents("ul.tree").each(
function()
{
$(this).children().children().children(".icon-folder-close")
.removeClass("icon-folder-close")
.addClass("icon-folder-open");
$(this).show();
}
);
}
}
);
{/if}
</script>

View File

@@ -0,0 +1,161 @@
{*
* 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
*}
<div class="panel">
{if isset($header)}{$header}{/if}
{if isset($nodes)}
<ul id="{$id|escape:'html':'UTF-8'}" class="cattree tree">
{$nodes}
</ul>
{/if}
</div>
<script type="text/javascript">
var currentToken="{$token|@addslashes}";
var treeClickFunc = function() {
var newURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
var queryString = window.location.search.replace(/&id_category=[0-9]*/, "") + "&id_category=" + $(this).val();
location.href = newURL+queryString; // hash part is dropped: window.location.hash
};
function addDefaultCategory(elem)
{
$('select#id_category_default').append('<option value="' + elem.val()+'">' + (elem.val() !=1 ? elem.parent().find('label').html() : home) + '</option>');
if ($('select#id_category_default option').length > 0)
{
$('select#id_category_default').closest('.form-group').show();
$('#no_default_category').hide();
}
}
{if isset($use_checkbox) && $use_checkbox == true}
function checkAllAssociatedCategories($tree)
{
$tree.find(':input[type=checkbox]').each(function(){
$(this).prop('checked', true);
addDefaultCategory($(this));
$(this).parent().addClass('tree-selected');
});
}
function uncheckAllAssociatedCategories($tree)
{
$tree.find(':input[type=checkbox]').each(function(){
$(this).prop('checked', false);
$('select#id_category_default option[value='+$(this).val()+']').remove();
if ($('select#id_category_default option').length == 0)
{
$('select#id_category_default').closest('.form-group').hide();
$('#no_default_category').show();
}
$(this).parent().removeClass('tree-selected');
});
}
{/if}
{if isset($use_search) && $use_search == true}
$('#{$id|escape:'html':'UTF-8'}-categories-search').bind('typeahead:selected', function(obj, datum){
var match = $('#{$id|escape:'html':'UTF-8'}').find(':input[value="'+datum.id_category+'"]').first();
if (match.length)
{
match.each(function(){
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents('ul.tree').each(function(){
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
addDefaultCategory($(this));
}
);
}
else
{
var selected = [];
that = this;
$('#{$id|escape:'html':'UTF-8'}').find('.tree-selected input').each(
function()
{
selected.push($(this).val());
}
);
{literal}
$.get(
'ajax-tab.php',
{controller:'AdminNormalProducts',token:currentToken,action:'getCategoryTree', fullTree:1, selected:selected},
function(content) {
{/literal}
$('#{$id|escape:'html':'UTF-8'}').html(content);
$('#{$id|escape:'html':'UTF-8'}').tree('init');
$('#{$id|escape:'html':'UTF-8'}').find(':input[value="'+datum.id_category+'"]').each(function(){
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents('ul.tree').each(function(){
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
full_loaded = true;
}
);
}
);
}
});
{/if}
function startTree() {
if (typeof $.fn.tree === 'undefined') {
setTimeout(startTree, 100);
return;
}
$('#{$id|escape:'html':'UTF-8'}').tree('collapseAll');
$('#{$id|escape:'html':'UTF-8'}').find(':input[type=radio]').click(treeClickFunc);
{if isset($selected_categories)}
$('#no_default_category').hide();
{assign var=imploded_selected_categories value='","'|implode:$selected_categories}
var selected_categories = new Array("{$imploded_selected_categories}");
if (selected_categories.length > 1)
$('#expand-all-{$id|escape:'html':'UTF-8'}').hide();
else
$('#collapse-all-{$id|escape:'html':'UTF-8'}').hide();
$('#{$id|escape:'html':'UTF-8'}').find(':input').each(function(){
if ($.inArray($(this).val(), selected_categories) != -1)
{
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents('ul.tree').each(function(){
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
}
});
{else}
$('#collapse-all-{$id|escape:'html':'UTF-8'}').hide();
{/if}
}
startTree();
</script>

View File

@@ -0,0 +1,25 @@
{*
* 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
*}
<div class="tree-panel-heading-controls clearfix">{if isset($toolbar)}{$toolbar}{/if}</div>

View File

@@ -0,0 +1,210 @@
{*
* 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
*}
<div class="panel">
{if isset($header)}{$header}{/if}
{if isset($nodes)}
<ul id="{$id|escape:'html':'UTF-8'}" class="cattree tree">
{$nodes}
</ul>
{/if}
</div>
<script type="text/javascript">
var currentToken="{$token|@addslashes}";
var treeClickFunc = function() {
var newURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
var queryString = window.location.search.replace(/&id_category=[0-9]*/, "") + "&id_category=" + $(this).val();
location.href = newURL+queryString; // hash part is dropped: window.location.hash
};
function addDefaultCategory(elem)
{
$('select#id_category_default').append('<option value="' + elem.val()+'">' + (elem.val() !=1 ? elem.parent().find('label').html() : home) + '</option>');
if ($('select#id_category_default option').length > 0)
{
$('select#id_category_default').closest('.form-group').show();
$('#no_default_category').hide();
}
}
{if isset($use_checkbox) && $use_checkbox == true}
function checkAllAssociatedCategories($tree)
{
$tree.find(':input[type=checkbox]').each(function(){
$(this).prop('checked', true);
addDefaultCategory($(this));
$(this).parent().addClass('tree-selected');
});
}
function uncheckAllAssociatedCategories($tree)
{
$tree.find(':input[type=checkbox]').each(function(){
$(this).prop('checked', false);
$('select#id_category_default option[value='+$(this).val()+']').remove();
if ($('select#id_category_default option').length == 0)
{
$('select#id_category_default').closest('.form-group').hide();
$('#no_default_category').show();
}
$(this).parent().removeClass('tree-selected');
});
}
function checkAllRoomTypeOfHotel(node)
{
$(node).find(':input[type=checkbox]').each(function(){
$(this).prop('checked', true);
$(this).parent().addClass('tree-selected');
});
}
function unCheckAllRoomTypeOfHotel(node)
{
$(node).find(':input[type=checkbox]').each(function(){
$(this).prop('checked', false);
$(this).parent().removeClass('tree-selected');
});
}
{/if}
$('#{$id|escape:'html':'UTF-8'}').find('.select_hotel').on('click', function(){
if ($(this).is(":checked")) {
checkAllRoomTypeOfHotel($(this).closest('li.tree-folder').find('ul.tree'));
} else {
unCheckAllRoomTypeOfHotel($(this).closest('li.tree-folder').find('ul.tree'));
}
});
$('#{$id|escape:'html':'UTF-8'}').find(':input[type=checkbox].select_room_type').on('change', function(){
var totalNodes = $(this).closest('ul.tree').find('li.tree-item');
var checkedNodes = $(this).closest('ul.tree').find('li.tree-item :input[type=checkbox].select_room_type:checked');
if (totalNodes.length == checkedNodes.length) {
$(this).closest('li.tree-folder').find(':input[type=checkbox].select_hotel').prop('checked', true).parent().addClass('tree-selected');
} else {
$(this).closest('li.tree-folder').find(':input[type=checkbox].select_hotel').prop('checked', false).parent().removeClass('tree-selected');
}
});
{if isset($use_search) && $use_search == true}
$('#{$id|escape:'html':'UTF-8'}-categories-search').bind('typeahead:selected', function(obj, datum){
var match = $('#{$id|escape:'html':'UTF-8'}').find(':input[value="'+datum.id_category+'"]').first();
if (match.length)
{
match.each(function(){
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents('ul.tree').each(function(){
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
addDefaultCategory($(this));
}
);
}
else
{
var selected = [];
that = this;
$('#{$id|escape:'html':'UTF-8'}').find('.tree-selected input').each(
function()
{
selected.push($(this).val());
}
);
{literal}
$.get(
'ajax-tab.php',
{controller:'AdminNormalProducts',token:currentToken,action:'getCategoryTree', fullTree:1, selected:selected},
function(content) {
{/literal}
$('#{$id|escape:'html':'UTF-8'}').html(content);
$('#{$id|escape:'html':'UTF-8'}').tree('init');
$('#{$id|escape:'html':'UTF-8'}').find(':input[value="'+datum.id_category+'"]').each(function(){
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents('ul.tree').each(function(){
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
full_loaded = true;
}
);
}
);
}
});
{/if}
function startTree() {
if (typeof $.fn.tree === 'undefined') {
setTimeout(startTree, 100);
return;
}
$('#{$id|escape:'html':'UTF-8'}').tree('expandAll');
$('#expand-all-{$id|escape:'html':'UTF-8'}').hide();
$('#{$id|escape:'html':'UTF-8'}').find(':input[type=radio]').click(treeClickFunc);
{if isset($selected_hotels)}
$('#no_default_category').hide();
{assign var=imploded_selected_hotels value='","'|implode:$selected_hotels}
var selected_hotels = new Array("{$imploded_selected_hotels}");
$('#{$id|escape:'html':'UTF-8'}').find(':input.select_hotel').each(function(){
if ($.inArray($(this).val(), selected_hotels) != -1)
{
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents('ul.tree').each(function(){
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
}
});
{/if}
{if isset($selected_roomtypes)}
$('#no_default_category').hide();
{assign var=imploded_selected_hotels value='","'|implode:$selected_roomtypes}
var selected_roomtypes = new Array("{$imploded_selected_hotels}");
$('#{$id|escape:'html':'UTF-8'}').find(':input.select_room_type').each(function(){
if ($.inArray($(this).val(), selected_roomtypes) != -1)
{
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents('ul.tree').each(function(){
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
}
});
{/if}
}
startTree();
</script>

View File

@@ -0,0 +1,127 @@
{*
* 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
*}
<div class="panel">
{if isset($header)}{$header}{/if}
<div id="block_category_tree"{if !$is_category_filter} style="display:none"{/if}>
{if isset($nodes)}
<ul id="{$id|escape:'html':'UTF-8'}" class="cattree tree">
{$nodes}
</ul>
{/if}
</div>
</div>
<script type="text/javascript">
var currentToken="{$token|@addslashes}";
var treeClickFunc = function() {
var newURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
var queryString = window.location.search.replace(/&id_category=[0-9]*/, "") + "&id_category=" + $(this).val();
location.href = newURL+queryString; // hash part is dropped: window.location.hash
};
{if isset($use_checkbox) && $use_checkbox == true}
function checkAllAssociatedCategories($tree)
{
$tree.find(":input[type=checkbox]").each(
function()
{
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
}
);
}
function uncheckAllAssociatedCategories($tree)
{
$tree.find(":input[type=checkbox]").each(
function()
{
$(this).prop("checked", false);
$(this).parent().removeClass("tree-selected");
}
);
}
{/if}
{if isset($use_search) && $use_search == true}
$("#{$id|escape:'html':'UTF-8'}-categories-search").bind("typeahead:selected", function(obj, datum) {
$("#{$id|escape:'html':'UTF-8'}").find(":input").each(
function()
{
if ($(this).val() == datum.id_category)
{
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents("ul.tree").each(
function()
{
$(this).children().children().children(".icon-folder-close")
.removeClass("icon-folder-close")
.addClass("icon-folder-open");
$(this).show();
}
);
}
}
);
});
{/if}
$(document).ready(function () {
var tree = $("#{$id|escape:'html':'UTF-8'}").tree("collapseAll");
tree.on('collapse', function() {
$('#expand-all-{$id|escape:'html':'UTF-8'}').show();
});
tree.on('expand', function() {
$('#collapse-all-{$id|escape:'html':'UTF-8'}').show();
});
$('#collapse-all-{$id|escape:'html':'UTF-8'}').hide();
$("#{$id|escape:'html':'UTF-8'}").find(":input[type=radio]").click(treeClickFunc);
{if isset($selected_categories)}
{assign var=imploded_selected_categories value='","'|implode:$selected_categories}
var selected_categories = new Array("{$imploded_selected_categories}");
$("#{$id|escape:'html':'UTF-8'}").find(":input").each(
function()
{
if ($.inArray($(this).val(), selected_categories) != -1)
{
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents("ul.tree").each(
function()
{
$(this).children().children().children(".icon-folder-close")
.removeClass("icon-folder-close")
.addClass("icon-folder-open");
$(this).show();
}
);
}
}
);
{/if}
});
</script>

View File

@@ -0,0 +1,50 @@
{*
* 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
*}
<script type="text/javascript">
$(document).ready(function(){
$('#filter-by-category').click(function() {
if ($(this).is(':checked')) {
$('#block_category_tree').show();
$('#category-tree-toolbar').show();
} else {
$('#block_category_tree').hide();
$('#category-tree-toolbar').hide();
location.href = '{$base_url}&reset_filter_category=1';
}
});
});
</script>
<div class="tree-panel-heading-controls clearfix">
<div id="category-tree-toolbar" {if !$is_category_filter}style="display:none;"{/if}>
{if isset($toolbar)}{$toolbar}{/if}
</div>
<label class="tree-panel-label-title">
<input type="checkbox" id="filter-by-category" name="filter-by-category" {if $is_category_filter}checked="checked"{/if} />
<i class="icon-tags"></i>
{$title}
</label>
</div>

View File

@@ -0,0 +1,31 @@
{*
* 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
*}
<div class="tree-actions pull-right">
{if isset($actions)}
{foreach from=$actions item=action}
{$action->render()}
{/foreach}
{/if}
</div>

View File

@@ -0,0 +1,193 @@
{*
* 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
*}
<div class="form-group">
<div class="col-lg-12">
<input id="{$id|escape:'html':'UTF-8'}" type="file" name="{$name|escape:'html':'UTF-8'}[]"{if isset($url)} data-url="{$url}"{/if}{if isset($multiple) && $multiple} multiple="multiple"{/if} style="width:0px;height:0px;" />
<button class="btn btn-default" data-style="expand-right" data-size="s" type="button" id="{$id|escape:'html':'UTF-8'}-add-button">
<i class="icon-folder-open"></i> {if isset($multiple) && $multiple}{l s='Add files...'}{else}{l s='Add file...'}{/if}
</button>
</div>
</div>
<div class="well" style="display:none">
<div id="{$id|escape:'html':'UTF-8'}-files-list"></div>
<button class="ladda-button btn btn-primary" data-style="expand-right" type="button" id="{$id|escape:'html':'UTF-8'}-upload-button" style="display:none;">
<span class="ladda-label"><i class="icon-check"></i> {if isset($multiple) && $multiple}{l s='Upload files'}{else}{l s='Upload file'}{/if}</span>
</button>
</div>
<div class="row" style="display:none">
<div class="alert alert-success" id="{$id|escape:'html':'UTF-8'}-success"></div>
</div>
<div class="row" style="display:none">
<div class="alert alert-danger" id="{$id|escape:'html':'UTF-8'}-errors"></div>
</div>
<script type="text/javascript">
function humanizeSize(bytes)
{
if (typeof bytes !== 'number') {
return '';
}
if (bytes >= 1000000000) {
return (bytes / 1000000000).toFixed(2) + ' GB';
}
if (bytes >= 1000000) {
return (bytes / 1000000).toFixed(2) + ' MB';
}
return (bytes / 1000).toFixed(2) + ' KB';
}
$( document ).ready(function() {
{if isset($multiple) && isset($max_files)}
var {$id|escape:'html':'UTF-8'}_max_files = {$max_files - $files|count};
{/if}
{if isset($files) && $files}
$('#{$id|escape:'html':'UTF-8'}-images-thumbnails').parent().show();
{/if}
var {$id|escape:'html':'UTF-8'}_upload_button = Ladda.create( document.querySelector('#{$id|escape:'html':'UTF-8'}-upload-button' ));
var {$id|escape:'html':'UTF-8'}_total_files = 0;
$('#{$id|escape:'html':'UTF-8'}').fileupload({
dataType: 'json',
async: false,
autoUpload: false,
singleFileUploads: true,
maxFileSize: {$post_max_size},
start: function (e) {
{$id|escape:'html':'UTF-8'}_upload_button.start();
$('#{$id|escape:'html':'UTF-8'}-upload-button').unbind('click'); //Important as we bind it for every elements in add function
},
fail: function (e, data) {
$('#{$id|escape:'html':'UTF-8'}-errors').html(data.errorThrown.message).parent().show();
$('#{$id|escape:'html':'UTF-8'}-files-list').html('').parent().hide();
},
done: function (e, data) {
if (data.result) {
if (typeof data.result.{$name|escape:'html':'UTF-8'} !== 'undefined') {
for (var i=0; i<data.result.{$name|escape:'html':'UTF-8'}.length; i++) {
if (typeof data.result.{$name|escape:'html':'UTF-8'}[i].error !== 'undefined' && data.result.{$name|escape:'html':'UTF-8'}[i].error != '') {
$('#{$id|escape:'html':'UTF-8'}-errors').html('<strong>'+data.result.{$name|escape:'html':'UTF-8'}[i].name+'</strong> : '+data.result.{$name|escape:'html':'UTF-8'}[i].error).parent().show();
$('#{$id|escape:'html':'UTF-8'}-files-list').html('').parent().hide();
}
else
{
$(data.context).appendTo($('#{$id|escape:'html':'UTF-8'}-success'));
$('#{$id|escape:'html':'UTF-8'}-success').parent().show();
if (data.result.{$name|escape:'html':'UTF-8'}[i] !== null && data.result.{$name|escape:'html':'UTF-8'}[i].status == 'ok')
{
var response = data.result.{$name|escape:'html':'UTF-8'}[i];
var cover = "icon-check-empty";
var legend = '';
if (response.cover == "1")
cover = "icon-check-sign";
if (typeof response.legend !== 'undefined' && response.legend != null)
legend = response.legend[{$default_language|intval}];
imageLine(response.id, response.path, response.position, cover, response.shops, legend);
$("#countImage").html(parseInt($("#countImage").html()) + 1);
$("#img" + id).remove();
$("#imageTable").tableDnDUpdate();
}
}
}
}
$(data.context).find('button').remove();
}
},
}).on('fileuploadalways', function (e, data) {
{$id|escape:'html':'UTF-8'}_total_files--;
if ({$id|escape:'html':'UTF-8'}_total_files == 0)
{
{$id|escape:'html':'UTF-8'}_upload_button.stop();
$('#{$id|escape:'html':'UTF-8'}-upload-button').unbind('click');
$('#{$id|escape:'html':'UTF-8'}-files-list').parent().hide();
}
}).on('fileuploadadd', function(e, data) {
if (typeof {$id|escape:'html':'UTF-8'}_max_files !== 'undefined') {
if ({$id|escape:'html':'UTF-8'}_total_files >= {$id|escape:'html':'UTF-8'}_max_files) {
e.preventDefault();
alert('{l s='You can upload a maximum of %s files'|sprintf:$max_files}');
return;
}
}
data.context = $('<div/>').addClass('form-group').appendTo($('#{$id|escape:'html':'UTF-8'}-files-list'));
var file_name = $('<span/>').append('<i class="icon-picture-o"></i> <strong>'+data.files[0].name+'</strong> ('+humanizeSize(data.files[0].size)+')').appendTo(data.context);
var button = $('<button/>').addClass('btn btn-default pull-right').prop('type', 'button').html('<i class="icon-trash"></i> {l s='Remove file'}').appendTo(data.context).on('click', function() {
{$id|escape:'html':'UTF-8'}_total_files--;
data.files = null;
var total_elements = $(this).parent().siblings('div.form-group').length;
$(this).parent().remove();
if (total_elements == 0) {
$('#{$id|escape:'html':'UTF-8'}-files-list').html('').parent().hide();
}
});
$('#{$id|escape:'html':'UTF-8'}-files-list').parent().show();
$('#{$id|escape:'html':'UTF-8'}-upload-button').show().bind('click', function () {
if (data.files != null)
data.submit();
});
{$id|escape:'html':'UTF-8'}_total_files++;
}).on('fileuploadprocessalways', function (e, data) {
var index = data.index, file = data.files[index];
if (file.error) {
$('#{$id|escape:'html':'UTF-8'}-errors').append('<div class="form-group"><i class="icon-picture-o"></i> <strong>'+file.name+'</strong> ('+humanizeSize(file.size)+') : '+file.error+'</div>').parent().show();
$('#{$id|escape:'html':'UTF-8'}-files-list').html('').parent().hide();
$(data.context).find('button').trigger('click');
}
}).on('fileuploadsubmit', function (e, data) {
var params = new Object();
$('input[id^="legend_"]').each(function()
{
id = $(this).prop("id").replace("legend_", "legend[") + "]";
params[id] = $(this).val();
});
data.formData = params;
});
$('#{$id|escape:'html':'UTF-8'}-add-button').on('click', function() {
$('#{$id|escape:'html':'UTF-8'}-success').html('').parent().hide();
$('#{$id|escape:'html':'UTF-8'}-errors').html('').parent().hide();
$('#{$id|escape:'html':'UTF-8'}').trigger('click');
});
});
</script>

View File

@@ -0,0 +1,119 @@
{*
* 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
*}
<div class="col-lg-8">
<input id="{$id|escape:'html':'UTF-8'}" type="file" name="{$name|escape:'html':'UTF-8'}"{if isset($url)} data-url="{$url|escape:'html':'UTF-8'}"{/if} class="hide" />
<button class="btn btn-default" data-style="expand-right" data-size="s" type="button" id="{$id|escape:'html':'UTF-8'}-add-button">
<i class="icon-plus-sign"></i> {l s='Add file'}
</button>
<!--
<div class="alert alert-success" id="{$id|escape:'html':'UTF-8'}-success" style="display:none">{l s='Upload successful'}</div>
<div class="alert alert-danger" id="{$id|escape:'html':'UTF-8'}-errors" style="display:none"></div>
-->
</div>
<script type="text/javascript">
function humanizeSize(bytes)
{
if (typeof bytes !== 'number') {
return '';
}
if (bytes >= 1000000000) {
return (bytes / 1000000000).toFixed(2) + ' GB';
}
if (bytes >= 1000000) {
return (bytes / 1000000).toFixed(2) + ' MB';
}
return (bytes / 1000).toFixed(2) + ' KB';
}
$( document ).ready(function() {
var {$id|escape:'html':'UTF-8'}_add_button = Ladda.create( document.querySelector('#{$id|escape:'html':'UTF-8'}-add-button' ));
var {$id|escape:'html':'UTF-8'}_total_files = 0;
var success_message = '{l s='Upload successful' js=1}';
$('#{$id|escape:'html':'UTF-8'}').fileupload({
dataType: 'json',
autoUpload: true,
singleFileUploads: true,
maxFileSize: {$post_max_size},
success: function (e) {
//showSuccessMessage(success_message);
},
start: function (e) {
{$id|escape:'html':'UTF-8'}_add_button.start();
},
fail: function (e, data) {
showErrorMessage(data.errorThrown.message);
},
done: function (e, data) {
if (data.result) {
if (typeof data.result.attachment_file !== 'undefined') {
if (typeof data.result.attachment_file.error !== 'undefined' && data.result.attachment_file.error.length > 0)
$.each(data.result.attachment_file.error, function(index, error) {
showErrorMessage(data.result.attachment_file.name + ' : ' + error);
});
else {
showSuccessMessage(success_message);
$('#selectAttachment2').append('<option value="'+data.result.attachment_file.id_attachment+'">'+data.result.attachment_file.filename+'</option>');
}
}
}
},
}).on('fileuploadalways', function (e, data) {
{$id|escape:'html':'UTF-8'}_add_button.stop();
}).on('fileuploadprocessalways', function (e, data) {
var index = data.index, file = data.files[index];
//if (file.error)
//$('#{$id|escape:'html':'UTF-8'}-errors').append('<div class="row"><strong>'+file.name+'</strong> ('+humanizeSize(file.size)+') : '+file.error+'</div>').show();
}).on('fileuploadsubmit', function (e, data) {
var params = new Object();
$('input[id^="attachment_name_"]').each(function()
{
id = $(this).prop("id").replace("attachment_name_", "attachment_name[") + "]";
params[id] = $(this).val();
});
$('textarea[id^="attachment_description_"]').each(function()
{
id = $(this).prop("id").replace("attachment_description_", "attachment_description[") + "]";
params[id] = $(this).val();
});
data.formData = params;
});
$('#{$id|escape:'html':'UTF-8'}-add-button').on('click', function() {
//$('#{$id|escape:'html':'UTF-8'}-success').hide();
//$('#{$id|escape:'html':'UTF-8'}-errors').html('').hide();
{$id|escape:'html':'UTF-8'}_total_files = 0;
$('#{$id|escape:'html':'UTF-8'}').trigger('click');
});
});
</script>

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/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 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/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../../../../');
exit;

View File

@@ -0,0 +1,142 @@
{*
* 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($files) && $files|count > 0}
{assign var='show_thumbnail' value=false}
{foreach $files as $file}
{if isset($file.image) && $file.type == 'image'}
{assign var='show_thumbnail' value=true}
{/if}
{/foreach}
{if $show_thumbnail}
<div class="form-group">
<div class="col-lg-12" id="{$id|escape:'html':'UTF-8'}-images-thumbnails">
{foreach $files as $file}
{if isset($file.image) && $file.type == 'image'}
<div class="img-thumbnail text-center">
<p>{$file.image}</p>
{if isset($file.size)}<p>{l s='File size'} {$file.size}kb</p>{/if}
{if isset($file.delete_url)}
<p>
<a class="btn btn-default" href="{$file.delete_url}">
<i class="icon-trash"></i> {l s='Delete'}
</a>
</p>
{/if}
</div>
{/if}
{/foreach}
</div>
</div>
{/if}
{/if}
{if isset($max_files) && $files|count >= $max_files}
<div class="row">
<div class="alert alert-warning">{l s='You have reached the limit (%s) of files to upload, please remove files to continue uploading' sprintf=$max_files}</div>
</div>
{else}
<div class="form-group">
<div class="col-lg-12">
<input id="{$id|escape:'html':'UTF-8'}" type="file" name="{$name|escape:'html':'UTF-8'}"{if isset($multiple) && $multiple} multiple="multiple"{/if} class="hide"/>
<div class="dummyfile input-group">
<span class="input-group-addon"><i class="icon-file"></i></span>
<input id="{$id|escape:'html':'UTF-8'}-name" type="text" name="filename" readonly />
<span class="input-group-btn">
<button id="{$id|escape:'html':'UTF-8'}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
<i class="icon-folder-open"></i> {if isset($multiple) && $multiple}{l s='Add files'}{else}{l s='Add file'}{/if}
</button>
{if (!isset($multiple) || !$multiple) && isset($files) && $files|count == 1 && isset($files[0].download_url)}
<a href="{$files[0].download_url|escape:'html':'UTF-8'}" class="btn btn-default">
<i class="icon-cloud-download"></i>
{if isset($size)}{l s='Download current file (%skb)' sprintf=$size}{else}{l s='Download current file'}{/if}
</a>
{/if}
</span>
</div>
</div>
</div>
<script type="text/javascript">
{if isset($multiple) && isset($max_files)}
var {$id|escape:'html':'UTF-8'}_max_files = {$max_files - $files|count};
{/if}
$(document).ready(function(){
$('#{$id|escape:'html':'UTF-8'}-selectbutton').click(function(e) {
$('#{$id|escape:'html':'UTF-8'}').trigger('click');
});
$('#{$id|escape:'html':'UTF-8'}-name').click(function(e) {
$('#{$id|escape:'html':'UTF-8'}').trigger('click');
});
$('#{$id|escape:'html':'UTF-8'}-name').on('dragenter', function(e) {
e.stopPropagation();
e.preventDefault();
});
$('#{$id|escape:'html':'UTF-8'}-name').on('dragover', function(e) {
e.stopPropagation();
e.preventDefault();
});
$('#{$id|escape:'html':'UTF-8'}-name').on('drop', function(e) {
e.preventDefault();
var files = e.originalEvent.dataTransfer.files;
$('#{$id|escape:'html':'UTF-8'}')[0].files = files;
$(this).val(files[0].name);
});
$('#{$id|escape:'html':'UTF-8'}').change(function(e) {
if ($(this)[0].files !== undefined)
{
var files = $(this)[0].files;
var name = '';
$.each(files, function(index, value) {
name += value.name+', ';
});
$('#{$id|escape:'html':'UTF-8'}-name').val(name.slice(0, -2));
$('#virtual_product_name').val(name.slice(0, -2));
}
else // Internet Explorer 9 Compatibility
{
var name = $(this).val().split(/[\\/]/);
$('#{$id|escape:'html':'UTF-8'}-name').val(name[name.length-1]);
$('#virtual_product_name').val(name[name.length-1]);
}
});
if (typeof {$id|escape:'html':'UTF-8'}_max_files !== 'undefined')
{
$('#{$id|escape:'html':'UTF-8'}').closest('form').on('submit', function(e) {
if ($('#{$id|escape:'html':'UTF-8'}')[0].files.length > {$id|escape:'html':'UTF-8'}_max_files) {
e.preventDefault();
alert('{l s='You can upload a maximum of %s files'|sprintf:$max_files}');
}
});
}
});
</script>
{/if}

View File

@@ -0,0 +1,356 @@
{*
* 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($id_product) && isset($product)}
<div id="product-images" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Images" />
<div class="panel-heading tab" >
{l s='Images'}
<span class="badge" id="countImage">{$countImages}</span>
</div>
<div class="row">
<div class="form-group">
<label class="control-label col-lg-3 file_upload_label">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Format:'} JPG, GIF, PNG. {l s='Filesize:'} {$max_image_size|string_format:"%.2f"} {l s='MB max.'}">
{if isset($id_image)}{l s='Edit this product\'s image:'}{else}{l s='Add a new image to this product'}{/if}
</span>
</label>
<div class="col-lg-9">
{$image_uploader}
</div>
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block">{l s='Please upload a square image (Recommended resolution 800 x 800px)'}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Update all captions at once, or select the position of the image whose caption you wish to edit. Invalid characters: %s' sprintf=['<>;=#{}']}">
{l s='Caption'}
</span>
</label>
<div class="col-lg-4">
{foreach from=$languages item=language}
{if $languages|count > 1}
<div class="translatable-field row lang-{$language.id_lang}">
<div class="col-lg-8">
{/if}
<input type="text" id="legend_{$language.id_lang}"{if isset($input_class)} class="{$input_class}"{/if} name="legend_{$language.id_lang}" value="{if $images|count}{$images[0]->legend[$language.id_lang]|escape:'html':'UTF-8'}{else}{$product->name[$language.id_lang]|escape:'html':'UTF-8'}{/if}"{if !$product->id} disabled="disabled"{/if}/>
{if $languages|count > 1}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
{$language.iso_code}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=language}
<li>
<a href="javascript:hideOtherLanguage({$language.id_lang});">{$language.name}</a>
</li>
{/foreach}
</ul>
</div>
</div>
{/if}
{/foreach}
</div>
<div class="col-lg-2{if $images|count <= 1} hidden{/if}" id="caption_selection">
<select name="id_caption">
<option value="0">{l s='All captions'}</option>
{foreach from=$images item=image}
<option value="{$image->id_image|intval}">
{l s='Position %d' sprintf=$image->position|intval}
</option>
{/foreach}
</select>
</div>
<div class="col-lg-2">
<button type="submit" class="btn btn-default" name="submitAddproductAndStay" value="update_legends"><i class="icon-random"></i> {l s='Update'}</button>
</div>
</div>
</div>
<table class="table tableDnD" id="imageTable">
<thead>
<tr class="nodrag nodrop">
<th class="fixed-width-lg"><span class="title_box">{l s='Image'}</span></th>
<th class="fixed-width-lg"><span class="title_box">{l s='Caption'}</span></th>
<th class="fixed-width-xs"><span class="title_box">{l s='Position'}</span></th>
{if $shops}
{foreach from=$shops item=shop}
<th class="fixed-width-xs"><span class="title_box">{$shop.name}</span></th>
{/foreach}
{/if}
<th class="fixed-width-xs"><span class="title_box">{l s='Cover'}</span></th>
<th></th> <!-- action -->
</tr>
</thead>
<tbody id="imageList">
</tbody>
</table>
<table id="lineType" style="display:none;">
<tr id="image_id">
<td>
<a href="{$link->getMediaLink("`$smarty.const._THEME_PROD_DIR_`image_path.jpg")}" class="fancybox"> {* by webkul to get media link *}
<img
src="{$link->getMediaLink("`$smarty.const._THEME_PROD_DIR_`$iso_lang-default-`$imageType`.jpg")}"
alt="legend"
title="legend"
class="img-thumbnail" />
</a>
</td>
<td>legend</td>
<td id="td_image_id" class="pointer dragHandle center positionImage">
<div class="dragGroup">
<div class="positions">
image_position
</div>
</div>
</td>
{if $shops}
{foreach from=$shops item=shop}
<td>
<input
type="checkbox"
class="image_shop"
name="id_image"
id="{$shop.id_shop}image_id"
value="{$shop.id_shop}" />
</td>
{/foreach}
{/if}
<td class="cover">
<a href="#">
<i class="icon-check-empty icon-2x covered"></i>
</a>
</td>
<td>
<a href="#" class="delete_product_image pull-right btn btn-default" >
<i class="icon-trash"></i> {l s='Delete this image'}
</a>
</td>
</tr>
</table>
<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>
<script type="text/javascript">
var upbutton = '{l s='Upload an image'}';
var come_from = '{$table}';
var success_add = '{l s='The image has been successfully added.'}';
var id_tmp = 0;
var current_shop_id = {$current_shop_id|intval};
{literal}
//Ready Function
function imageLine(id, path, position, cover, shops, legend)
{
line = $("#lineType").html();
line = line.replace(/image_id/g, id);
line = line.replace(/(\/)?[a-z]{0,2}-default/g, function($0, $1){
return $1 ? $1 + path : $0;
});
line = line.replace(/image_path/g, path);
line = line.replace(/\.jpg"\s/g, '.jpg?time=' + new Date().getTime() + '" ');
line = line.replace(/image_position/g, position);
line = line.replace(/legend/g, legend);
line = line.replace(/icon-check-empty/g, cover);
line = line.replace(/<tbody>/gi, "");
line = line.replace(/<\/tbody>/gi, "");
if (shops != false)
{
$.each(shops, function(key, value){
if (value == 1)
line = line.replace('id="' + key + '' + id + '"','id="' + key + '' + id + '" checked=checked');
});
}
$("#imageList").append(line);
}
$(document).ready(function(){
{/literal}
{foreach from=$images item=image}
assoc = {literal}"{"{/literal};
{if $shops}
{foreach from=$shops item=shop}
assoc += '"{$shop.id_shop}" : {if $image->isAssociatedToShop($shop.id_shop)}1{else}0{/if},';
{/foreach}
{/if}
if (assoc != {literal}"{"{/literal})
{
assoc = assoc.slice(0, -1);
assoc += {literal}"}"{/literal};
assoc = jQuery.parseJSON(assoc);
}
else
assoc = false;
imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}icon-check-sign{else}icon-check-empty{/if}", assoc, "{$image->legend[$default_language]|escape:'htmlall'}");
{/foreach}
{literal}
var originalOrder = false;
$("#imageTable").tableDnD(
{ dragHandle: 'dragHandle',
onDragClass: 'myDragClass',
onDragStart: function(table, row) {
originalOrder = $.tableDnD.serialize();
reOrder = ':even';
if (table.tBodies[0].rows[1] && $('#' + table.tBodies[0].rows[1].id).hasClass('alt_row'))
reOrder = ':odd';
$(table).find('#' + row.id).parent('tr').addClass('myDragClass');
},
onDrop: function(table, row) {
if (originalOrder != $.tableDnD.serialize()) {
current = $(row).attr("id");
stop = false;
image_up = "{";
$("#imageList").find("tr").each(function(i) {
$("#td_" + $(this).attr("id")).html('<div class="dragGroup"><div class="positions">'+(i + 1)+'</div></div>');
if (!stop || (i + 1) == 2)
image_up += '"' + $(this).attr("id") + '" : ' + (i + 1) + ',';
});
image_up = image_up.slice(0, -1);
image_up += "}";
updateImagePosition(image_up);
}
}
});
/**
* on success function
*/
function afterDeleteProductImage(data)
{
data = $.parseJSON(data);
if (data)
{
cover = 0;
id = data.content.id;
if (data.status == 'ok')
{
if ($("#" + id + ' .covered').hasClass('icon-check-sign'))
cover = 1;
$("#" + id).remove();
}
if (cover)
$("#imageTable tr").eq(1).find(".covered").addClass('icon-check-sign');
$("#countImage").html(parseInt($("#countImage").html()) - 1);
refreshImagePositions($("#imageTable"));
showSuccessMessage(data.confirmations);
if (parseInt($("#countImage").html()) <= 1)
$('#caption_selection').addClass('hidden');
}
}
$('.delete_product_image').die().live('click', function(e)
{
e.preventDefault();
id = $(this).parent().parent().attr('id');
if (confirm("{/literal}{l s='Delete selected item?' js=1}{literal}"))
doAdminAjax({
"action":"deleteProductImage",
"id_image":id,
"id_product" : {/literal}{$id_product}{literal},
"id_category" : {/literal}{$id_category_default}{literal},
"token" : "{/literal}{$token|escape:'html':'UTF-8'}{literal}",
"tab" : "AdminNormalProducts",
"ajax" : 1 }, afterDeleteProductImage
);
});
$('.covered').die().live('click', function(e)
{
e.preventDefault();
id = $(this).parent().parent().parent().attr('id');
$("#imageList .cover i").each( function(i){
$(this).removeClass('icon-check-sign').addClass('icon-check-empty');
});
$(this).removeClass('icon-check-empty').addClass('icon-check-sign');
if (current_shop_id != 0)
$('#' + current_shop_id + id).attr('check', true);
else
$(this).parent().parent().parent().children('td input').attr('check', true);
doAdminAjax({
"action":"UpdateCover",
"id_image":id,
"id_product" : {/literal}{$id_product}{literal},
"token" : "{/literal}{$token|escape:'html':'UTF-8'}{literal}",
"controller" : "AdminNormalProducts",
"ajax" : 1 }
);
});
$('.image_shop').die().live('click', function()
{
active = false;
if ($(this).attr("checked"))
active = true;
id = $(this).parent().parent().attr('id');
id_shop = $(this).attr("id").replace(id, "");
doAdminAjax(
{
"action":"UpdateProductImageShopAsso",
"id_image":id,
"id_product":id_product,
"id_shop": id_shop,
"active":active,
"token" : "{/literal}{$token|escape:'html':'UTF-8'}{literal}",
"tab" : "AdminNormalProducts",
"ajax" : 1
});
});
function updateImagePosition(json)
{
doAdminAjax(
{
"action":"updateImagePosition",
"json":json,
"token" : "{/literal}{$token|escape:'html':'UTF-8'}{literal}",
"tab" : "AdminNormalProducts",
"ajax" : 1
});
}
function delQueue(id)
{
$("#img" + id).fadeOut("slow");
$("#img" + id).remove();
}
$('.fancybox').fancybox();
});
if (tabs_manager.allow_hide_other_languages)
hideOtherLanguage(default_language);
{/literal}
</script>
</div>
{/if}

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/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 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/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../../');
exit;

View File

@@ -0,0 +1,590 @@
{*
* 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 $check_product_association_ajax}
{assign var=class_input_ajax value='check_product_name '}
{else}
{assign var=class_input_ajax value=''}
{/if}
<div id="product-informations" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Informations" />
<h3 class="tab"> <i class="icon-info"></i> {l s='Information'}</h3>
<script type="text/javascript">
var msg_select_one = "{l s='Please select at least one room type.' js=1}";
var msg_set_quantity = "{l s='Please set a quantity to add a room type.' js=1}";
{if isset($ps_force_friendly_product) && $ps_force_friendly_product}
var ps_force_friendly_product = 1;
{else}
var ps_force_friendly_product = 0;
{/if}
{if isset($PS_ALLOW_ACCENTED_CHARS_URL) && $PS_ALLOW_ACCENTED_CHARS_URL}
var PS_ALLOW_ACCENTED_CHARS_URL = 1;
{else}
var PS_ALLOW_ACCENTED_CHARS_URL = 0;
{/if}
{$combinationImagesJs}
{if $check_product_association_ajax}
var search_term = '';
$('document').ready( function() {
$(".check_product_name")
.autocomplete(
'{$link->getAdminLink('AdminNormalProducts', true)|addslashes}', {
minChars: 3,
max: 10,
width: $(".check_product_name").width(),
selectFirst: false,
scroll: false,
dataType: "json",
formatItem: function(data, i, max, value, term) {
search_term = term;
// adding the little
if ($('.ac_results').find('.separation').length == 0)
$('.ac_results').css('background-color', '#EFEFEF')
.prepend('<div style="color:#585A69; padding:2px 5px">{l s='Use a product from the list'}<div class="separation"></div></div>');
return value;
},
parse: function(data) {
var mytab = new Array();
for (var i = 0; i < data.length; i++)
mytab[mytab.length] = { data: data[i], value: data[i].name };
return mytab;
},
extraParams: {
ajax: 1,
action: 'checkProductName',
id_lang: {$id_lang}
}
}
)
.result(function(event, data, formatted) {
// keep the searched term in the input
$('#name_{$id_lang}').val(search_term);
jConfirm('{l s='Do you want to use this product?'}&nbsp;<strong>'+data.name+'</strong>', '{l s='Confirmation'}', function(confirm){
if (confirm == true)
document.location.href = '{$link->getAdminLink('AdminNormalProducts', true)}&updateproduct&id_product='+data.id_product;
else
return false;
});
});
});
{/if}
</script>
{if isset($display_common_field) && $display_common_field}
<div class="alert alert-warning" style="display: block">{l s='Warning, if you change the value of fields with an orange bullet %s, the value will be changed for all other shops for this product' sprintf=$bullet_common_field}</div>
{/if}
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Informations"}
<div id="product-pack-container" {if $product_type != Product::PTYPE_PACK}style="display:none"{/if}></div>
{*<hr />*}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="name" type="default" multilang="true"}</span></div>
<label class="control-label col-lg-2 required" id="name" for="name_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Write the name of the Product for ex. water bottle, etc.'} {l s='Invalid characters:'} &lt;&gt;;=#{}">
{l s='Name'}
</span>
</label>
<div class="col-lg-5">
{include file="controllers/products/input_text_lang.tpl"
languages=$languages
input_class="{$class_input_ajax}{if !$product->id || Configuration::get('PS_FORCE_FRIENDLY_PRODUCT')}copy2friendlyUrl{/if} updateCurrentText"
input_value=$product->name
input_name="name"
required=true
}
</div>
</div>
<div class="form-group hidden">
<label class="control-label col-lg-3" for="reference">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Your internal reference code for this product.'} {l s='Allowed special characters:'} .-_#\">
{$bullet_common_field} {l s='Reference code'}
</span>
</label>
<div class="col-lg-5">
<input type="text" id="reference" name="reference" value="{$product->reference|htmlentitiesUTF8}" />
</div>
</div>
<div class="form-group hidden">
<label class="control-label col-lg-3" for="ean13">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='This type of product code is specific to Europe and Japan, but is widely used internationally. It is a superset of the UPC code: all products marked with an EAN will be accepted in North America.'}">
{$bullet_common_field} {l s='EAN-13 or JAN barcode'}
</span>
</label>
<div class="col-lg-3">
<input maxlength="13" type="text" id="ean13" name="ean13" value="{$product->ean13|htmlentitiesUTF8}" />
</div>
</div>
<div class="form-group hidden">
<label class="control-label col-lg-3" for="upc">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='This type of product code is widely used in the United States, Canada, the United Kingdom, Australia, New Zealand and in other countries.'}">
{$bullet_common_field} {l s='UPC barcode'}
</span>
</label>
<div class="col-lg-3">
<input maxlength="12" type="text" id="upc" name="upc" value="{$product->upc|escape:'html':'UTF-8'}" />
</div>
</div>
<!-- <hr/> -->
{* status informations *}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="active" type="radio" onclick=""}</span></div>
<label class="control-label col-lg-2">
{l s='Enabled'}
</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input onclick="toggleDraftWarning(false);showOptions(true);showRedirectProductOptions(false);" type="radio" name="active" id="active_on" value="1" {if $product->active || !$product->isAssociatedToShop()}checked="checked" {/if} />
<label for="active_on" class="radioCheck">
{l s='Yes'}
</label>
<input onclick="toggleDraftWarning(true);showOptions(false);showRedirectProductOptions(true);" type="radio" name="active" id="active_off" value="0" {if !$product->active && $product->isAssociatedToShop()}checked="checked"{/if} />
<label for="active_off" class="radioCheck">
{l s='No'}
</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="form-group redirect_product_options" style="display:none">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="redirect_type" type="radio" onclick=""}</span></div>
<label class="control-label col-lg-2" for="redirect_type">
{l s='Redirect when disabled'}
</label>
<div class="col-lg-5">
<select name="redirect_type" id="redirect_type">
<option value="404" {if $product->redirect_type == '404'} selected="selected" {/if}>{l s='No redirect (404)'}</option>
<option value="301" {if $product->redirect_type == '301'} selected="selected" {/if}>{l s='Redirected permanently (301)'}</option>
<option value="302" {if $product->redirect_type == '302'} selected="selected" {/if}>{l s='Redirected temporarily (302)'}</option>
</select>
</div>
</div>
<div class="form-group redirect_product_options" style="display:none">
<div class="col-lg-9 col-lg-offset-3">
<div class="alert alert-info">
{l s='404 Not Found = Do not redirect and display a 404 page.'}<br/>
{l s='301 Moved Permanently = Permanently display another product instead.'}<br/>
{l s='302 Moved Temporarily = Temporarily display another product instead.'}
</div>
</div>
</div>
<div class="form-group redirect_product_options redirect_product_options_product_choise" style="display:none">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="id_product_redirected" type="radio" onclick=""}</span></div>
<label class="control-label col-lg-2" for="related_product_autocomplete_input">
{l s='Related product:'}
</label>
<div class="col-lg-7">
<input type="hidden" value="" name="id_product_redirected" />
<div class="input-group">
<input type="text" id="related_product_autocomplete_input" name="related_product_autocomplete_input" autocomplete="off" class="ac_input" />
<span class="input-group-addon"><i class="icon-search"></i></span>
</div>
<div class="form-control-static">
<span id="related_product_name"><i class="icon-warning-sign"></i>&nbsp;{l s='No related product.'}</span>
<span id="related_product_remove" style="display:none">
<a class="btn btn-default" href="#" onclick="removeRelatedProduct(); return false" id="related_product_remove_link">
<i class="icon-remove text-danger"></i>
</a>
</span>
</div>
</div>
<script>
var no_related_product = '{l s='No related product'}';
var id_product_redirected = {$product->id_product_redirected|intval};
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}>
<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="category_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>
</label>
<div class="col-lg-9">
<div id="category_block">
{$hotel_tree}
</div>
</div>
</div>
<div class="form-group" id="auto_add_to_cart_container">
<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'}
</span>
</label>
<div class="col-lg-3">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="auto_add_to_cart" id="auto_add_to_cart_on" value="1" {if $product->auto_add_to_cart}checked="checked"{/if}/>
<label for="auto_add_to_cart_on" class="radioCheck">
{l s='Yes'}
</label>
<input type="radio" name="auto_add_to_cart" id="auto_add_to_cart_off" value="0" {if !$product->auto_add_to_cart || !$product->isAssociatedToShop()}checked="checked"{/if}/>
<label for="auto_add_to_cart_off" class="radioCheck">
{l s='No'}
</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<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">
<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>
</label>
<div class="col-lg-4">
<select name="price_addition_type" id="price_addition_type">
<option value="{Product::PRICE_ADDITION_TYPE_WITH_ROOM}" {if $product->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM}selected="selected"{/if} >{l s='Add price in room price'}</option>
<option value="{Product::PRICE_ADDITION_TYPE_INDEPENDENT}" {if $product->price_addition_type == Product::PRICE_ADDITION_TYPE_INDEPENDENT}selected="selected"{/if} >{l s='Add price as convenience Fee'}</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-lg-8 col-lg-offset-3">
<div class="alert alert-info">
{l s='Select how this service price will be added in booking.'}
<ul>
<li>
<b>{l s='Add price in room price'}</b> : {l s='Service price will be added in room base price.'}<br>{l s='(e.g., Room price : 500, service price: 50, final room price : 550)'}
</li>
<li><b>{l s='Add price as convenience fee'}</b> : {l s='Service price will be dispalyed in order summary as "Convenience Fees"'}</li>
</ul>
</div>
</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.'}">
{l s='Show at front office'}
</span>
</label>
<div class="col-lg-3">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="show_at_front" id="show_at_front_on" value="1" {if $product->show_at_front || !$product->isAssociatedToShop()}checked="checked"{/if}/>
<label for="show_at_front_on" class="radioCheck">
{l s='Yes'}
</label>
<input type="radio" name="show_at_front" id="show_at_front_off" value="0" {if !$product->show_at_front && $product->isAssociatedToShop()}checked="checked"{/if}/>
<label for="show_at_front_off" class="radioCheck">
{l s='No'}
</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="form-group" id="available_for_order_container" {if (!$product->show_at_front && $product->isAssociatedToShop()) || $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 sold from front office of your website.'}">
{l s='Availabe for order'}
</span>
</label>
<div class="col-lg-3">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="available_for_order" id="available_for_order_on" value="1" {if $product->available_for_order || !$product->isAssociatedToShop()}checked="checked"{/if}/>
<label for="available_for_order_on" class="radioCheck">
{l s='Yes'}
</label>
<input type="radio" name="available_for_order" id="available_for_order_off" value="0" {if !$product->available_for_order && $product->isAssociatedToShop()}checked="checked"{/if}/>
<label for="available_for_order_off" class="radioCheck">
{l s='No'}
</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="form-group" id="show_price_container" {if $product->available_for_order || (!$product->show_at_front && $product->isAssociatedToShop()) || !$product->isAssociatedToShop() || $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 show product price even when product is not availabe to be sold at front office.'}">
{l s='Show price'}
</span>
</label>
<div class="col-lg-3">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="show_price" id="show_price_on" value="1" {if $product->show_price || !$product->isAssociatedToShop()}checked="checked"{/if}/>
<label for="show_price_on" class="radioCheck">
{l s='Yes'}
</label>
<input type="radio" name="show_price" id="show_price_off" value="0" {if !$product->show_price && $product->isAssociatedToShop()}checked="checked"{/if}/>
<label for="show_price_off" class="radioCheck">
{l s='No'}
</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="form-group hidden">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="visibility" type="default"}</span></div>
<label class="control-label col-lg-2" for="visibility">
{l s='Visibility'}
</label>
<div class="col-lg-3">
<select name="visibility" id="visibility">
<option value="both" {if $product->visibility == 'both'}selected="selected"{/if} >{l s='Everywhere'}</option>
<option value="catalog" {if $product->visibility == 'catalog'}selected="selected"{/if} >{l s='Catalog only'}</option>
<option value="search" {if $product->visibility == 'search'}selected="selected"{/if} >{l s='Search only'}</option>
<option value="none" {if $product->visibility == 'none'}selected="selected"{/if} selected="selected">{l s='Nowhere'}</option>
</select>
</div>
</div>
<div id="allow_multiple_quantity_container" {if (!$product->available_for_order && $product->isAssociatedToShop()) || $product->auto_add_to_cart}style="display:none;"{/if}>
<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='When enabled, customer can order multiple quantity of product otherwise only one quantity can be purchased by customer per room/hotel'}">
{l s='Allow ordering of multiple quantities'}
</span>
</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="allow_multiple_quantity" id="allow_multiple_quantity_on"{if $product->allow_multiple_quantity}checked="checked"{/if} value="1"/>
<label for="allow_multiple_quantity_on" class="radioCheck">
{l s='Yes'}
</label>
<input type="radio" name="allow_multiple_quantity" id="allow_multiple_quantity_off"{if !$product->allow_multiple_quantity}checked="checked"{/if} value="0"/>
<label for="allow_multiple_quantity_off" class="radioCheck">
{l s='No'}
</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="form-group">
<div class="col-lg-6 col-lg-offset-3">
<div class="alert alert-info">
{l s='By default all products have infinte quantity, Using this setting you can restrict customer to purchase only one product per room.'}
</div>
</div>
</div>
</div>
<hr/>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="description_short" type="tinymce" multilang="true"}</span></div>
<label class="control-label col-lg-2" for="description_short_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Appears in the product list(s), and at the top of the product page.'}">
{l s='Short description'}
</span>
</label>
<div class="col-lg-9">
{include
file="controllers/products/textarea_lang.tpl"
languages=$languages
input_name='description_short'
class="autoload_rte"
input_value=$product->description_short
max=$PS_PRODUCT_SHORT_DESC_LIMIT}
</div>
</div>
{* <div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="description" type="tinymce" multilang="true"}</span></div>
<label class="control-label col-lg-2" for="description_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Appears in the body of the room type.'}">
{l s='Description'}
</span>
</label>
<div class="col-lg-9">
{include
file="controllers/products/textarea_lang.tpl"
languages=$languages input_name='description'
class="autoload_rte"
input_value=$product->description}
</div>
</div>
{if $images}
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<div class="alert alert-info">
{capture}<a class="addImageDescription" href="javascript:void(0);">{l s='Click here'}</a>{/capture}
{l s='Would you like to add an image in your description? %s and paste the given tag in the description.' sprintf=$smarty.capture.default}
</div>
</div>
</div>
<div id="createImageDescription" class="panel" style="display:none">
<div class="form-group">
<label class="control-label col-lg-3" for="smallImage_0">{l s='Select your image'}</label>
<div class="col-lg-9">
<ul class="list-inline">
{foreach from=$images item=image key=key}
<li>
<input type="radio" name="smallImage" id="smallImage_{$key}" value="{$image.id_image}" {if $key == 0}checked="checked"{/if} >
<label for="smallImage_{$key}" >
<img src="{$image.src}" alt="{$image.legend}" />
</label>
</li>
{/foreach}
</ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="leftRight_1">{l s='Position'}</label>
<div class="col-lg-5">
<p class="checkbox">
<input type="radio" name="leftRight" id="leftRight_1" value="left" checked>
<label for="leftRight_1" >{l s='left'}</label>
</p>
<p class="checkbox">
<input type="radio" name="leftRight" id="leftRight_2" value="right">
<label for="leftRight_2" >{l s='right'}</label>
</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="imageTypes_0">{l s='Select the type of picture'}</label>
<div class="col-lg-5">
{foreach from=$imagesTypes key=key item=type}
<p class="checkbox">
<input type="radio" name="imageTypes" id="imageTypes_{$key}" value="{$type.name}" {if $key == 0}checked="checked"{/if}>
<label for="imageTypes_{$key}" >
{$type.name} <span>{l s='%dpx by %dpx' sprintf=[$type.width, $type.height]}</span>
</label>
</p>
{/foreach}
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="resultImage">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='The tag to copy/paste into the description.'}">
{l s='Image tag to insert'}
</span>
</label>
<div class="col-lg-4">
<input type="text" id="resultImage" name="resultImage" />
</div>
<p class="help-block"></p>
</div>
</div>
{/if}*}
{* <div class="form-group">
<label class="control-label col-lg-3" for="tags_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Will be displayed in the tags block when enabled. Tags help customers easily find your room types.'}">
{l s='Tags:'}
</span>
</label>
<div class="col-lg-9">
{if $languages|count > 1}
<div class="row">
{/if}
{foreach from=$languages item=language}
{literal}
<script type="text/javascript">
$().ready(function () {
var input_id = '{/literal}tags_{$language.id_lang}{literal}';
$('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag' js=1}{literal}'});
$({/literal}'#{$table}{literal}_form').submit( function() {
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
});
});
</script>
{/literal}
{if $languages|count > 1}
<div class="translatable-field lang-{$language.id_lang}">
<div class="col-lg-9">
{/if}
<input type="text" id="tags_{$language.id_lang}" class="tagify updateCurrentText" name="tags_{$language.id_lang}" value="{$product->getTags($language.id_lang, true)|htmlentitiesUTF8}" />
{if $languages|count > 1}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{$language.iso_code}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=language}
<li>
<a href="javascript:tabs_manager.allow_hide_other_languages = false;hideOtherLanguage({$language.id_lang});">{$language.name}</a>
</li>
{/foreach}
</ul>
</div>
</div>
{/if}
{/foreach}
{if $languages|count > 1}
</div>
{/if}
</div>
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block">{l s='Each tag has to be followed by a comma. The following characters are forbidden: %s' sprintf='!&lt;;&gt;;?=+#&quot;&deg;{}_$%.'}
</div>
</div>
</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 type="text/javascript">
hideOtherLanguage({$default_form_language});
var missing_product_name = '{l s='Please fill product name input field' js=1}';
</script>

View File

@@ -0,0 +1,77 @@
{*
* 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
*}
{foreach from=$languages item=language}
{if $languages|count > 1}
<div class="translatable-field row lang-{$language.id_lang}">
<div class="col-lg-9">
{/if}
{if isset($maxchar)}
<div class="input-group">
<span id="{$input_name}_{$language.id_lang}_counter" class="input-group-addon">
<span class="text-count-down">{$maxchar}</span>
</span>
{/if}
<input type="text"
id="{$input_name}_{$language.id_lang}"
class="form-control {if isset($input_class)}{$input_class} {/if}"
name="{$input_name}_{$language.id_lang}"
value="{$input_value[$language.id_lang]|htmlentitiesUTF8|default:''}"
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();"
onblur="updateLinkRewrite();"
{if isset($required)} required="required"{/if}
{if isset($maxchar)} data-maxchar="{$maxchar}"{/if}
{if isset($maxlength)} maxlength="{$maxlength}"{/if} />
{if isset($maxchar)}
</div>
{/if}
{if $languages|count > 1}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
{$language.iso_code}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=language}
<li>
<a href="javascript:tabs_manager.allow_hide_other_languages = false;hideOtherLanguage({$language.id_lang});">{$language.name}</a>
</li>
{/foreach}
</ul>
</div>
</div>
{/if}
{/foreach}
{if isset($maxchar)}
<script type="text/javascript">
$(document).ready(function(){
{foreach from=$languages item=language}
countDown($("#{$input_name}_{$language.id_lang}"), $("#{$input_name}_{$language.id_lang}_counter"));
{/foreach}
});
</script>
{/if}

View File

@@ -0,0 +1,56 @@
{*
* 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($display_multishop_checkboxes) && $display_multishop_checkboxes}
<div class="panel clearfix">
<label class="control-label col-lg-3">
<i class="icon-sitemap"></i> {l s='Multistore'}
</label>
<div class="col-lg-9">
<div class="row">
<div class="col-lg-4">
<span class="switch prestashop-switch">
<input type="radio" name="multishop_{$product_tab}" id="multishop_{$product_tab}_on" value="1" onclick="$('#product-tab-content-{$product_tab} input[name^=\'multishop_check[\']').attr('checked', true); ProductMultishop.checkAll{$product_tab}()">
<label for="multishop_{$product_tab}_on">
{l s='Yes'}
</label>
<input type="radio" name="multishop_{$product_tab}" id="multishop_{$product_tab}_off" value="0" checked="checked" onclick="$('#product-tab-content-{$product_tab} input[name^=\'multishop_check[\']').attr('checked', false); ProductMultishop.checkAll{$product_tab}()">
<label for="multishop_{$product_tab}_off">
{l s='No'}
</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<p class="help-block">
<strong>{l s='Check / Uncheck all'}</strong> {l s='(If you are editing this page for several shops, some fields may be disabled. If you need to edit them, you will need to check the box for each field)'}
</p>
</div>
</div>
</div>
</div>
{/if}

View File

@@ -0,0 +1,41 @@
{*
* 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($display_multishop_checkboxes) && $display_multishop_checkboxes}
{if isset($multilang) && $multilang}
{if isset($only_checkbox)}
{foreach from=$languages item=language}
<input type="checkbox" name="multishop_check[{$field}][{$language.id_lang}]" value="1" onclick="ProductMultishop.checkField(this.checked, '{$field}_{$language.id_lang}', '{$type}')" {if !empty($multishop_check[$field][$language.id_lang])}checked="checked"{/if} />
{/foreach}
{else}
{foreach from=$languages item=language}
<input style="{if !$language.is_default}display: none;{/if}" class="multishop_lang_{$language.id_lang} lang-{$language.id_lang} translatable-field" type="checkbox" name="multishop_check[{$field}][{$language.id_lang}]" value="1" onclick="ProductMultishop.checkField(this.checked, '{$field}_{$language.id_lang}','{$type}')"
{if !empty($multishop_check[$field][$language.id_lang])}checked="checked"{/if} />
{/foreach}
{/if}
{else}
<input type="checkbox" name="multishop_check[{$field}]" value="1" onclick="ProductMultishop.checkField(this.checked, '{$field}', '{$type}')" {if !empty($multishop_check[$field])}checked="checked"{/if} />
{/if}
{/if}

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/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 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/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../../../');
exit;

View File

@@ -0,0 +1,636 @@
{*
* 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
*}
<script type="text/javascript">
var Customer = new Object();
var product_url = '{$link->getAdminLink('AdminNormalProducts', true)|addslashes}';
var ecotax_tax_excl = parseFloat({$ecotax_tax_excl});
var priceDisplayPrecision = {$smarty.const._PS_PRICE_DISPLAY_PRECISION_|intval};
$(document).ready(function () {
Customer = {
"hiddenField": jQuery('#id_customer'),
"field": jQuery('#customer'),
"container": jQuery('#customers'),
"loader": jQuery('#customerLoader'),
"init": function() {
jQuery(Customer.field).typeWatch({
"captureLength": 1,
"highlight": true,
"wait": 50,
"callback": Customer.search
}).focus(Customer.placeholderIn).blur(Customer.placeholderOut);
},
"placeholderIn": function() {
if (this.value == '{l s='All customers'}') {
this.value = '';
}
},
"placeholderOut": function() {
if (this.value == '') {
this.value = '{l s='All customers'}';
}
},
"search": function()
{
Customer.showLoader();
jQuery.ajax({
"type": "POST",
"url": "{$link->getAdminLink('AdminCustomers')|addslashes}",
"async": true,
"dataType": "json",
"data": {
"ajax": "1",
"token": "{getAdminToken tab='AdminCustomers'}",
"tab": "AdminCustomers",
"action": "searchCustomers",
"customer_search": Customer.field.val()
},
"success": Customer.success
});
},
"success": function(result)
{
if(result.found) {
var html = '<ul class="list-unstyled">';
jQuery.each(result.customers, function() {
html += '<li><a class="fancybox" href="{$link->getAdminLink('AdminCustomers')}&id_customer='+this.id_customer+'&viewcustomer&liteDisplaying=1">'+this.firstname+' '+this.lastname+'</a>'+(this.birthday ? ' - '+this.birthday:'');
html += ' - '+this.email;
html += '<a onclick="Customer.select('+this.id_customer+', \''+this.firstname+' '+this.lastname+'\'); return false;" href="#" class="btn btn-default">{l s='Choose'}</a></li>';
});
html += '</ul>';
}
else
html = '<div class="alert alert-warning">{l s='No customers found'}</div>';
Customer.hideLoader();
Customer.container.html(html);
jQuery('.fancybox', Customer.container).fancybox();
},
"select": function(id_customer, fullname)
{
Customer.hiddenField.val(id_customer);
Customer.field.val(fullname);
Customer.container.empty();
return false;
},
"showLoader": function() {
Customer.loader.fadeIn();
},
"hideLoader": function() {
Customer.loader.fadeOut();
}
};
Customer.init();
});
</script>
{capture assign=priceDisplayPrecisionFormat}{'%.'|cat:$smarty.const._PS_PRICE_DISPLAY_PRECISION_|cat:'f'}{/capture}
<div id="product-prices" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Prices" />
<h3>{l s='product price'}</h3>
<div class="alert alert-info" {if !$country_display_tax_label || $tax_exclude_taxe_option}style="display:none;"{/if}>
{l s='You must enter either the pre-tax retail price, or the retail price with tax. The input field will be automatically calculated.'}
</div>
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Prices"}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="wholesale_price" type="default"}</span></div>
<label class="control-label col-lg-2" for="wholesale_price">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The price is the price you paid for the product. Do not include the tax.'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Wholesale price'}{else}{l s='Pre-tax wholesale price'}{/if}</span>
</label>
<div class="col-lg-2">
<div class="input-group">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input maxlength="27" name="wholesale_price" id="wholesale_price" type="text" value="{{toolsConvertPrice price=$product->wholesale_price}|string_format:$priceDisplayPrecisionFormat}" onchange="this.value = this.value.replace(/,/g, '.');" />
</div>
{if isset($pack) && $pack->isPack($product->id)}<p class="help-block">{l s='The sum of wholesale prices of the product in the pack is %s%s%s' sprintf=[$currency->prefix,{toolsConvertPrice price=$pack->noPackWholesalePrice($product->id)|string_format:$priceDisplayPrecisionFormat},$currency->suffix]}</p>{/if}
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="price" type="price"}</span></div>
<label class="control-label col-lg-2" for="priceTE">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The pre-tax retail price is the price for which you intend sell this product to your customers. It should be higher than the pre-tax wholesale price: the difference between the two will be your margin.'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Retail price'}{else}{l s='Pre-tax retail price'}{/if}</span>
</label>
<div class="col-lg-2">
<div class="input-group">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input type="hidden" id="priceTEReal" name="price" value="{toolsConvertPrice price=$product->price}"/>
<input size="11" maxlength="27" id="priceTE" name="price_displayed" type="text" value="{{toolsConvertPrice price=$product->price}|string_format:'%.6f'}" onchange="noComma('priceTE'); $('#priceTEReal').val(this.value);" onkeyup="$('#priceType').val('TE'); $('#priceTEReal').val(this.value.replace(/,/g, '.')); if (isArrowKey(event)) return; calcPriceTI();" />
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="id_tax_rules_group" type="default"}</span></div>
<label class="control-label col-lg-2" for="id_tax_rules_group">
{l s='Tax rule:'}
</label>
<div class="col-lg-8">
<script type="text/javascript">
noTax = {if $tax_exclude_taxe_option}true{else}false{/if};
taxesArray = new Array();
{foreach $taxesRatesByGroup as $tax_by_group}
taxesArray[{$tax_by_group.id_tax_rules_group}] = {$tax_by_group|json_encode};
{/foreach}
ecotaxTaxRate = {$ecotaxTaxRate / 100};
</script>
<div class="row">
<div class="col-lg-6">
<select onchange="javascript:calcPrice(); {*unitPriceWithTax('unit');*}" name="id_tax_rules_group" id="id_tax_rules_group" {if $tax_exclude_taxe_option}disabled="disabled"{/if} >
<option value="0">{l s='No Tax'}</option>
{foreach from=$tax_rules_groups item=tax_rules_group}
<option value="{$tax_rules_group.id_tax_rules_group}" {if $product->getIdTaxRulesGroup() == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >
{$tax_rules_group['name']|htmlentitiesUTF8}
</option>
{/foreach}
</select>
</div>
<div class="col-lg-2">
<a class="btn btn-link confirm_leave" href="{$link->getAdminLink('AdminTaxRulesGroup')|escape:'html':'UTF-8'}&amp;addtax_rules_group&amp;id_product={$product->id}"{if $tax_exclude_taxe_option} disabled="disabled"{/if}>
<i class="icon-plus-sign"></i> {l s='Create new tax'} <i class="icon-external-link-sign"></i>
</a>
</div>
</div>
</div>
</div>
{if $tax_exclude_taxe_option}
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<div class="alert">
{l s='Taxes are currently disabled:'}
<a href="{$link->getAdminLink('AdminTaxes')|escape:'html':'UTF-8'}">{l s='Click here to open the Taxes configuration page.'}</a>
<input type="hidden" value="{$product->getIdTaxRulesGroup()}" name="id_tax_rules_group" />
</div>
</div>
</div>
{/if}
<div class="form-group" {if !$ps_use_ecotax} style="display:none;"{/if}>
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="ecotax" type="default"}</span></div>
<label class="control-label col-lg-2" for="ecotax">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The ecotax is a local set of taxes intended to "promote ecologically sustainable activities via economic incentives". It is already included in retail price: the higher this ecotax is, the lower your margin will be.'}">{l s='Ecotax (tax incl.)'}</span>
</label>
<div class="input-group col-lg-2">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input maxlength="27" id="ecotax" name="ecotax" type="text" value="{$product->ecotax|string_format:$priceDisplayPrecisionFormat}" onkeyup="$('#priceType').val('TI');if (isArrowKey(event))return; calcPriceTE(); this.value = this.value.replace(/,/g, '.'); if (parseInt(this.value) > getE('priceTE').value) this.value = getE('priceTE').value; if (isNaN(this.value)) this.value = 0;" />
</div>
</div>
<div class="form-group" {if !$country_display_tax_label || $tax_exclude_taxe_option}style="display:none;"{/if} >
<label class="control-label col-lg-3" for="priceTI">{l s='Retail price with tax'}</label>
<div class="input-group col-lg-2">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input id="priceType" name="priceType" type="hidden" value="TE" />
<input id="priceTI" name="priceTI" type="text" value="" onchange="noComma('priceTI');" maxlength="27" onkeyup="$('#priceType').val('TI');if (isArrowKey(event)) return; calcPriceTE();" />
</div>
{if isset($pack) && $pack->isPack($product->id)}<p class="col-lg-9 col-lg-offset-3 help-block">{l s='The sum of prices of the products in the pack is %s%s%s' sprintf=[$currency->prefix,{toolsConvertPrice price=$pack->noPackPrice($product->id)|string_format:$priceDisplayPrecisionFormat},$currency->suffix]}</p>{/if}
</div>
{* As no use in QloApps currently so commented *}
{* <div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="unit_price" type="unit_price"}</span></div>
<label class="control-label col-lg-2" for="unit_price">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='When selling a pack of items, you can indicate the unit price for each item of the pack. For instance, "per bottle" or "per pound".'}">{l s='Unit price (tax excl.)'}</span>
</label>
<div class="col-lg-4">
<div class="input-group">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input id="unit_price" name="unit_price" type="text" value="{$unit_price|string_format:'%.6f'}" maxlength="27" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); unitPriceWithTax('unit');"/>
<span class="input-group-addon">{l s='per'}</span>
<input id="unity" name="unity" type="text" value="{$product->unity|htmlentitiesUTF8}" maxlength="255" onkeyup="if (isArrowKey(event)) return ;unitySecond();" onchange="unitySecond();"/>
</div>
</div>
</div> *}
{if isset($product->unity) && $product->unity}
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<div class="alert alert-warning">
<span>{l s='or'}
{$currency->prefix}<span id="unit_price_with_tax">0.00</span>{$currency->suffix}
{l s='per'} <span id="unity_second">{$product->unity}</span>{if $ps_tax && $country_display_tax_label} {l s='(tax incl.)'}{/if}
</span>
</div>
</div>
</div>
{/if}
{* <div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="on_sale" type="default"}</span></div>
<label class="control-label col-lg-2" for="on_sale">&nbsp;</label>
<div class="col-lg-9">
<div class="checkbox">
<label class="control-label" for="on_sale" >
<input type="checkbox" name="on_sale" id="on_sale" {if $product->on_sale}checked="checked"{/if} value="1" />
{l s='Display the "on sale" icon on the product page, and in the text found within the product listing.'}
</label>
</div>
</div>
</div> *}
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<div class="alert alert-warning">
<strong>{l s='Final retail price:'}</strong>
<span>
{$currency->prefix}
<span id="finalPrice" >0.00</span>
{$currency->suffix}
<span{if !$ps_tax} style="display:none;"{/if}> ({l s='tax incl.'})</span>
</span>
<span{if !$ps_tax} style="display:none;"{/if} >
{if $country_display_tax_label}
/
{/if}
{$currency->prefix}
<span id="finalPriceWithoutTax"></span>
{$currency->suffix}
{if $country_display_tax_label}({l s='tax excl.'}){/if}
</span>
</div>
</div>
</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>
{* <div class="panel">
<h3>{l s='Feature Price Plans'}</h3>
<div class="alert alert-info">
{l s='You can set feature price plans by visiting '}
<a target="_blank" href="{$link->getAdminLink('AdminHotelFeaturePricesSettings')}">{l s='create feature price plans'}</a>
</div>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>#{l s='Id'}</th>
<th>{l s='Plan Name'}</th>
<th>{l s='Impact way'}</th>
<th>{l s='Impact Type'}</th>
<th>{l s='Impact Value'}</th>
<th>{l s='Date From'}</th>
<th>{l s='Date To'}</th>
<th class="text-center">{l s='Status'}</th>
</tr>
</thead>
<tbody>
{if isset($productFeaturePrices) && $productFeaturePrices}
{foreach $productFeaturePrices as $featurePlan}
<tr>
<td>
{$featurePlan['id_feature_price']}
</td>
<td>
{$featurePlan['feature_price_name']}
</td>
<td>
{if $featurePlan['impact_type'] == 1}
{l s='Percentage'}
{else}
{l s='Fixed Amount'}
{/if}
</td>
<td>
{if $featurePlan['impact_way'] == 1}
{l s='Decrease'}
{else}
{l s='Increase'}
{/if}
</td>
<td>
{if $featurePlan['impact_type'] == 1}
{$featurePlan['impact_value']|round:2}%
{else}
{displayPrice price=$featurePlan['impact_value']}
{/if}
</td>
<td>
{dateFormat date=$featurePlan['date_from'] full=0}
</td>
<td>
{if $featurePlan['date_selection_type'] == 1}
{dateFormat date=$featurePlan['date_to'] full=0}
{else}
<span class="badge badge-success">{l s='Specific date'}</span>
{/if}
</td>
<td class="text-center">
{if $featurePlan['active'] == 1}
<i class="icon-check text-success"></i>
{else}
<i class="icon-times text-danger"></i>
{/if}
</td>
</tr>
{/foreach}
{else}
<tr>
<td class="text-center" colspan="6">
<i class="icon-warning-sign"></i> {l s='No feature price plans.'}
</td>
</tr>
{/if}
</tbody>
</table>
</div>
</div> *}
{if isset($specificPriceModificationForm)}
<div class="panel">
<h3>{l s='Specific prices'}</h3>
<div class="alert alert-info">
{l s='You can set specific prices for clients belonging to different groups, different countries, etc.'}
</div>
<div class="form-group">
<div class="col-lg-12">
<a class="btn btn-default" href="#" id="show_specific_price">
<i class="icon-plus-sign"></i> {l s='Add a new specific price'}
</a>
<a class="btn btn-default" href="#" id="hide_specific_price" style="display:none">
<i class="icon-remove text-danger"></i> {l s='Cancel new specific price'}
</a>
</div>
</div>
<script type="text/javascript">
var product_prices = new Array();
{foreach from=$combinations item='combination'}
product_prices['{$combination.id_product_attribute}'] = '{$combination.price|@addcslashes:'\''}';
{/foreach}
</script>
<div id="add_specific_price" class="well clearfix" style="display: none;">
<div class="col-lg-12">
<div class="form-group">
<label class="control-label col-lg-2" for="{if !$multi_shop}spm_currency_0{else}sp_id_shop{/if}">{l s='For'}</label>
<div class="col-lg-9">
<div class="row">
{if !$multi_shop}
<input type="hidden" name="sp_id_shop" value="0" />
{else}
<div class="col-lg-3">
<select name="sp_id_shop" id="sp_id_shop">
{if !$admin_one_shop}<option value="0">{l s='All shops'}</option>{/if}
{foreach from=$shops item=shop}
<option value="{$shop.id_shop}">{$shop.name|htmlentitiesUTF8}</option>
{/foreach}
</select>
</div>
{/if}
<div class="col-lg-3">
<select name="sp_id_currency" id="spm_currency_0" onchange="changeCurrencySpecificPrice(0);">
<option value="0">{l s='All currencies'}</option>
{foreach from=$currencies item=curr}
<option value="{$curr.id_currency}">{$curr.name|htmlentitiesUTF8}</option>
{/foreach}
</select>
</div>
<div class="col-lg-3">
<select name="sp_id_country" id="sp_id_country">
<option value="0">{l s='All countries'}</option>
{foreach from=$countries item=country}
<option value="{$country.id_country}">{$country.name|htmlentitiesUTF8}</option>
{/foreach}
</select>
</div>
<div class="col-lg-3">
<select name="sp_id_group" id="sp_id_group">
<option value="0">{l s='All groups'}</option>
{foreach from=$groups item=group}
<option value="{$group.id_group}">{$group.name}</option>
{/foreach}
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-2" for="customer">{l s='Customer'}</label>
<div class="col-lg-4">
<input type="hidden" name="sp_id_customer" id="id_customer" value="0" />
<div class="input-group">
<input type="text" name="customer" value="{l s='All customers'}" id="customer" autocomplete="off" />
<span class="input-group-addon"><i id="customerLoader" class="icon-refresh icon-spin" style="display: none;"></i> <i class="icon-search"></i></span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<div id="customers"></div>
</div>
</div>
{if $combinations|@count != 0}
<div class="form-group">
<label class="control-label col-lg-2" for="sp_id_product_attribute">{l s='Combination:'}</label>
<div class="col-lg-4">
<select id="sp_id_product_attribute" name="sp_id_product_attribute">
<option value="0">{l s='Apply to all combinations'}</option>
{foreach from=$combinations item='combination'}
<option value="{$combination.id_product_attribute}">{$combination.attributes}</option>
{/foreach}
</select>
</div>
</div>
{/if}
<div class="form-group">
<label class="control-label col-lg-2" for="sp_from">{l s='Available'}</label>
<div class="col-lg-9">
<div class="row">
<div class="col-lg-4">
<div class="input-group">
<span class="input-group-addon">{l s='from'}</span>
<input type="text" name="sp_from" class="datepicker" value="" style="text-align: center" id="sp_from" />
<span class="input-group-addon"><i class="icon-calendar-empty"></i></span>
</div>
</div>
<div class="col-lg-4">
<div class="input-group">
<span class="input-group-addon">{l s='to'}</span>
<input type="text" name="sp_to" class="datepicker" value="" style="text-align: center" id="sp_to" />
<span class="input-group-addon"><i class="icon-calendar-empty"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-2" for="sp_from_quantity">{l s='Starting at'}</label>
<div class="col-lg-4">
<div class="input-group">
<span class="input-group-addon">{l s='unit'}</span>
<input type="text" name="sp_from_quantity" id="sp_from_quantity" value="1" />
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-2" for="sp_price">{l s='product price'}
{if $country_display_tax_label}
{l s='(tax excl.)'}
{/if}
</label>
<div class="col-lg-9">
<div class="row">
<div class="col-lg-4">
<div class="input-group">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input type="text" disabled="disabled" name="sp_price" id="sp_price" value="{$product->price|string_format:$priceDisplayPrecisionFormat}" onchange="noComma('sp_price');" />
</div>
<p class="checkbox">
<label for="leave_bprice">{l s='Leave base price:'}</label>
<input type="checkbox" id="leave_bprice" name="leave_bprice" value="1" checked="checked" />
</p>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-2" for="sp_reduction">{l s='Apply a discount of'}</label>
<div class="col-lg-4">
<div class="row">
<div class="col-lg-3">
<input type="text" name="sp_reduction" id="sp_reduction" value="0.00" onchange="noComma('sp_reduction');"/>
</div>
<div class="col-lg-6">
<select name="sp_reduction_type" id="sp_reduction_type">
<option value="amount" selected="selected">{$currency->name|escape:'html':'UTF-8'}</option>
<option value="percentage">{l s='%'}</option>
</select>
</div>
<div class="col-lg-3">
<select name="sp_reduction_tax" id="sp_reduction_tax">
<option value="0">{l s='Tax excluded'}</option>
<option value="1" selected="selected">{l s='Tax included'}</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var currencyName = '{$currency->name|escape:'html':'UTF-8'|@addcslashes:'\''}';
$(document).ready(function(){
var adv_payment = $(".adv_payment_active:checked").val();
if (adv_payment == 1)
$(".adv_payment_field").show();
else
$(".adv_payment_field").hide();
$(".adv_payment_active").on('change',function()
{
var adv_payment = $(".adv_payment_active:checked").val();
if (adv_payment == 1)
$(".adv_payment_field").show();
else if (adv_payment == 0)
$(".adv_payment_field").hide();
});
var payment_type = $(".payment_type:checked").val();
if (payment_type == 1)
{
$("#type_percent").show();
$("#type_amount").hide();
}
else if (payment_type == 2)
{
$("#type_percent").hide();
$("#type_amount").show();
}
$(".payment_type").on('change',function()
{
var payment_type = $(".payment_type:checked").val();
if (payment_type == 1)
{
$("#type_percent").show();
$("#type_amount").hide();
}
else if (payment_type == 2)
{
$("#type_percent").hide();
$("#type_amount").show();
}
});
product_prices['0'] = $('#sp_current_ht_price').html();
$('#id_product_attribute').change(function() {
$('#sp_current_ht_price').html(product_prices[$('#id_product_attribute option:selected').val()]);
});
$('#leave_bprice').click(function() {
if (this.checked)
$('#sp_price').attr('disabled', 'disabled');
else
$('#sp_price').removeAttr('disabled');
});
$('.datepicker').datetimepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd',
// Define a custom regional settings in order to use PrestaShop translation tools
currentText: '{l s='Now' js=1}',
closeText: '{l s='Done' js=1}',
ampm: false,
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
timeFormat: 'hh:mm:ss tt',
timeSuffix: '',
timeOnlyTitle: '{l s='Choose Time' js=1}',
timeText: '{l s='Time' js=1}',
hourText: '{l s='Hour' js=1}',
minuteText: '{l s='Minute' js=1}'
});
$('#sp_reduction_type').on('change', function() {
if (this.value == 'percentage')
$('#sp_reduction_tax').hide();
else
$('#sp_reduction_tax').show();
});
});
</script>
<div class="table-responsive">
<table id="specific_prices_list" class="table table-bordered">
<thead>
<tr>
<th>{l s='Rule'}</th>
{* <th>{l s='Combination'}</th> *}
{if $multi_shop}<th>{l s='Shop'}</th>{/if}
<th>{l s='Currency'}</th>
<th>{l s='Country'}</th>
<th>{l s='Group'}</th>
<th>{l s='Customer'}</th>
{if $country_display_tax_label}
<th>{l s='Fixed price (tax excl.)'}</th>
{else}
<th>{l s='Fixed price'}</th>
{/if}
<th>{l s='Impact'}</th>
<th>{l s='Period'}</th>
<th>{l s='Action'}</th>
</tr>
</thead>
<tbody>
{$specificPriceModificationForm}
<script type="text/javascript">
$(document).ready(function() {
delete_price_rule = '{l s="Do you really want to remove this price rule?"}';
calcPriceTI();
//unitPriceWithTax('unit');
});
</script>
{/if}

View File

@@ -0,0 +1,116 @@
{*
* 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
*}
<div id="product-seo" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Seo" />
<h3>{l s='SEO'}</h3>
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Seo"}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="meta_title" type="default" multilang="true"}</span></div>
<label class="control-label col-lg-2" for="meta_title_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Public title for the product\'s page, and for search engines. Leave blank to use the room type name.'} {l s='The number of remaining characters is displayed to the left of the field.'}">
{l s='Meta title'}
</span>
</label>
<div class="col-lg-8">
{include file="controllers/products/input_text_lang.tpl"
languages=$languages
input_name='meta_title'
input_value=$product->meta_title
maxchar=70
}
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="meta_description" type="default" multilang="true"}</span></div>
<label class="control-label col-lg-2" for="meta_description_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='This description will appear in search engines. You need a single sentence, shorter than 160 characters (including spaces).'}">
{l s='Meta description'}
</span>
</label>
<div class="col-lg-8">
{include file="controllers/products/textarea_lang.tpl"
languages=$languages
input_name='meta_description'
input_value=$product->meta_description
maxchar=160
}
</div>
</div>
{* Removed for simplicity *}
<div class="form-group hide">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="meta_keywords" type="default" multilang="true"}</span></div>
<label class="control-label col-lg-2" for="meta_keywords_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Keywords for search engines, separated by commas.'}">
{l s='Meta keywords'}
</span>
</label>
<div class="col-lg-8">
{include file="controllers/products/input_text_lang.tpl" languages=$languages
input_value=$product->meta_keywords
input_name='meta_keywords'}
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="link_rewrite" type="seo_friendly_url" multilang="true"}</span></div>
<label class="control-label col-lg-2" for="link_rewrite_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='This is the human-readable URL, as generated from the room type\'s name. You can change it if you want.'}">
{l s='Friendly URL:'}
</span>
</label>
<div class="col-lg-6">
{include file="controllers/products/input_text_lang.tpl"
languages=$languages
input_value=$product->link_rewrite
input_name='link_rewrite'}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default" id="generate-friendly-url" onmousedown="updateFriendlyURLByName();"><i class="icon-random"></i> {l s='Generate'}</button>
</div>
</div>
<div class="row">
<div class="col-lg-9 col-lg-offset-3">
{foreach from=$languages item=language}
<div class="alert alert-warning translatable-field lang-{$language.id_lang}">
<i class="icon-link"></i> {l s='The product link will look like this:'}<br/>
<strong>{if isset($rewritten_links[$language.id_lang][0])}{$rewritten_links[$language.id_lang][0]|escape:'html':'UTF-8'}{/if}<span id="friendly-url_{$language.id_lang}">{$product->link_rewrite[$language.id_lang]|escape:'html':'UTF-8'}</span>{if isset($rewritten_links[$language.id_lang][1])}{$rewritten_links[$language.id_lang][1]|escape:'html':'UTF-8'}{/if}</strong>
</div>
{/foreach}
</div>
</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 type="text/javascript">
if (tabs_manager.allow_hide_other_languages)
hideOtherLanguage({$default_form_language});
</script>

View File

@@ -0,0 +1,27 @@
{*
* 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
*}
{foreach from=$option_list item='row'}
<option value="{$row[$key_id]|intval}">{$row[$key_value]|escape:'html':'UTF-8'}</option>
{/foreach}

View File

@@ -0,0 +1,69 @@
{*
* 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
*}
{foreach from=$languages item=language}
{if $languages|count > 1}
<div class="translatable-field row lang-{$language.id_lang}">
<div class="col-lg-9">
{/if}
{if isset($maxchar) && $maxchar}
<div class="input-group">
<span id="{if isset($input_id)}{$input_id}_{$language.id_lang}{else}{$input_name}_{$language.id_lang}{/if}_counter" class="input-group-addon">
<span class="text-count-down">{$maxchar|intval}</span>
</span>
{/if}
<textarea id="{$input_name}_{$language.id_lang}" name="{$input_name}_{$language.id_lang}" class="{if isset($class)}{$class}{else}textarea-autosize{/if}"{if isset($maxlength) && $maxlength} maxlength="{$maxlength|intval}"{/if}{if isset($maxchar) && $maxchar} data-maxchar="{$maxchar|intval}"{/if}>{if isset($input_value[$language.id_lang])}{$input_value[$language.id_lang]|htmlentitiesUTF8}{/if}</textarea>
<span class="counter" data-max="{if isset($max)}{$max|intval}{/if}{if isset($maxlength)}{$maxlength|intval}{/if}{if !isset($max) && !isset($maxlength)}none{/if}"></span>
{if isset($maxchar) && $maxchar}
</div>
{/if}
{if $languages|count > 1}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{$language.iso_code}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=language}
<li><a href="javascript:tabs_manager.allow_hide_other_languages = false;hideOtherLanguage({$language.id_lang});">{$language.name}</a></li>
{/foreach}
</ul>
</div>
</div>
{/if}
{/foreach}
<script type="text/javascript">
{if isset($maxchar) && $maxchar}
$(document).ready(function(){
{foreach from=$languages item=language}
countDown($("#{$input_name}_{$language.id_lang}"), $("#{$input_name}_{$language.id_lang}_counter"));
{/foreach}
});
{/if}
$(".textarea-autosize").autosize();
</script>

View File

@@ -17,55 +17,151 @@
* @license https://store.webkul.com/license.html
*}
{if isset($selectedRoomDemands) && $selectedRoomDemands}
{assign var=roomCount value=1}
{foreach $selectedRoomDemands as $key => $roomDemand}
<div class="row room_demands_container">
<div class="col-sm-12 demand_header">
<span>
<i class="icon-bed"></i>
{if isset($roomDemand['room_num']) && $roomDemand['room_num']}
{l s='Room'} {$roomDemand['room_num']|escape:'html':'UTF-8'}
{else}
{l s='Room'} {$roomCount|escape:'html':'UTF-8'}
<div class="modal" tabindex="-1" role="dialog" id="rooms_type_extra_demands">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<ul class="nav nav-tabs" role="tablist">
{if isset($selectedRoomDemands) && $selectedRoomDemands}
<li role="presentation" class="active"><a href="#room_type_demands_desc" aria-controls="facilities" role="tab" data-toggle="tab">{l s='Facilities'}</a></li>
{/if}
</span>
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
<li role="presentation" {if !isset($selectedRoomDemands) || !$selectedRoomDemands}class="active"{/if}><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
{/if}
</ul>
</div>
<div class="col-sm-12 room_demand_detail">
{if isset($roomTypeDemands) && $roomTypeDemands}
{foreach $roomTypeDemands as $idGlobalDemand => $demand}
<div class="row room_demand_block">
<div class="col-xs-6">
<div class="row">
<div class="col-xs-2">
<input id_cart_booking="{$roomDemand['id']}" value="{$idGlobalDemand|escape:'html':'UTF-8'}" type="checkbox" class="id_room_type_demand" {if isset($roomDemand['selected_global_demands']) && $roomDemand['selected_global_demands'] && ($idGlobalDemand|in_array:$roomDemand['selected_global_demands'])}checked{/if} />
</div>
<div class="col-xs-10 demand_adv_option_block">
<p>{$demand['name']|escape:'html':'UTF-8'}</p>
{if isset($demand['adv_option']) && $demand['adv_option']}
<select class="id_option">
{foreach $demand['adv_option'] as $idOption => $option}
{assign var=demand_key value="`$idGlobalDemand`-`$idOption`"}
<option optionPrice="{$option['price']|escape:'html':'UTF-8'}" value="{$idOption|escape:'html':'UTF-8'}" {if isset($roomDemand['extra_demands'][$demand_key])}selected{/if} key="{$demand_key}">{$option['name']}</option>
{if isset($roomDemand['extra_demands'][$demand_key])}
{assign var=selected_adv_option value="$idOption"}
{/if}
{/foreach}
</select>
{else}
<input type="hidden" class="id_option" value="0" />
{/if}
</div>
</div>
<div class="modal-body" id="rooms_extra_demands">
<div class="tab-content">
{if isset($selectedRoomDemands) && $selectedRoomDemands}
<div id="room_type_demands_desc" class="tab-pane active">
<div class="rooms_extra_demands_head">
<p class="rooms_extra_demands_text">{l s='Add below facilities to the room for better hotel experience'}</p>
</div>
<div class="col-xs-6">
<p><span class="pull-right extra_demand_option_price">{if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $demand['price']|escape:'html':'UTF-8'}{/if}</span></p>
<div id="room_type_demands_desc">
{if isset($selectedRoomDemands) && $selectedRoomDemands}
{assign var=roomCount value=1}
{foreach $selectedRoomDemands as $key => $roomDemand}
<div class="row room_demands_container">
<div class="col-sm-12 demand_header">
<span>
<i class="icon-bed"></i>
{if isset($roomDemand['room_num']) && $roomDemand['room_num']}
{l s='Room'} {$roomDemand['room_num']|escape:'html':'UTF-8'}
{else}
{l s='Room'} {$roomCount|escape:'html':'UTF-8'}
{/if}
</span>
</div>
<div class="col-sm-12 room_demand_detail">
{if isset($roomTypeDemands) && $roomTypeDemands}
{foreach $roomTypeDemands as $idGlobalDemand => $demand}
<div class="row room_demand_block">
<div class="col-xs-6">
<div class="row">
<div class="col-xs-2">
<input id_cart_booking="{$roomDemand['id']}" value="{$idGlobalDemand|escape:'html':'UTF-8'}" type="checkbox" class="id_room_type_demand" {if isset($roomDemand['selected_global_demands']) && $roomDemand['selected_global_demands'] && ($idGlobalDemand|in_array:$roomDemand['selected_global_demands'])}checked{/if} />
</div>
<div class="col-xs-10 demand_adv_option_block">
<p>{$demand['name']|escape:'html':'UTF-8'}</p>
{if isset($demand['adv_option']) && $demand['adv_option']}
<select class="id_option">
{foreach $demand['adv_option'] as $idOption => $option}
{assign var=demand_key value="`$idGlobalDemand`-`$idOption`"}
<option optionPrice="{$option['price']|escape:'html':'UTF-8'}" value="{$idOption|escape:'html':'UTF-8'}" {if isset($roomDemand['extra_demands'][$demand_key])}selected{/if} key="{$demand_key}">{$option['name']}</option>
{if isset($roomDemand['extra_demands'][$demand_key])}
{assign var=selected_adv_option value="$idOption"}
{/if}
{/foreach}
</select>
{else}
<input type="hidden" class="id_option" value="0" />
{/if}
</div>
</div>
</div>
<div class="col-xs-6">
<p><span class="pull-right extra_demand_option_price">{if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $demand['price']|escape:'html':'UTF-8'}{/if}</span></p>
</div>
</div>
{/foreach}
{/if}
</div>
</div>
{assign var=roomCount value=$roomCount+1}
{/foreach}
{/if}
</div>
</div>
{/foreach}
{/if}
{/if}
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
<div id="room_type_service_product_desc" class="tab-pane{if !isset($selectedRoomDemands) || !$selectedRoomDemands} active{/if}">
<div class="rooms_extra_demands_head">
<p class="rooms_extra_demands_text">{l s='Add below services to the rooms for better hotel experience'}</p>
</div>
<div id="room_type_services_desc">
{assign var=roomCount value=1}
{foreach $selectedRoomServiceProduct as $cartRoom}
<div class="row room_demands_container">
<div class="col-sm-12 demand_header">
<span>
<i class="icon-bed"></i>
{if isset($cartRoom['room_num']) && $cartRoom['room_num']}
{l s='Room'} {$cartRoom['room_num']|escape:'html':'UTF-8'}
{else}
{l s='Room'} {$roomCount|escape:'html':'UTF-8'}
{/if}
</span>
</div>
<div class="col-sm-12 room_demand_detail">
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
{foreach $roomTypeServiceProducts as $product}
<div class="row room_demand_block">
<div class="col-xs-5">
<div class="row">
<div class="col-xs-2">
<input data-id_cart_booking="{$cartRoom['htl_cart_booking_id']}" value="{$product['id_product']|escape:'html':'UTF-8'}" type="checkbox" class="change_room_type_service_product" {if isset($cartRoom['selected_products']) && $cartRoom['selected_products'] && ($product['id_product']|in_array:$cartRoom['selected_products'])}checked{/if}/>
</div>
<div class="col-xs-10">
<p>{$product['name']|escape:'html':'UTF-8'}</p>
{if $product.allow_multiple_quantity}
<div class="qty_container">
<input type="number" class="form-control room_type_service_product_qty qty" id="qty_{$product.id_product}" name="service_product_qty_{$product.id_product}" data-id-product="{$product.id_product}" min="1" value="{if isset($cartRoom['selected_products']) && $cartRoom['selected_products'] && ($product['id_product']|in_array:$cartRoom['selected_products'])}{$cartRoom['selected_products_info'][$product['id_product']]['quantity']}{else}1{/if}">
</div>
{/if}
</div>
</div>
</div>
<div class="col-xs-3">
{if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT}
<span class="badge badge-info label">{l s='Convenience fee'}</span>
{/if}
{if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
<span class="badge badge-info label">{l s='Auto added'}</span>
{/if}
</div>
<div class="col-xs-4">
{if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)}
<span class="pull-right">{convertPrice price=$product.price_tax_exc}</span>
{/if}
</div>
</div>
{/foreach}
{/if}
</div>
</div>
{assign var=roomCount value=1}
{/foreach}
</div>
</div>
{/if}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{l s='Close'}</button>
</div>
</div>
{assign var=roomCount value=$roomCount+1}
{/foreach}
{/if}
</div>
</div>

View File

@@ -25,90 +25,91 @@
<div class="row">
<div class="col-lg-12 table-responsive">
<table class="table" id="customer_cart_details_table">
<thead>
<tr>
<th><span class="title_box">{l s='Room No.'}</span></th>
<th><span class="title_box">{l s='Room Image'}</th>
<th><span class="title_box">{l s='Room Type'}</span></th>
<th><span class="title_box">{l s='Duration'}</span></th>
{if $occupancy_required_for_booking}
{if isset($cart_detail_data) && $cart_detail_data}
<thead>
<tr>
<th><span class="title_box">{l s='Room No.'}</span></th>
<th><span class="title_box">{l s='Room Image'}</th>
<th><span class="title_box">{l s='Room Type'}</span></th>
<th><span class="title_box">{l s='Duration'}</span></th>
{if $occupancy_required_for_booking}
<th><span class="fixed-width-lg title_box">{l s='Occupancy'}</span></th>
{/if}
<th><span class="title_box">{l s='Unit Price (tax excl)'}</span></th>
<th><span class="title_box">{l s='Additinal Facilities (tax excl)'}</span></th>
<th><span class="title_box">{l s='Total Rooms Price (tax excl)'}</span></th>
<th><span class="title_box">{l s='Total Price (tax excl)'}</span></th>
<th></th>
</tr>
</thead>
<tbody>
{if isset($cart_detail_data) && $cart_detail_data}
{assign var=curr_id value=$cart->id_currency|intval}
{foreach from=$cart_detail_data item=data}
<tr data-id-booking-data="{$data.id}" data-id-product="{$data.id_product}" data-id-room="{$data.id_room}" data-date-from="{$data.date_from}" data-date-to="{$data.date_to}" >
<td>{$data.room_num|escape:'html':'UTF-8'}</td>
<td><img src="{$data.image_link|escape:'html':'UTF-8'}" title="Room image" /></td>
<td>
<p>{$data.room_type|escape:'html':'UTF-8'}</p>
{if isset($data.selected_demands) && $data.selected_demands}
<ul class="extra-demand-list">
{foreach $data.selected_demands as $selDemand}
<li>
{$selDemand.name|escape:'html':'UTF-8'}
</li>
{/foreach}
</ul>
{/if}
</td>
<td>{dateFormat date=$data.date_from} - {dateFormat date=$data.date_to}</td>
{if $occupancy_required_for_booking}
<th><span class="title_box">{l s='Extra Services / Fees (tax excl)'}</span></th>
{* <th><span class="title_box">{l s='Total Rooms Price (tax excl)'}</span></th> *}
<th><span class="title_box">{l s='Total Price (tax excl)'}</span></th>
<th></th>
</tr>
</thead>
<tbody>
{assign var=curr_id value=$cart->id_currency|intval}
{foreach from=$cart_detail_data item=data}
<tr data-id-booking-data="{$data.id}" data-id-product="{$data.id_product}" data-id-room="{$data.id_room}" data-date-from="{$data.date_from}" data-date-to="{$data.date_to}" >
<td>{$data.room_num|escape:'html':'UTF-8'}</td>
<td><img src="{$data.image_link|escape:'html':'UTF-8'}" title="Room image" /></td>
<td>
<div class="dropdown">
<button class="booking_guest_occupancy btn btn-default btn-left btn-block input-occupancy" type="button">
<span>
{if $data['adults']}{$data['adults']}{/if} {if $data['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$data['children']}}, {$data['children']} {if $data['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if}
</span>
</button>
<div class="dropdown-menu booking_occupancy_wrapper fixed-width-xxl">
<div class="booking_occupancy_inner">
<input type="hidden" class="max_adults" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_adults']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_children" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_guests" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_guests']|escape:'html':'UTF-8'}{/if}">
<div class="occupancy_info_block selected" occ_block_index="0">
<div class="occupancy_info_head col-sm-12"><span class="room_num_wrapper">{l s='Room - 1'}</span></div>
<div class="row">
<div class="col-xs-6 occupancy_count_block">
<div class="col-sm-12">
<label>{l s='Adults'}</label>
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="{$data['adults']}" min="1" max="{$data['room_type_info']['max_adults']|escape:'html':'UTF-8'}">
<p>{$data.room_type|escape:'html':'UTF-8'}</p>
{if isset($data.selected_demands) && $data.selected_demands}
<ul class="extra-demand-list">
{foreach $data.selected_demands as $selDemand}
<li>
{$selDemand.name|escape:'html':'UTF-8'}
</li>
{/foreach}
</ul>
{/if}
</td>
<td>{dateFormat date=$data.date_from} - {dateFormat date=$data.date_to}</td>
{if $occupancy_required_for_booking}
<td>
<div class="dropdown">
<button class="booking_guest_occupancy btn btn-default btn-left btn-block input-occupancy" type="button">
<span>
{if $data['adults']}{$data['adults']}{/if} {if $data['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$data['children']}}, {$data['children']} {if $data['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if}
</span>
</button>
<div class="dropdown-menu booking_occupancy_wrapper fixed-width-xxl">
<div class="booking_occupancy_inner">
<input type="hidden" class="max_adults" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_adults']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_children" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_guests" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_guests']|escape:'html':'UTF-8'}{/if}">
<div class="occupancy_info_block selected" occ_block_index="0">
<div class="occupancy_info_head col-sm-12"><span class="room_num_wrapper">{l s='Room - 1'}</span></div>
<div class="row">
<div class="col-xs-6 occupancy_count_block">
<div class="col-sm-12">
<label>{l s='Adults'}</label>
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="{$data['adults']}" min="1" max="{$data['room_type_info']['max_adults']|escape:'html':'UTF-8'}">
</div>
</div>
<div class="col-xs-6 occupancy_count_block">
<div class="col-sm-12">
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="{$data['children']}" min="0" max="{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}">
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
</div>
</div>
</div>
<div class="col-xs-6 occupancy_count_block">
<div class="row children_age_info_block" {if !isset($data['child_ages']) || !$data['child_ages']}style="display:none"{/if}>
<div class="col-sm-12">
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="{$data['children']}" min="0" max="{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}">
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
</div>
</div>
</div>
<div class="row children_age_info_block" {if !isset($data['child_ages']) || !$data['child_ages']}style="display:none"{/if}>
<div class="col-sm-12">
<label class="col-sm-12">{l s='All Children'}</label>
<div class="col-sm-12">
<div class="row children_ages">
{if isset($data['child_ages']) && $data['child_ages']}
{foreach $data['child_ages'] as $childAge}
<p class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<select class="guest_child_age room_occupancies" name="occupancy[0][child_ages][]">
<option value="-1" {if $childAge == -1}selected{/if}>{l s='Select 1'}</option>
<option value="0" {if $childAge == 0}selected{/if}>{l s='Under 1'}</option>
{for $age=1 to ($max_child_age-1)}
<option value="{$age|escape:'htmlall':'UTF-8'}" {if $childAge == $age}selected{/if}>{$age|escape:'htmlall':'UTF-8'}</option>
{/for}
</select>
</p>
{/foreach}
{/if}
<label class="col-sm-12">{l s='All Children'}</label>
<div class="col-sm-12">
<div class="row children_ages">
{if isset($data['child_ages']) && $data['child_ages']}
{foreach $data['child_ages'] as $childAge}
<p class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<select class="guest_child_age room_occupancies" name="occupancy[0][child_ages][]">
<option value="-1" {if $childAge == -1}selected{/if}>{l s='Select 1'}</option>
<option value="0" {if $childAge == 0}selected{/if}>{l s='Under 1'}</option>
{for $age=1 to ($max_child_age-1)}
<option value="{$age|escape:'htmlall':'UTF-8'}" {if $childAge == $age}selected{/if}>{$age|escape:'htmlall':'UTF-8'}</option>
{/for}
</select>
</p>
{/foreach}
{/if}
</div>
</div>
</div>
</div>
@@ -116,78 +117,89 @@
</div>
</div>
</div>
</td>
{/if}
<td id="cart_detail_data_unit_price_{$data.id|escape:'html':'UTF-8'}">
{if $data.feature_price_diff != 0}
{assign var=shown_room_type_price value=$data.feature_price_tax_excl}
{else}
{assign var=shown_room_type_price value=$data.product_price_tax_excl}
{/if}
<div class="input-group">
<input type="text" class="room_unit_price" value="{$shown_room_type_price|escape:'html':'UTF-8'}">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
</div>
</td>
{/if}
<td id="cart_detail_data_unit_price_{$data.id|escape:'html':'UTF-8'}">
{if $data.feature_price_diff != 0}
{assign var=shown_room_type_price value=$data.feature_price_tax_excl}
{else}
{assign var=shown_room_type_price value=$data.product_price_tax_excl}
{/if}
<input type="text" class="room_unit_price" value="{$shown_room_type_price|escape:'html':'UTF-8'}">
</td>
<td>
{if isset($data.extra_demands) && $data.extra_demands}
{displayPrice price=$data.demand_price|escape:'html':'UTF-8'}
{else}
{displayPrice price=0}
{/if}
</td>
<td class="cart_line_total_rooms_price" id="cart_detail_data_price_{$data.id|escape:'html':'UTF-8'}">{displayPrice price=$data.amt_with_qty}</td>
<td class="cart_line_total_price">
{if isset($data.extra_demands) && $data.extra_demands}
{displayPrice price=$data.amt_with_qty|escape:'html':'UTF-8'+$data.demand_price|escape:'html':'UTF-8'}
{else}
{displayPrice price=$data.amt_with_qty|escape:'html':'UTF-8'}
{/if}
</td>
<td>
<button class="delete_hotel_cart_data btn btn-danger" data-id_room={$data.id_room|escape:'html':'UTF-8'} data-id_product={$data.id_product|escape:'html':'UTF-8'} data-id = {$data.id|escape:'html':'UTF-8'} data-id_cart = {$data.id_cart|escape:'html':'UTF-8'} data-date_to = {$data.date_to|escape:'html':'UTF-8'} data-date_from = {$data.date_from|escape:'html':'UTF-8'}>
<i class="icon-trash"></i>&nbsp;{l s='Delete'}
</button>
{if isset($data.extra_demands) && $data.extra_demands}
<br />
<a href="#" id_room={$data.id_room|escape:'html':'UTF-8'} date_from="{$data.date_from|escape:'html':'UTF-8'}" date_to="{$data.date_to|escape:'html':'UTF-8'}" id_product="{$data.id_product|escape:'html':'UTF-8'}" id_cart="{$data.id_cart|escape:'html':'UTF-8'}" class="open_rooms_extra_demands btn btn-success" title="{l s='Click here to add or remove the additinal facilities of this room type.'}">
<i class="icon-plus"></i>&nbsp;{l s='Facilities'}
</a>
{/if}
</td>
</tr>
{/foreach}
{else}
<tr>
<td>{l s='No Room Found in the cart.'}</td>
</tr>
<td>
{if (isset($data.extra_demands) && $data.extra_demands) || (isset($data.additional_service) && $data.additional_service)}
{displayPrice price=($data.demand_price + $data.additional_service_price + $data.additional_services_auto_add_price)|escape:'html':'UTF-8'}
{else}
{displayPrice price=0}
{/if}
</td>
{* <td class="cart_line_total_rooms_price" id="cart_detail_data_price_{$data.id|escape:'html':'UTF-8'}">
{displayPrice price=$data.amt_with_qty}</td> *}
<td class="cart_line_total_price">
{if (isset($data.extra_demands) && $data.extra_demands) || (isset($data.additional_service) && $data.additional_service)}
{displayPrice price=($data.feature_price_tax_excl + $data.additional_services_auto_add_price + $data.demand_price + $data.additional_service_price)|escape:'html':'UTF-8'}
{else}
{displayPrice price=$data.feature_price_tax_excl|escape:'html':'UTF-8'}
{/if}
</td>
<td>
<button class="delete_hotel_cart_data btn btn-danger" data-id_room={$data.id_room|escape:'html':'UTF-8'} data-id_product={$data.id_product|escape:'html':'UTF-8'} data-id = {$data.id|escape:'html':'UTF-8'} data-id_cart = {$data.id_cart|escape:'html':'UTF-8'} data-date_to = {$data.date_to|escape:'html':'UTF-8'} data-date_from = {$data.date_from|escape:'html':'UTF-8'}>
<i class="icon-trash"></i>&nbsp;{l s='Delete'}
</button>
{if (isset($data.extra_demands) && $data.extra_demands) || isset($data.additional_service) && $data.additional_service}
<br />
<a href="#" id_room={$data.id_room|escape:'html':'UTF-8'} date_from="{$data.date_from|escape:'html':'UTF-8'}" date_to="{$data.date_to|escape:'html':'UTF-8'}" id_product="{$data.id_product|escape:'html':'UTF-8'}" id_cart="{$data.id_cart|escape:'html':'UTF-8'}" class="open_rooms_extra_demands btn btn-success" title="{l s='Click here to add or remove the extra services of this room type.'}">
<i class="icon-plus"></i>&nbsp;{l s='Services'}
</a>
{/if}
</td>
</tr>
{/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}
</tbody>
</table>
</div>
</div>
</div>
{* Modal for extra demands *}
<div class="modal" tabindex="-1" role="dialog" id="rooms_type_extra_demands">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h3 class="modal-title">{l s='Additional Facilities'}</h3>
</div>
<div class="modal-body" id="rooms_extra_demands">
<div class="rooms_extra_demands_head">
<p class="rooms_extra_demands_text">{l s='Add below additional facilities to the room for better hotel experience'}</p>
</div>
<div id="room_type_demands_desc"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{l s='Close'}</button>
</div>
</div>
</div>
</div>
{* <div class="modal" tabindex="-1" role="dialog" id="rooms_type_extra_demands">
</div> *}
{strip}
{addJsDefL name=txtExtraDemandSucc}{l s='Updated Successfully' js=1}{/addJsDefL}
@@ -205,6 +217,8 @@
color:#979797;
font-size:12px;}
/*Extra demands CSS*/
#rooms_type_extra_demands .modal-header {
padding-bottom: 0px}
#rooms_extra_demands {
font-size: 16px;}
#rooms_extra_demands .room_demands_container {
@@ -212,7 +226,7 @@
#rooms_extra_demands .demand_header {
padding: 10px;
color: #333;
border-bottom: 1px solid #ddd;}
border-bottom: 1px solid #ddd;}
#rooms_extra_demands .rooms_extra_demands_head {
margin-bottom: 18px;}
#rooms_extra_demands .room_demand_block {

View File

@@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<tr id="new_product" style="display:none">
<td style="display:none;" colspan="2" class="text-center">
<td style="display:none;" colspan="3" class="text-center">
<input type="hidden" id="add_product_product_id" name="add_product[product_id]" value="0" />
<div class="form-group">
@@ -50,7 +50,7 @@
<div class="room_check_in_div">
<div class="input-group fixed-width-xl">
<div class="input-group-addon">{l s='Check In'}</div>
<input type="text" class="form-control add_product_date_from" name="add_product[date_from]" readonly />
<input type="text" class="form-control add_room_date_from" name="add_product[date_from]" readonly />
<div class="input-group-addon"><i class="icon-calendar"></i></div>
</div>
</div>
@@ -58,33 +58,13 @@
<div class="room_check_out_div">
<div class="input-group fixed-width-xl">
<div class="input-group-addon">{l s='Check Out'}</div>
<input type="text" class="form-control add_product_date_to" name="add_product[date_to]" readonly/>
<input type="text" class="form-control add_room_date_to" name="add_product[date_to]" readonly/>
<div class="input-group-addon"><i class="icon-calendar"></i></div>
</div>
</div>
</center>
</td>
<td style="display:none;" class="text-center">
<center>
<div class="row">
<div class="input-group fixed-width-xl">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_excl]" id="add_product_product_price_tax_excl" value="" />
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
</div>
</div>
<br/>
<div class="row">
<div class="input-group fixed-width-xl">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_incl]" id="add_product_product_price_tax_incl" value="" />
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
</div>
</div>
</center>
</td>
<td style="display:none;" class="productQuantity text-center" colspan="2">
<td style="display:none;" class="productQuantity text-center" colspan="1">
{if $order->with_occupancy}
<div class="booking_occupancy">
<div class="dropdown">
@@ -137,6 +117,27 @@
{/if}
</td>
<td style="display:none;" class="text-center" colspan="2">
<center>
<div class="row">
<div class="input-group fixed-width-xl">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_excl]" id="add_product_product_price_tax_excl" value="" />
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
</div>
</div>
<br/>
<div class="row">
<div class="input-group fixed-width-xl">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_incl]" id="add_product_product_price_tax_incl" value="" />
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
</div>
</div>
</center>
</td>
{*{if ($order->hasBeenPaid())}<td style="display:none;" class="productQuantity"></td>{/if}
{if $display_warehouse}<td></td>{/if}
{if ($order->hasBeenDelivered())}<td style="display:none;" class="productQuantity"></td>{/if}

View File

@@ -0,0 +1,128 @@
{*
* 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
*}
<tr id="new_normal_product" style="display:none">
<td style="display:none;" colspan="2">
<input type="hidden" id="add_normal_product_product_id" name="add_product[product_id]" value="0" />
<div class="form-group">
<label>{l s='Product:'}</label>
<div class="input-group">
<input type="text" id="add_normal_product_product_name" value=""/>
<div class="input-group-addon">
<i class="icon-search"></i>
</div>
</div>
</div>
{* <div id="add_product_product_attribute_area" class="form-group" style="display: none;">
<label>{l s='Combinations'}</label>
<select name="add_product[product_attribute_id]" id="add_normal_product_attribute_id"></select>
</div>
<div id="add_product_product_warehouse_area" class="form-group" style="display: none;">
<label>{l s='Warehouse'}</label>
<select id="add_product_warehouse" name="add_product_warehouse"></select>
</div> *}
</td>
{if ($order->getTaxCalculationMethod() != $smarty.const.PS_TAX_EXC)}
<td></td>
{/if}
<td style="display:none;">
<div class="row">
<div class="input-group fixed-width-xl">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_excl]" id="add_normal_product_price_tax_excl" value="" disabled="disabled" readonly="true"/>
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
</div>
</div>
<br/>
<div class="row">
<div class="input-group fixed-width-xl">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_incl]" id="add_normal_product_price_tax_incl" value="" disabled="disabled" readonly="true" />
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
</div>
</div>
</td>
<td style="display:none;" class="productQuantity">
<input type="number" class="form-control fixed-width-sm" name="add_product[product_quantity]" id="add_normal_product_quantity" value="1" disabled="disabled" />
</td>
{if ($order->hasBeenPaid())}<td style="display:none;" class="productQuantity"></td>{/if}
{if $display_warehouse}<td></td>{/if}
{if ($order->hasBeenDelivered())}<td style="display:none;" class="productQuantity"></td>{/if}
<td style="display:none;" class="productQuantity" id="add_normal_product_stock">0</td>
<td style="display:none;" id="add_normal_product_total">{displayPrice price=0 currency=$currency->id}</td>
<td style="display:none;" colspan="2">
{if sizeof($invoices_collection)}
<select class="form-control" name="add_product[invoice]" id="add_normal_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>
{/if}
</td>
<td style="display:none;">
<button type="button" class="btn btn-default" id="cancelAddNormalProduct">
<i class="icon-remove text-danger"></i>
{l s='Cancel'}
</button>
<button type="button" class="btn btn-default" id="submitAddNormalProduct" disabled="disabled">
<i class="icon-ok text-success"></i>
{l s='Add'}
</button>
</td>
</tr>
{* <tr id="new_invoice" style="display:none">
<td colspan="10">
<h4>{l s='New invoice information'}</h4>
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-lg-3">{l s='Carrier'}</label>
<div class="col-lg-9">
<p class="form-control-static"><strong>{$carrier->name}</strong></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Shipping Cost'}</label>
<div class="col-lg-9">
<div class="checkbox">
<label>
<input type="checkbox" name="add_invoice[free_shipping]" value="1" />
{l s='Free shipping'}
</label>
<p class="help-block">{l s='If you don\'t select "Free shipping," the normal shipping cost will be applied.'}</p>
</div>
</div>
</div>
</div>
</td>
</tr> *}

View File

@@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<tr class="product-line-row" data-id_room="{$data.id_room}" data-id_product="{$data.id_product}" data-id_hotel="{$data.id_hotel}" data-date_from="{$data.date_from}" data-date_to="{$data.date_to}" data-product_price="{$data.unit_amt_tax_incl}" data-order_detail_id="{$data.id_order_detail}">
<tr class="product-line-row" data-id_room="{$data.id_room}" data-id_product="{$data.id_product}" data-id_hotel="{$data.id_hotel}" data-date_from="{$data.date_from}" data-date_to="{$data.date_to}" data-product_price="{$data.unit_amt_tax_incl}" data-id_order_detail="{$data.id_order_detail}">
{if $refund_allowed}
<td class="standard_refund_fields" style="display:none">
<input type="checkbox" name="id_htl_booking[]" value="{$data.id|escape:'html':'UTF-8'}" {if isset($refundReqBookings) && ($data.id|in_array:$refundReqBookings)}disabled{/if}/>
@@ -37,16 +37,16 @@
</td>
<td class="text-center">
<p>{$data.room_type}</p>
<p class="room_extra_demands {if !isset($data['extra_demands']) || !$data['extra_demands']}edit_product_fields{/if}" {if !isset($data['extra_demands']) || !$data['extra_demands']}style="display: none;"{/if}>
<a href="#" data-toggle="modal" data-target="#rooms_type_extra_demands" date_from="{$data['date_from']}" date_to="{$data['date_to']}" id_product="{$data['id_product']}" id_room="{$data['id_room']}" id_order="{$order->id}" class="open_room_extra_demands" id_htl_booking="{$data['id']}" edit_orde_line="0">
{l s='Additional Features'}
{* <p class="room_extra_demands {if !isset($data['extra_demands']) || !$data['extra_demands']}edit_product_fields{/if}" {if (!isset($data['extra_demands']) || !$data['extra_demands']) && (!isset($data['additional_services']) || !$data['additional_services'])}style="display: none;"{/if}>
<a href="#" data-toggle="modal" data-target="#rooms_type_extra_demands" date_from="{$data['date_from']}" date_to="{$data['date_to']}" id_product="{$data['id_product']}" id_room="{$data['id_room']}" id_order="{$order->id}" class="open_room_extra_services" id_htl_booking="{$data['id']}" edit_orde_line="0">
{l s='Extra Services'}
</a>
</p>
{if isset($data['extra_demands']) && $data['extra_demands']}
</p> *}
{* {if (isset($data['extra_demands']) && $data['extra_demands']) || (isset($data['additional_services']) && $data['additional_services'])}
<p>
{convertPriceWithCurrency price=$data['extra_demands_price_ti'] currency=$currency->id}
{convertPriceWithCurrency price=($data['extra_demands_price_ti'] + $data['additional_services_price_ti']) currency=$currency->id}
</p>
{/if}
{/if} *}
</td>
<td class="text-center">
<a href="{$link->getAdminLink('AdminAddHotel')}&amp;id={$data['id_hotel']}&amp;updatehtl_branch_info" target="_blank">
@@ -162,21 +162,41 @@
</td>
<td class="text-center">
<span class="room_unit_price_show">
{if $data.feature_price_diff != 0}
{* {if $data['feature_price_diff'] != 0}
<span class="product_original_price room_type_old_price">
{convertPriceWithCurrency price=$data.unit_price_without_reduction_tax_excl currency=$currency->id}
{convertPriceWithCurrency price=$data['unit_price_without_reduction_tax_excl'] currency=$currency->id}
</span> &nbsp;
{/if}
<span class="room_type_current_price">
{convertPriceWithCurrency price=$data.paid_unit_price_tax_excl currency=$currency->id}
</span>
{/if} *}
<p>
<span class="room_type_current_price">
{convertPriceWithCurrency price=$data['total_price_tax_excl'] currency=$currency->id}
</span>
</p>
<p class="help-block">{l s='Per day price:'} {convertPriceWithCurrency price=$data['paid_unit_price_tax_excl'] currency=$currency->id}</p>
</span>
<div class="room_unit_price_edit" style="display: none;">
<input type="text" class="room_unit_price" name="room_unit_price" value="{$data.paid_unit_price_tax_excl}">
<input type="text" class="room_unit_price" name="room_unit_price" value="{$data['paid_unit_price_tax_excl']}">
<p class="help-block">{l s='Set per day price'}</p>
</div>
</td>
<td class="text-center">
<span class="product_price_show">{convertPriceWithCurrency price=$data.amt_with_qty_tax_incl currency=$currency->id}</span>
<span class="extra_service_show">
{convertPriceWithCurrency price=($data['extra_demands_price_te'] + $data['additional_services_price_te'] + $data['convenience_fee_te'] + $data['additional_services_price_auto_add_te']) currency=$currency->id}
<a href="#" data-toggle="modal" data-target="#rooms_type_extra_demands" date_from="{$data['date_from']}" date_to="{$data['date_to']}" id_product="{$data['id_product']}" id_room="{$data['id_room']}" id_order="{$order->id}" class="open_room_extra_services" id_htl_booking="{$data['id']}" edit_orde_line="0">
<i class="icon icon-lg icon-info-circle"></i>
</a>
</span>
<span class="extra_service_edit" style="display: none;">
<a href="#" data-toggle="modal" data-target="#rooms_type_extra_demands" date_from="{$data['date_from']}" date_to="{$data['date_to']}" id_product="{$data['id_product']}" id_room="{$data['id_room']}" id_order="{$order->id}" class="open_room_extra_services" id_htl_booking="{$data['id']}" edit_orde_line="0">
{convertPriceWithCurrency price=($data['extra_demands_price_te'] + $data['additional_services_price_te'] + $data['convenience_fee_te'] + $data['additional_services_price_auto_add_te']) currency=$currency->id}
</a>
</span>
</td>
<td class="text-center">
<span class="product_price_show">{convertPriceWithCurrency price=($data['total_room_tax']) currency=$currency->id}</span>
</td>
<td class="text-center">
<span class="product_price_show">{convertPriceWithCurrency price=($data['total_room_price_ti']) currency=$currency->id}</span>
{if $can_edit}
<div class="product_price_edit" style="display:none;">
<div class="form-group">
@@ -211,19 +231,6 @@
{/if}
</td>
{/if}
<td class="text-center">
{if $data.booking_type == HotelBookingDetail::ALLOTMENT_MANUAL && $data.comment|count_characters > 0}
<p><strong>{l s='Message: '}</strong> <span>{$data.comment|escape:'htmlall':'UTF-8'}</span></p>
{/if}
{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 ($can_edit && !$order->hasBeenDelivered())}
<td class="product_invoice" style="display: none;">
{if sizeof($invoices_collection)}
@@ -241,7 +248,7 @@
<td class="product_action text-right">
{* edit/delete controls *}
<div class="btn-group pull-right">
<button type="button" class="btn btn-default edit_product_change_link">
<button type="button" class="btn btn-default edit_room_change_link">
<i class="icon-pencil"></i>
{l s='Edit'}
</button>
@@ -250,7 +257,13 @@
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#" class="delete_product_line">
<a href="#" 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}'>
<i class="icon-refresh"></i>
{l s='Reallocate Room'}
</a>
</li>
<li>
<a href="#" class="delete_room_line">
<i class="icon-trash"></i>
{l s='Delete'}
</a>
@@ -258,11 +271,11 @@
</ul>
</div>
{* Update controls *}
<button type="button" class="btn btn-default submitProductChange" style="display: none;">
<button type="button" class="btn btn-default submitRoomChange" 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;">
<button type="button" class="btn btn-default cancel_room_change_link" style="display: none;">
<i class="icon-remove"></i>
{l s='Cancel'}
</button>

View File

@@ -0,0 +1,71 @@
{*
* 2010-2023 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 2010-2023 Webkul IN
* @license https://store.webkul.com/license.html
*}
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<ul class="nav nav-tabs" role="tablist">
{if (isset($extraDemands) && $extraDemands) || (isset($roomTypeDemands) && $roomTypeDemands)}
<li role="presentation" class="active"><a href="#room_type_demands_desc" aria-controls="facilities" role="tab" data-toggle="tab">{l s='Facilities'}</a></li>
{/if}
{if (isset($additionalServices) && $additionalServices) || (isset($roomTypeServiceProducts) && $roomTypeServiceProducts)}
<li role="presentation" {if !(isset($extraDemands) && $extraDemands) && !(isset($roomTypeDemands) && $roomTypeDemands)}class="active"{/if}><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
{/if}
</ul>
</div>
<div class="modal-body" id="rooms_extra_demands">
<div class="tab-content clearfix">
{include file='controllers/orders/_room_facilities_block.tpl'}
{include file='controllers/orders/_room_services_block.tpl'}
</div>
</div>
<div class="modal-footer">
{* <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">{l s='Close'}</button> *}
</div>
{* Css for handling extra demands changes *}
<style type="text/css">
/*Extra demands CSS*/
#room_extra_demand_content .modal-header {
padding-bottom: 0px;}
#rooms_type_extra_demands .modal-title {
margin: 0px;}
#rooms_type_extra_demands .demand_edit_badge {
font-size: 14px;}
#rooms_extra_demands .room_ordered_demands td, #rooms_extra_demands .room_demand_detail {
font-size: 14px;}
#rooms_extra_demands .demand_header {
padding: 10px;
color: #333;
border-bottom: 1px solid #ddd;}
#rooms_extra_demands .room_demand_block {
margin-bottom: 15px;
color: #333;
font-size: 14px;}
#rooms_extra_demands .facility_nav_btn {
margin-bottom: 20px;}
#rooms_extra_demands .room_demands_container, #rooms_extra_demands .room_services_container {
display: none;}
#room_extra_demand_content #save_room_demands, #room_extra_demand_content #back_to_demands_btn, #room_extra_demand_content #save_service_service, #room_extra_demand_content #back_to_service_btn {
display: none;}
</style>

View File

@@ -1,14 +1,29 @@
<div class="modal-header">
<h3 class="modal-title"><i class="icon-tasks"></i> {l s='Additional Facilities'} {if isset($orderEdit) && $orderEdit}<span class="badge badge-success demand_edit_badge">{l s='edit'}</span>{/if} <button type="button" class="close pull-right" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</h3>
</div>
<div class="modal-body" id="rooms_extra_demands">
<div id="room_type_demands_desc" class="row">
<input type="hidden" value="0" id="id_htl_booking">
{*
* 2010-2023 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 2010-2023 Webkul IN
* @license https://store.webkul.com/license.html
*}
{if (isset($extraDemands) && $extraDemands) || (isset($roomTypeDemands) && $roomTypeDemands)}
<div id="room_type_demands_desc" class="tab-pane active">
<input type="hidden" value="{$id_booking_detail}" id="id_htl_booking">
{if isset($orderEdit) && $orderEdit}
<p class="col-sm-12 facility_nav_btn">
<button id="btn_new_room_facility" class="btn btn-success"><i class="icon-plus"></i> {l s='Add new facility'}</button>
<button id="back_to_facilities_btn" class="btn btn-default"><i class="icon-arrow-left"></i> {l s='Back'}</button>
<button id="btn_new_room_demand" class="btn btn-success"><i class="icon-plus"></i> {l s='Add new facility'}</button>
<button id="back_to_demands_btn" class="btn btn-default"><i class="icon-arrow-left"></i> {l s='Back'}</button>
</p>
{* Already selected room demands *}
@@ -28,7 +43,7 @@
{else}
<tr>
<td colspan="3">
<i class="icon-warning"></i> {l s='No additional facilities added yet.'}
<i class="icon-warning"></i> {l s='No facilities added yet.'}
</td>
</tr>
{/if}
@@ -72,52 +87,21 @@
{/foreach}
{/if}
</div>
<button type="button" id="save_room_demands" class="btn btn-success pull-right"><i class="icon-save"></i> {l s='Save'}</button>
</div>
{elseif isset($extraDemands) && $extraDemands}
{foreach $extraDemands as $roomDemand}
<div class="col-sm-12">
<div class="col-sm-12 room_demand_detail">
{foreach $roomDemand['extra_demands'] as $demand}
<div class="row room_demand_detail">
{foreach $roomDemand['extra_demands'] as $demand}
<div class="col-sm-12 room_demand_block">
<p>
<span>{$demand['name']}</span>
<span class="pull-right">{displayPrice price=$demand['total_price_tax_incl'] currency=$orderCurrency}</span>
</p>
{/foreach}
</div>
</div>
{/foreach}
</div>
{/foreach}
{/if}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">{l s='Close'}</button>
<button type="button" id="save_room_facilities" class="btn btn-success pull-right"><i class="icon-save"></i> {l s='Save'}</button>
</div>
{* Css for handling extra demands changes *}
<style type="text/css">
/*Extra demands CSS*/
#rooms_type_extra_demands .modal-title {
margin: 0px;}
#rooms_type_extra_demands .demand_edit_badge {
font-size: 14px;}
#rooms_extra_demands .room_ordered_demands td, #rooms_extra_demands .room_demand_detail {
font-size: 14px;}
#rooms_extra_demands .demand_header {
padding: 10px;
color: #333;
border-bottom: 1px solid #ddd;}
#rooms_extra_demands .room_demand_block {
margin-bottom: 15px;
color: #333;
font-size: 14px;}
#rooms_extra_demands .facility_nav_btn {
margin-bottom: 20px;}
#rooms_extra_demands .room_demands_container {
display: none;}
#room_extra_demand_content #save_room_facilities, #room_extra_demand_content #back_to_facilities_btn {
display: none;}
</style>
{/if}

View File

@@ -0,0 +1,130 @@
{*
* 2010-2023 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 2010-2023 Webkul IN
* @license https://store.webkul.com/license.html
*}
{if (isset($additionalServices) && $additionalServices) || (isset($roomTypeServiceProducts) && $roomTypeServiceProducts)}
<div id="room_type_service_product_desc" class="tab-pane{if !(isset($extraDemands) && $extraDemands) && !(isset($roomTypeDemands) && $roomTypeDemands)} active{/if}">
{if isset($orderEdit) && $orderEdit}
<p class="col-sm-12 facility_nav_btn">
<button id="btn_new_room_service" class="btn btn-success"><i class="icon-plus"></i> {l s='Add new service'}</button>
<button id="back_to_service_btn" class="btn btn-default"><i class="icon-arrow-left"></i> {l s='Back'}</button>
</p>
{* Already selected room services *}
<div class="col-sm-12 room_ordered_services table-responsive">
<table class="table">
<tbody>
{if isset($additionalServices) && $additionalServices}
{foreach $additionalServices['additional_services'] as $service}
<tr class="room_demand_block">
<td>
<div>{$service['name']|escape:'html':'UTF-8'}</div>
{if $service['allow_multiple_quantity']}
<div class="qty_container">
<input type="number" class="form-control qty" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}" data-id_product="{$service['id_product']|escape:'html':'UTF-8'}" value="{$service['quantity']|escape:'html':'UTF-8'}">
</div>
{/if}
</td>
<td>
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT}
<span class="badge badge-info label">{l s='Convenience fee'}</span>
{/if}
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
<span class="badge badge-info label">{l s='Auto added'}</span>
{/if}
</td>
<td>{displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency}</td>
<td><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>
</tr>
{/foreach}
{else}
<tr>
<td colspan="3">
<i class="icon-warning"></i> {l s='No services added yet.'}
</td>
</tr>
{/if}
</tbody>
</table>
</div>
<form id="add_room_services_form" class="col-sm-12 room_services_container">
<div class="room_demand_detail">
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
{foreach $roomTypeServiceProducts as $product}
<div class="row room_demand_block">
<div class="col-xs-6">
<div class="row">
<div class="col-xs-2">
<input data-id_booking_detail="{$id_booking_detail}" value="{$product['id_product']|escape:'html':'UTF-8'}" name="selected_service[]" type="checkbox" class="id_room_type_service"/>
</div>
<div class="col-xs-10">
<p>{$product['name']|escape:'html':'UTF-8'}</p>
{if $product.allow_multiple_quantity}
<div class="qty_container">
<input type="number" class="form-control qty" id="qty_{$product['id_product']|escape:'html':'UTF-8'}" name="service_qty[{$product['id_product']|escape:'html':'UTF-8'}]" data-id-product="{$product.id_product|escape:'html':'UTF-8'}" value="1">
</div>
{/if}
</div>
</div>
</div>
<div class="col-xs-6">
<p>
<span class="pull-right">{convertPrice price=$product.price_tax_incl}</span>
</p>
</div>
</div>
{/foreach}
{else}
<i class="icon-warning"></i> {l s='No services available to select, All services already added.'}
{/if}
</div>
<input type="hidden" name="id_booking_detail" value="{$id_booking_detail}">
<button type="submit" id="save_service_service" class="btn btn-success pull-right"><i class="icon-save"></i> {l s='Save'}</button>
</form>
{elseif isset($additionalServices) && $additionalServices}
<div class="row room_demand_detail">
{foreach $additionalServices['additional_services'] as $service}
<div class="col-sm-12 room_demand_block">
<div class="row">
<div class="col-xs-8">
<span class="pull-right">
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT}
<span class="badge badge-info label">{l s='Convenience fee'}</span>
{/if}
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
<span class="badge badge-info label">{l s='Auto added'}</span>
{/if}
</span>
<div>{$service['name']|escape:'html':'UTF-8'}</div>
{if $service['allow_multiple_quantity']}
<div class="quantity">{l s='Qty:'}&nbsp;{$service['quantity']|escape:'html':'UTF-8'}</div>
{/if}
</div>
<div class="col-xs-4">
<span class="pull-right">{displayPrice price=$service['total_price_tax_excl'] currency=$orderCurrency}</span>
</div>
</div>
</div>
{/foreach}
</div>
{/if}
</div>
{/if}

View File

@@ -0,0 +1,44 @@
<div class="row">
<div class="col-lg-12">
<table class="table" id="customer_cart_details">
<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='Room Image'}</th>
<th class="text-center"><span class="title_box">{l s='Room Type'}</span></th>
<th class="text-center"><span class="title_box">{l s='Hotel Name'}</span></th>
<th class="text-center"><span class="title_box">{l s='Duration'}</span></th>
<th class="text-center fixed-width-lg"><span class="title_box">{l s='Occupancy'}</span></th>
<th class="text-center"><span class="title_box">{l s='Room Price (Tax excl.)'}</span></th>
<th class="text-center"><span class="title_box">{l s='Extra Services/Fee (Tax excl.)'}</span></th>
<th class="text-center"><span class="title_box">{l s='Total Tax'}</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}
{if ($can_edit && !$order->hasBeenDelivered())}
<th class="text-center"><span class="title_box">{l s='Edit Order'}</th>
{/if}
</tr>
</thead>
<tbody>
{if $order_detail_data}
{foreach from=$order_detail_data item=data}
{* Include product line partial *}
{include file='controllers/orders/_product_line.tpl'}
{/foreach}
{else}
{* <tr>
<td>{l s='No Data Found.'}</td>
</tr> *}
{/if}
{* Include product line partial *}
{include file='controllers/orders/_new_product.tpl'}
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,139 @@
{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

@@ -0,0 +1,41 @@
<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

@@ -180,6 +180,42 @@
$(this).closest("tr").remove();
}
});
$('body').on('click', '.delete_service_product', function(){
if (confirm("{l s='Are you sure?'}"))
{
$.ajax({
type:"POST",
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
data : {
ajax: true,
action: "deleteProductProcess",
id_product: $(this).data('id_product'),
id_cart: $(this).data('id_cart'),
id_hotel: $(this).data('id_hotel'),
},
dataType:"json",
success : function(data)
{
if (data.status == 'deleted')
{
showSuccessMessage("{l s='Remove successful'}");
location.reload();
{* if (data.cart_rooms)
location.reload();
else
window.location.href = "{$link->getAdminLink('AdminHotelRoomsBooking',true)}"; *}
}
else
{
alert("l s='Some error occured.please try again.'}");
}
}
});
$(this).closest("tr").remove();
}
});
/*END*/
$('input:radio[name="free_shipping"]').on('change',function() {
@@ -613,7 +649,6 @@
function updateRoomOccupancy(params, cart_row)
{
debugger;
$.ajax({
type:"POST",
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
@@ -640,10 +675,11 @@
}
function updateCartSummaryData(summaryData) {
$('#total_products').html(formatCurrency(parseFloat(summaryData.summary.total_products), currency_format, currency_sign, currency_blank));
$('#total_extra_demands').html(formatCurrency(parseFloat(summaryData.summary.total_extra_demands_tax_exc), currency_format, currency_sign, currency_blank));
$('#total_rooms').html(formatCurrency(parseFloat(jsonSummary.summary.total_rooms + jsonSummary.summary.total_extra_demands + jsonSummary.summary.total_additional_services + jsonSummary.summary.total_additional_services_auto_add), currency_format, currency_sign, currency_blank));
$('#total_vouchers').html(formatCurrency(parseFloat(summaryData.summary.total_discounts_tax_exc), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(formatCurrency(parseFloat(summaryData.summary.total_price_without_tax), currency_format, currency_sign, currency_blank));
$('#total_convenience_fees').html(formatCurrency(parseFloat(jsonSummary.summary.convenience_fee), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price_without_tax - jsonSummary.summary.convenience_fee), currency_format, currency_sign, currency_blank));
// $('#total_service_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_service_products), currency_format, currency_sign, currency_blank));
$('#total_taxes').html(formatCurrency(parseFloat(summaryData.summary.total_tax), currency_format, currency_sign, currency_blank));
$('#total_with_taxes').html(formatCurrency(parseFloat(summaryData.summary.total_price), currency_format, currency_sign, currency_blank));
}
@@ -1148,12 +1184,13 @@
shipping_price_selected_carrier = jsonSummary.summary.total_shipping;
$('#total_vouchers').html(formatCurrency(parseFloat(jsonSummary.summary.total_discounts_tax_exc), currency_format, currency_sign, currency_blank));
$('#total_shipping').html(formatCurrency(parseFloat(jsonSummary.summary.total_shipping_tax_exc), currency_format, currency_sign, currency_blank));
$('#total_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price_without_tax), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price_without_tax - jsonSummary.summary.convenience_fee), currency_format, currency_sign, currency_blank));
$('#total_with_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price), currency_format, currency_sign, currency_blank));
$('#total_extra_demands').html(formatCurrency(parseFloat(jsonSummary.summary.total_extra_demands_tax_exc), currency_format, currency_sign, currency_blank));
$('#total_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_products), currency_format, currency_sign, currency_blank));
$('#total_rooms').html(formatCurrency(parseFloat(jsonSummary.summary.total_rooms + jsonSummary.summary.total_extra_demands + jsonSummary.summary.total_additional_services + jsonSummary.summary.total_additional_services_auto_add), currency_format, currency_sign, currency_blank));
$('#total_convenience_fees').html(formatCurrency(parseFloat(jsonSummary.summary.convenience_fee), currency_format, currency_sign, currency_blank));
// $('#total_service_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_service_products), currency_format, currency_sign, currency_blank));
id_currency = jsonSummary.cart.id_currency;
$('#id_currency option').removeAttr('selected');
$('#id_currency option[value="'+id_currency+'"]').attr('selected', true);
@@ -1450,8 +1487,9 @@
},
success: function(response) {
if (response.status) {
$('#rooms_type_extra_demands').find('#room_type_demands_desc').html('');
$('#rooms_type_extra_demands').find('#room_type_demands_desc').append(response.html_exta_demands);
$('#customer_cart_details').after(response.html_exta_demands);
// $('#rooms_type_extra_demands').find('#room_type_demands_desc').html('');
// $('#rooms_type_extra_demands').find('#room_type_demands_desc').append(response.html_exta_demands);
$('#rooms_type_extra_demands').modal('show');
}
},
@@ -1538,6 +1576,57 @@
}
});
});
$(document).on('click', '.change_room_type_service_product', function() {
updateServiceProducts(this);
});
$(document).on('focusout', '#rooms_type_extra_demands .qty', function(e) {
var qty_wntd = $(this).val();
if (qty_wntd == '' || !$.isNumeric(qty_wntd)) {
$(this).val(1);
}
if ($(this).closest('.room_demand_block').find('.change_room_type_service_product').is(':checked')) {
updateServiceProducts($(this).closest('.room_demand_block').find('.change_room_type_service_product'));
}
});
function updateServiceProducts(element)
{
var operator = $(element).is(':checked') ? 'up' : 'down';
var id_product = $(element).val();
var id_cart_booking = $(element).data('id_cart_booking');
var qty = $(element).closest('.room_demand_block').find('input.qty').val();
if (typeof(qty) == 'undefined') {
qty = 1;
}
$.ajax({
type: 'POST',
headers: {
"cache-control": "no-cache"
},
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
dataType: 'JSON',
cache: false,
data: {
operator: operator,
id_product: id_product,
id_cart_booking: id_cart_booking,
qty: qty,
action: 'updateServiceProduct',
ajax: true
},
success: function(jsonData) {
if (!jsonData.hasError) {
showSuccessMessage(txtExtraDemandSucc);
} else {
showErrorMessage(jsonData.errors);
}
}
});
}
});
</script>
@@ -1933,15 +2022,21 @@
<div class="col-lg-2">
<div class="data-focus">
<span>{l s='Total rooms (Tax excl.)'}</span><br/>
<span id="total_products" class="size_l text-success"></span>
<span id="total_rooms" class="size_l text-success"></span>
</div>
</div>
<div class="col-lg-2">
{* <div class="col-lg-2">
<div class="data-focus">
<span>{l s='Total additinal facilties (Tax excl.)'}</span><br/>
<span id="total_extra_demands" class="size_l text-success"></span>
<span>{l s='Total extra services (Tax excl.)'}</span><br/>
<span id="total_extra_services" class="size_l text-success"></span>
</div>
</div>
</div> *}
{* <div class="col-lg-2">
<div class="data-focus">
<span>{l s='Total Total service products (Tax excl.)'}</span><br/>
<span id="total_service_products" class="size_l text-success"></span>
</div>
</div> *}
<div class="col-lg-2">
<div class="data-focus">
<span>{l s='Total vouchers (Tax excl.)'}</span><br/>
@@ -1954,6 +2049,12 @@
<span id="total_without_taxes" class="size_l"></span>
</div>
</div>
<div class="col-lg-2">
<div class="data-focus">
<span>{l s='Convenience fees (Tax excl.)'}</span><br/>
<span id="total_convenience_fees" class="size_l"></span>
</div>
</div>
<div class="col-lg-2">
<div class="data-focus">
<span>{l s='Total taxes'}</span><br/>

View File

@@ -1131,53 +1131,14 @@
<div class="panel" id="refundForm">
<div class="panel-heading">
<i class="icon-shopping-cart"></i>
{l s='Rooms In This Order'} <span class="badge">{$order_detail_data|@count}</span>
{l s='Order Detail'} <span class="badge">{$order_detail_data|@count}</span>
{* by webkul products changes as rooms *}
</div>
{* by webkul this code is added for showing rooms information on the order detail page *}
<div class="row">
<div class="col-lg-12">
<table class="table" id="customer_cart_details">
<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='Room Image'}</th>
<th class="text-center"><span class="title_box">{l s='Room Type'}</span></th>
<th class="text-center"><span class="title_box">{l s='Hotel Name'}</span></th>
<th class="text-center"><span class="title_box">{l s='Duration'}</span></th>
<th class="text-center fixed-width-lg"><span class="title_box">{l s='Occupancy'}</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='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 fixed-width-xxl"><span class="title_box">{l s='Reallocate Room'}</span></th>
{if ($can_edit && !$order->hasBeenDelivered())}
<th class="text-center"><span class="title_box">{l s='Edit Order'}</th>
{/if}
</tr>
</thead>
<tbody>
{if $order_detail_data}
{foreach from=$order_detail_data item=data}
{* Include product line partial *}
{include file='controllers/orders/_product_line.tpl'}
{/foreach}
{else}
<tr>
<td>{l s='No Data Found.'}</td>
</tr>
{/if}
{* Include product line partial *}
{include file='controllers/orders/_new_product.tpl'}
</tbody>
</table>
</div>
</div>
{include file='controllers/orders/_rooms_informaion_table.tpl'}
<br>
{include file='controllers/orders/_service_products_table.tpl'}
{capture "TaxMethod"}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
@@ -1192,12 +1153,16 @@
<input type="hidden" name="TaxMethod" value="1">
{/if}
{if $can_edit}
<div class="row-margin-bottom row-margin-top order_action standard_refund_fields" style="display: none;">
<div class="row-margin-bottom row-margin-top standard_refund_fields" style="display: none;">
<textarea class="cancellation_reason" name="cancellation_reason" placeholder="{l s='Enter reason to cancel bookings'}"></textarea>
</div>
<div class="row-margin-bottom row-margin-top order_action">
{if !$order->hasBeenDelivered()}
<button type="button" id="add_product" class="btn btn-default">
{* <button type="button" id="add_product" class="btn btn-default">
<i class="icon-plus-sign"></i>
{l s='Add Product In Order'}
</button> *}
<button type="button" id="add_room" class="btn btn-default">
<i class="icon-plus-sign"></i>
{l s='Add Rooms In Order'}
</button>
@@ -1294,38 +1259,59 @@
{assign var=order_wrapping_price value=$order->total_wrapping_tax_incl}
{assign var=order_shipping_price value=$order->total_shipping_tax_incl}
{/if}
<tr id="total_products">
<td class="text-right"><strong>{l s='Total Rooms Cost (tax excl.)'}</strong></td>
<td class="amount text-right nowrap">
<strong>{displayPrice price=$totalRoomsCostTE currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{if isset($totalDemandsPriceTE) && $totalDemandsPriceTE > 0}
{assign var=room_price_tax_excl value=$order->getTotalProductsWithoutTaxes(false, true)}
{assign var=room_price_tax_incl value=$order->getTotalProductsWithTaxes(false, true)}
{assign var=service_products_price_tax_excl value=$order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE)}
{assign var=service_products_price_tax_incl value=$order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE)}
{assign var=additional_service_price_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTE)}
{assign var=additional_service_price_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTI)}
{if $room_price_tax_excl}
<tr id="total_products">
<td class="text-right"><strong>{l s='Additional Facilities Cost (tax excl.)'}</strong></td>
<td class="text-right"><strong>{l s='Total Rooms Cost (tax excl.)'}</strong></td>
<td class="amount text-right nowrap">
<strong>{displayPrice price=$totalDemandsPriceTE currency=$currency->id}</strong>
<strong>{displayPrice price=$room_price_tax_excl currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
<tr id="total_tax_order">
<td class="text-right"><strong>{l s='Total Rooms Tax'}</strong></td>
<td class="text-right nowrap">
<strong>{displayPrice price=$total_room_tax currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{if isset($totalDemandsPriceTE) && $totalDemandsPriceTE > 0}
{if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0}
<tr id="total_products">
<td class="text-right"><strong>{l s='Total Extra services (tax excl.)'}</strong></td>
<td class="amount text-right nowrap">
<strong>{displayPrice price=($additional_service_price_tax_excl - $totalConvenienceFeeTE) currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{* {if $room_price_tax_excl}
<tr id="total_tax_order">
<td class="text-right"><strong>{l s='Additional Facilities Tax'}</strong></td>
<td class="text-right"><strong>{l s='Total Rooms Tax'}</strong></td>
<td class="text-right nowrap">
<strong>{displayPrice price=($totalDemandsPriceTI - $totalDemandsPriceTE) currency=$currency->id}</strong>
<strong>{displayPrice price=($room_price_tax_incl - $room_price_tax_excl) currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0}
<tr id="total_tax_order">
<td class="text-right"><strong>{l s='Extra services Tax'}</strong></td>
<td class="text-right nowrap">
<strong>{displayPrice price=($additional_service_price_tax_incl - $additional_service_price_tax_excl) currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if} *}
{if $service_products_price_tax_excl}
<tr id="total_products">
<td class="text-right"><strong>{l s='Total service products cost (tax excl.)'}</strong></td>
<td class="amount text-right nowrap">
<strong>{displayPrice price=$service_products_price_tax_excl currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
<tr id="total_discounts" {if $order->total_discounts_tax_incl == 0}style="display: none;"{/if}>
<td class="text-right">{l s='Discounts'}</td>
<td class="amount text-right nowrap">
@@ -1340,13 +1326,22 @@
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{if isset($totalConvenienceFeeTI) && $totalConvenienceFeeTI > 0}
<tr id="total_products">
<td class="text-right"><strong>{l s='Convenience Fee'}</strong></td>
<td class="amount text-right nowrap">
<strong>{displayPrice price=$totalConvenienceFeeTE currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{* {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} *}
<tr id="total_taxes">
<td class="text-right"><strong>{l s='Total Taxes'}</strong></td>
<td class="amount text-right nowrap" ><strong>{displayPrice price=($order->total_paid_tax_incl - $order->total_paid_tax_excl) currency=$currency->id}</strong></td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{* {/if} *}
<tr id="total_order">
<td class="text-right"><strong>{l s='Final Booking Total'}</strong></td>
<td class="amount text-right nowrap">
@@ -1642,7 +1637,7 @@
});
{* open fancybox for extra demands *}
$('.open_room_extra_demands').on('click', function(e) {
$('.open_room_extra_services').on('click', function(e) {
e.preventDefault();
var idProduct = $(this).attr('id_product');
var idOrder = $(this).attr('id_order');
@@ -1651,7 +1646,7 @@
var dateTo = $(this).attr('date_to');
var idHtlBooking = $(this).attr('id_htl_booking');
var orderEdit = 0;
if( $(this).closest('.product-line-row').find(".submitProductChange").is(":visible") == true ) {
if($(this).closest('.product-line-row').find(".submitRoomChange").is(":visible") == true ) {
orderEdit = 1;
}
@@ -1684,25 +1679,119 @@
});
});
$('#rooms_type_extra_demands').on('hidden.bs.modal', function (e) {
if ($('.product-line-row').find(".submitRoomChange").is(":visible") == true ) {
location.reload();
return;
}
});
{* when choose to add new facilities while additional facilities edit *}
$(document).on('click', '#room_extra_demand_content #btn_new_room_facility', function() {
$(document).on('click', '#room_extra_demand_content #btn_new_room_demand', function() {
$('#rooms_extra_demands .room_demands_container').show();
$('#room_extra_demand_content #save_room_facilities').show();
$('#room_extra_demand_content #back_to_facilities_btn').show();
$('#room_extra_demand_content #save_room_demands').show();
$('#room_extra_demand_content #back_to_demands_btn').show();
$('#rooms_extra_demands .room_ordered_demands').hide();
$('#room_extra_demand_content #btn_new_room_facility').hide();
$('#room_extra_demand_content #btn_new_room_demand').hide();
});
{* click on back button on created facilities while additional facilities edit *}
$(document).on('click', '#room_extra_demand_content #back_to_facilities_btn', function() {
$(document).on('click', '#room_extra_demand_content #back_to_demands_btn', function() {
$('#rooms_extra_demands .room_ordered_demands').show();
$('#room_extra_demand_content #btn_new_room_facility').show();
$('#room_extra_demand_content #btn_new_room_demand').show();
$('#rooms_extra_demands .room_demands_container').hide();
$('#room_extra_demand_content #save_room_facilities').hide();
$('#room_extra_demand_content #back_to_facilities_btn').hide();
$('#room_extra_demand_content #save_room_demands').hide();
$('#room_extra_demand_content #back_to_demands_btn').hide();
});
$(document).on('click', '#room_extra_demand_content #btn_new_room_service', function() {
$('#rooms_extra_demands .room_services_container').show();
$('#room_extra_demand_content #save_service_service').show();
$('#room_extra_demand_content #back_to_service_btn').show();
$('#rooms_extra_demands .room_ordered_services').hide();
$('#room_extra_demand_content #btn_new_room_service').hide();
});
{* click on back button on created facilities while additional facilities edit *}
$(document).on('click', '#room_extra_demand_content #back_to_service_btn', function() {
$('#rooms_extra_demands .room_ordered_services').show();
$('#room_extra_demand_content #btn_new_room_service').show();
$('#rooms_extra_demands .room_services_container').hide();
$('#room_extra_demand_content #save_service_service').hide();
$('#room_extra_demand_content #back_to_service_btn').hide();
});
$(document).on('focusout', '#rooms_type_extra_demands .qty', function(e) {
var qty_wntd = $(this).val();
if (qty_wntd == '' || !$.isNumeric(qty_wntd)) {
$(this).val(1);
}
updateServiceProducts($(this));
});
function updateServiceProducts(element)
{
var id_room_type_service_product_order_detail = $(element).data('id_room_type_service_product_order_detail');
var qty = $(element).val();
if ($.isNumeric(qty)) {
$.ajax({
type: 'POST',
headers: {
"cache-control": "no-cache"
},
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
dataType: 'JSON',
cache: false,
data: {
id_room_type_service_product_order_detail: id_room_type_service_product_order_detail,
qty: qty,
action: 'updateRoomAdditionalServices',
ajax: true
},
success: function(jsonData) {
if (!jsonData.hasError) {
showSuccessMessage(txtExtraDemandSucc);
} else {
showErrorMessage(jsonData.errors);
}
}
});
}
}
$(document).on('submit', '#add_room_services_form', function(e) {
e.preventDefault();
var form_data = new FormData(this);
form_data.append('ajax', true);
form_data.append('action', 'addRoomAdditionalServices');
$.ajax({
type: 'POST',
headers: {
"cache-control": "no-cache"
},
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
dataType: 'JSON',
cache: false,
data: form_data,
processData: false,
contentType: false,
success: function(jsonData) {
if (!jsonData.hasError) {
if (jsonData.service_panel) {
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
}
showSuccessMessage(txtExtraDemandSucc);
} else {
showErrorMessage(jsonData.errors);
}
}
});
});
{* // save room extra demand to the order *}
$(document).on('click', '#save_room_facilities', function(e) {
$(document).on('click', '#save_room_demands', function(e) {
e.preventDefault();
var idHtlBooking = $(this).closest('#room_extra_demand_content').find('#id_htl_booking').val();
if (idHtlBooking) {
@@ -1730,10 +1819,12 @@
action: 'EditRoomExtraDemands',
ajax: true
},
success: function(result) {
if (result == 1) {
success: function(jsonData) {
if (jsonData.success) {
showSuccessMessage(txtExtraDemandSucc);
$('#rooms_type_extra_demands').modal('hide');
if (jsonData.facilities_panel) {
$('#room_type_demands_desc').replaceWith(jsonData.facilities_panel);
}
} else {
showErrorMessage(txtSomeErr);
}
@@ -1765,10 +1856,12 @@
action: 'DeleteRoomExtraDemand',
ajax: true
},
success: function(result) {
if (result == 1) {
$currentItem.closest('tr').remove();
success: function(jsonData) {
if (jsonData.success) {
showSuccessMessage(txtDeleteSucc);
if (jsonData.facilities_panel) {
$('#room_type_demands_desc').replaceWith(jsonData.facilities_panel);
}
} else {
showErrorMessage(txtSomeErr);
}
@@ -1780,6 +1873,42 @@
}
});
$(document).on('click', '.del_room_additional_service', function(e){
e.preventDefault();
if (confirm(txt_confirm)) {
var idServiceProductOrderDetail = $(this).data('id_room_type_service_product_order_detail');
$currentItem = $(this);
if (idServiceProductOrderDetail) {
$.ajax({
type: 'POST',
headers: {
"cache-control": "no-cache"
},
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
dataType: 'JSON',
cache: false,
data: {
id_room_type_service_product_order_detail: idServiceProductOrderDetail,
action: 'DeleteRoomAdditionalService',
ajax: true
},
success: function(jsonData) {
if (!jsonData.hasError) {
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
showSuccessMessage(txtExtraDemandSucc);
} else {
showErrorMessage(jsonData.errors);
}
}
});
} else {
showErrorMessage(txtInvalidDemandVal);
}
}
});
// change advance option of extra demand
$(document).on('change', '.demand_adv_option_block .id_option', function(e) {
var option_selected = $(this).find('option:selected');

View File

@@ -1,126 +0,0 @@
{*
* 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($obj->id)}
<div id="product-attachements" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Attachments" />
<h3>{l s='Attachment'}</h3>
<div class="form-group">
<label class="control-label col-lg-3 required" for="attachment_name_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Maximum 32 characters.'}">
{l s='Filename'}
</span>
</label>
<div class="col-lg-9">
{include file="controllers/products/input_text_lang.tpl"
languages=$languages
input_value=$attachment_name
input_name="attachment_name"
}
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attachment_description_{$id_lang}">
{l s='Description'}
</label>
<div class="col-lg-9">
{include
file="controllers/products/textarea_lang.tpl"
languages=$languages
input_name="attachment_description"
input_value=$attachment_description
}
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attachement_filename">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Upload a file from your computer'} ({Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE')|string_format:'%.2f'} {l s='MB max.'})">
{l s='File'}
</span>
</label>
{$attachment_uploader}
<div class="col-lg-3">
&nbsp;
</div>
<div class="col-lg-8">
<p class="help-block">{l s='Upload a file from your computer'} ({Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE')|string_format:'%.2f'} {l s='MB max.'})</p>
</div>
</div>
<hr/>
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<div class="row">
<div class="col-lg-6">
<p>{l s='Available attachments:'}</p>
<select multiple id="selectAttachment2">
{foreach $attach2 as $attach}
<option value="{$attach.id_attachment}">{$attach.name}</option>
{/foreach}
</select>
<a href="#" id="addAttachment" class="btn btn-default btn-block">
{l s='Add'}
<i class="icon-arrow-right"></i>
</a>
</div>
<div class="col-lg-6">
<p>{l s='Attachments for this product:'}</p>
<select multiple id="selectAttachment1" name="attachments[]">
{foreach $attach1 as $attach}
<option value="{$attach.id_attachment}">{$attach.name}</option>
{/foreach}
</select>
<a href="#" id="removeAttachment" class="btn btn-default btn-block">
<i class="icon-arrow-left"></i>
{l s='Remove'}
</a>
</div>
</div>
</div>
</div>
<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>
<input type="hidden" name="arrayAttachments" id="arrayAttachments" value="{foreach $attach1 as $attach}{$attach.id_attachment},{/foreach}" />
<script type="text/javascript">
var iso = '{$iso_tiny_mce}';
var pathCSS = '{$smarty.const._THEME_CSS_DIR_}';
var ad = '{$ad}';
if (tabs_manager.allow_hide_other_languages)
hideOtherLanguage({$default_form_language});
</script>
</div>
{/if}

View File

@@ -1,367 +0,0 @@
{*
* 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) && !$product->is_virtual}
<div id="product-combinations" class="panel product-tab">
<script type="text/javascript">
var msg_combination_1 = '{l s='Please choose an attribute.'}';
var msg_combination_2 = '{l s='Please choose a value.'}';
var msg_combination_3 = '{l s='You can only add one combination per attribute type.'}';
var msg_new_combination = '{l s='New combination'}';
var msg_cancel_combination = '{l s='Cancel combination'}';
var attrs = new Array();
var modifyattributegroup = "{l s='Modify this attribute combination.' js=1}";
attrs[0] = new Array(0, "---");
{foreach from=$attributeJs key=idgrp item=group}
attrs[{$idgrp}] = new Array(0
, '---'
{foreach from=$group key=idattr item=attrname}
, {$idattr|strval|json_encode}, {$attrname|trim|json_encode}
{/foreach}
);
{/foreach}
$(document).ready(function(){
populate_attrs();
$(".datepicker").datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
});
</script>
<input type="hidden" name="submitted_tabs[]" value="Combinations" />
<h3>{l s='Add or modify combinations for this product'}</h3>
<div class="alert alert-info">
{l s='You can also use the [1]Product Combinations Generator[2/][/1] in order to automatically create a set of combinations.' tags=["<a class='btn btn-link bt-icon confirm_leave' href='index.php?tab=AdminAttributeGenerator&amp;id_product={$product->id}&amp;attributegenerator&amp;token={$token_generator}'>", '<i class="icon-external-link-sign">']}
</div>
{if $combination_exists}
<div class="alert alert-info" style="display:block">
{l s='Some combinations already exist. If you want to generate a set of new combinations, the quantities for the existing combinations will be lost.'}<br/>
{l s='You can add a single combination by clicking the "New combination" button.'}
</div>
{/if}
{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes}
<br />
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Combinations"}
{/if}
<div id="add_new_combination" class="panel" style="display: none;">
<div class="panel-heading">{l s='Add or modify combinations for this product'}</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_group">{l s='Attribute'}</label>
<div class="col-lg-5">
<select name="attribute_group" id="attribute_group" onchange="populate_attrs();">
{if isset($attributes_groups)}
{foreach from=$attributes_groups key=k item=attribute_group}
<option value="{$attribute_group.id_attribute_group}">{$attribute_group.name|escape:'html':'UTF-8'}&nbsp;&nbsp;</option>
{/foreach}
{/if}
</select>
</div>
</div>
<div class="row">
<label class="control-label col-lg-3" for="attribute">{l s='Value'}</label>
<div class="col-lg-9">
<div class="form-group">
<div class="col-lg-8">
<select name="attribute" id="attribute">
<option value="0">-</option>
</select>
</div>
<div class="col-lg-4">
<button type="button" class="btn btn-default btn-block" onclick="add_attr();"><i class="icon-plus-sign-alt"></i> {l s='Add'}</button>
</div>
</div>
<div class="form-group">
<div class="col-lg-8">
<select id="product_att_list" name="attribute_combination_list[]" multiple="multiple" ></select>
</div>
<div class="col-lg-4">
<button type="button" class="btn btn-default btn-block" onclick="del_attr()"><i class="icon-minus-sign-alt"></i> {l s='Delete'}</button>
</div>
</div>
</div>
</div>
<hr/>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_reference">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Special characters allowed:'} .-_#">
{l s='Reference code'}
</span>
</label>
<div class="col-lg-5">
<input type="text" id="attribute_reference" name="attribute_reference" value="" />
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_ean13">
{l s='EAN-13 or JAN barcode'}
</label>
<div class="col-lg-3">
<input maxlength="13" type="text" id="attribute_ean13" name="attribute_ean13" value="" />
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_upc">
{l s='UPC barcode'}
</label>
<div class="col-lg-3">
<input maxlength="12" type="text" id="attribute_upc" name="attribute_upc" value="" />
</div>
</div>
<hr/>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="attribute_wholesale_price" type="default"}</span></div>
<label class="control-label col-lg-2" for="attribute_wholesale_price">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Set to zero if the price does not change.'}">
{l s='Wholesale price'}
</span>
</label>
<div class="col-lg-9">
<div class="input-group col-lg-2">
<span class="input-group-addon">
{if $currency->format % 2 != 0}{$currency->sign}{/if}
{if $currency->format % 2 == 0}{$currency->sign}{/if}
</span>
<input type="text" name="attribute_wholesale_price" id="attribute_wholesale_price" value="0" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
</div>
<span style="display:none;" id="attribute_wholesale_price_full" class="help-block">{l s='Overrides the wholesale price from the "Prices" tab.'}</span>
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="attribute_price_impact" type="attribute_price_impact"}</span></div>
<label class="control-label col-lg-2" for="attribute_price_impact">
{l s='Impact on price'}
</label>
<div class="col-lg-9">
<div class="row">
<div class="col-lg-4">
<select name="attribute_price_impact" id="attribute_price_impact" onchange="check_impact(); calcImpactPriceTI();">
<option value="0">{l s='None'}</option>
<option value="1">{l s='Increase'}</option>
<option value="-1">{l s='Decrease'}</option>
</select>
</div>
<div id="span_impact" class="col-lg-8">
<div class="form-group">
<label class="control-label col-lg-1" for="attribute_price">
{l s='of'}
</label>
<div class="input-group col-lg-5">
<div class="input-group-addon">
{if $currency->format % 2 != 0}{$currency->sign}{/if}
{if $currency->format % 2 == 0} {$currency->sign}{/if}
{if $country_display_tax_label}
{l s='(tax excl.)'}
{/if}
</div>
<input type="hidden" id="attribute_priceTEReal" name="attribute_price" value="0.00" />
<input type="text" id="attribute_price" value="0.00" onkeyup="$('#attribute_priceTEReal').val(this.value.replace(/,/g, '.')); if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); calcImpactPriceTI();"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-1" for="attribute_priceTI">
{l s='or'}
</label>
<div class="input-group col-lg-5">
<div class="input-group-addon" {if $tax_exclude_option}style="display:none"{/if}>
{if $currency->format % 2 != 0}{$currency->sign}{/if}
{if $currency->format % 2 == 0} {$currency->sign}{/if}
{l s='(tax incl.)'}
</div>
<input type="text" name="attribute_priceTI" id="attribute_priceTI" value="0.00" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); calcImpactPriceTE();"/>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="alert">
{l s='The final product price will be set to'}
{if $currency->format % 2 != 0}{$currency->sign}{/if}
<span id="attribute_new_total_price">0.00</span>
{if $currency->format % 2 == 0}{$currency->sign}{/if}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="attribute_weight_impact" type="attribute_weight_impact"}</span></div>
<label class="control-label col-lg-2" for="attribute_weight_impact">
{l s='Impact on weight'}
</label>
<div class="col-lg-9">
<div class="row">
<div class="col-lg-4">
<select name="attribute_weight_impact" id="attribute_weight_impact" onchange="check_weight_impact();">
<option value="0">{l s='None'}</option>
<option value="1">{l s='Increase'}</option>
<option value="-1">{l s='Reduction'}</option>
</select>
</div>
<div id="span_weight_impact" class="col-lg-8">
<div class="row">
<label class="control-label col-lg-1" for="attribute_weight">
{l s='of'}
</label>
<div class="input-group col-lg-5">
<div class="input-group-addon">
{$ps_weight_unit}
</div>
<input type="text" name="attribute_weight" id="attribute_weight" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
</div>
</div>
</div>
</div>
</div>
</div>
<div id="tr_unit_impact" class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="attribute_unit_impact" type="attribute_unit_impact"}</span></div>
<label class="control-label col-lg-2" for="attribute_unit_impact">
{l s='Impact on unit price'}
</label>
<div class="col-lg-3">
<select name="attribute_unit_impact" id="attribute_unit_impact" onchange="check_unit_impact();">
<option value="0">{l s='None'}</option>
<option value="1">{l s='Increase'}</option>
<option value="-1">{l s='Reduction'}</option>
</select>
</div>
<div class="col-lg-6">
<div class="row">
<label class="control-label col-lg-1" for="attribute_unity">
{l s='of'}
</label>
<div class="input-group col-lg-5">
<div class="input-group-addon">
{if $currency->format % 2 != 0}{$currency->sign}{/if}
{if $currency->format % 2 == 0}{$currency->sign}{/if}
/ <span id="unity_third">{$field_value_unity}</span>
</div>
<input type="text" name="attribute_unity" id="attribute_unity" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
</div>
</div>
</div>
</div>
{if $ps_use_ecotax}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="attribute_ecotax" type="default"}</span></div>
<label class="control-label col-lg-2" for="attribute_ecotax">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Overrides the ecotax from the "Prices" tab.'}">
{l s='Ecotax (tax excl.)'}
</span>
</label>
<div class="input-group col-lg-2">
<div class="input-group-addon">
{if $currency->format % 2 != 0}{$currency->sign}{/if}
{if $currency->format % 2 == 0} {$currency->sign}{/if}
</div>
<input type="text" name="attribute_ecotax" id="attribute_ecotax" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
</div>
</div>
{/if}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="attribute_minimal_quantity" type="default"}</span></div>
<label class="control-label col-lg-2" for="attribute_minimal_quantity">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The minimum quantity to buy this product (set to 1 to disable this feature).'}">
{l s='Minimum quantity'}
</span>
</label>
<div class="col-lg-9">
<div class="input-group col-lg-2">
<div class="input-group-addon">&times;</div>
<input maxlength="6" name="attribute_minimal_quantity" id="attribute_minimal_quantity" type="text" value="{$minimal_quantity}" />
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="available_date_attribute" type="default"}</span></div>
<label class="control-label col-lg-2" for="available_date_attribute">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='If this product is out of stock, you can indicate when the product will be available again.'}">
{l s='Availability date'}
</span>
</label>
<div class="col-lg-9">
<div class="input-group col-lg-3">
<input class="datepicker" id="available_date_attribute" name="available_date_attribute" value="{$available_date}" type="text" />
<div class="input-group-addon">
<i class="icon-calendar-empty"></i>
</div>
</div>
</div>
</div>
<hr/>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Image'}</label>
<div class="col-lg-9">
{if $images|count}
<ul id="id_image_attr" class="list-inline">
{foreach from=$images key=k item=image}
<li>
<input type="checkbox" name="id_image_attr[]" value="{$image.id_image}" id="id_image_attr_{$image.id_image}" />
<label for="id_image_attr_{$image.id_image}">
<img class="img-thumbnail" src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-{$imageType}.jpg" alt="{$image.legend|escape:'html':'UTF-8'}" title="{$image.legend|escape:'html':'UTF-8'}" />
</label>
</li>
{/foreach}
</ul>
{else}
<div class="alert alert-warning">{l s='You must upload an image before you can select one for your combination.'}</div>
{/if}
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="attribute_default" type="attribute_default"}</span></div>
<label class="control-label col-lg-2" for="attribute_default">
{l s='Default'}
</label>
<div class="col-lg-9">
<p class="checkbox">
<label for="attribute_default">
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" />
{l s='Make this combination the default combination for this product.'}
</label>
</p>
</div>
</div>
<div class="panel-footer">
<span id="ResetSpan">
<button type="reset" name="ResetBtn" id="ResetBtn" onclick="$('#desc-product-newCombination').click();" class="btn btn-default">
<i class="icon-undo"></i> {l s='Cancel modification'}
</button>
</span>
</div>
</div>
{$list}
<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>
<a href="#" id="desc-product-newCombination" class="btn btn-default pull-right"><i class="process-icon-new"></i> <span>{l s="New combination"}</span></a>
</div>
</div>
{/if}

View File

@@ -1,89 +0,0 @@
{*
* 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($obj->id)}
<div id="product-customization" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Customization" />
<h3>{l s='Add or modify customizable properties'}</h3>
{if isset($display_common_field) && $display_common_field}
<div class="alert alert-info">{l s='Warning, if you change the value of fields with an orange bullet %s, the value will be changed for all other shops for this product' sprintf=$bullet_common_field}</div>
{/if}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="uploadable_files" type="uploadable_files"}</span></div>
<label class="control-label col-lg-3" for="uploadable_files">
{$bullet_common_field}
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Number of upload file fields to be displayed to the user.'}">
{l s='File fields'}
</span>
</label>
<div class="col-lg-1">
<input type="text" name="uploadable_files" id="uploadable_files" value="{$uploadable_files|htmlentities}" />
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="text_fields" type="text_fields"}</span></div>
<label class="control-label col-lg-3" for="text_fields">
{$bullet_common_field}
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Number of text fields to be displayed to the user.'}">
{l s='Text fields'}
</span>
</label>
<div class="col-lg-1">
<input type="text" name="text_fields" id="text_fields" value="{$text_fields|htmlentities}" />
</div>
</div>
{if $has_file_labels}
<hr/>
<div class="form-group">
<label class="control-label col-lg-3">
{l s='Define the label of the file fields'}
</label>
<div class="col-lg-9">
{$display_file_labels}
</div>
</div>
{/if}
{if $has_text_labels}
<hr/>
<div class="form-group">
<label class="control-label col-lg-3">
{l s='Define the label of the text fields'}
</label>
<div class="col-lg-9">
{$display_text_labels}
</div>
</div>
{/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>
</div>
{/if}

View File

@@ -107,24 +107,35 @@
$(document).ready(function()
{
if (product_type == product_type_pack)
{* if (product_type == product_type_pack)
{
$('a[id*="VirtualProduct"]').hide();
$('a[id*="Combinations"]').hide();
}
else if (product_type == product_type_virtual)
{
$('a[id*="Quantities"]').hide();
$('a[id*="Configuration"]').show();
$('a[id*="Booking"]').show();
$('a[id*="Occupancy"]').show();
$('a[id*="ModuleHotelreservationsystem"]').show();
$('a[id*="Pack"]').hide();
$('a[id*="Shipping"]').hide();
$('a[id*="Combinations"]').hide();
}
else
{
$('a[id*="Quantities"]').show();
$('a[id*="Configuration"]').hide();
$('a[id*="Occupancy"]').hide();
$('a[id*="Booking"]').hide();
$('a[id*="ModuleHotelreservationsystem"]').hide();
$('a[id*="Pack"]').hide();
$('a[id*="VirtualProduct"]').hide();
}
} *}
{* updateTextInfo(product_type); *}
$('#desc-product-newCombination').hide();
{* $('#desc-product-newCombination').hide(); *}
{* submenu binding *}
$(".productTabs a").click(function(e){
@@ -140,12 +151,12 @@
var split_position = id.indexOf('-') + 1;
var btn_name = id.substr(split_position);
if ((btn_name == 'VirtualProduct' || btn_name == 'Pack') && $('#name_' + id_lang_default).val() == '')
{* if ((btn_name == 'VirtualProduct' || btn_name == 'Pack') && $('#name_' + id_lang_default).val() == '')
{
alert(missing_product_name);
$('#name_' + id_lang_default).focus();
return false;
}
} *}
$('#key_tab').val(btn_name);
@@ -166,7 +177,7 @@
});
var languages = new Array();
if (btn_name == "Combinations")
{* if (btn_name == "Combinations")
{
$('#desc-product-new').hide();
$('#desc-product-newCombination').show();
@@ -177,12 +188,12 @@
handleSaveButtons();
}
else
{
{ *}
$('#desc-product-newCombination').hide();
// if pack is enabled, save button are visible only if pack is valid
if ($("input[name='id_product']").val() != 0 || btn_name != 'Informations')
handleSaveButtons();
}
{* } *}
$('.label-tooltip').tooltip();
});
@@ -227,28 +238,28 @@
$('.productTabs').show();
$('#product-tab-content-wait').hide();
function checkIfProductTypeIsPack() {
{* function checkIfProductTypeIsPack() {
var typeIsPack = $('#pack_product').is(':checked');
if (typeIsPack && $('#inputPackItems').val()=='' ) {
$('.pack-empty-warning').removeClass('alert-warning').addClass('alert-danger');
$('#curPackItemName').select2('open');
}
return typeIsPack;
}
} *}
$("#product_form").validate({
ignore: '.updateCurrentText',
rules: {
{* rules: {
inputPackItems: {
required: {
depends: checkIfProductTypeIsPack
},
}
},
messages: {
}, *}
{* messages: {
inputPackItems: {
required: ""
}
},
}, *}
// override jquery validate plugin defaults for bootstrap 3
highlight: function(element) {
$(element).closest('.form-group').addClass('has-error');
@@ -287,11 +298,10 @@
<form id="product_form" class="form-horizontal col-lg-10 col-md-9" action="{$form_action|escape:'html':'UTF-8'}" method="post" enctype="multipart/form-data" name="product" novalidate>
<input type="hidden" name="id_product" value="{$id_product}" />
<!-- <input type="hidden" id="is_virtual" name="is_virtual" value="{$product->is_virtual|escape:'html':'UTF-8'}" /> -->
{* <input type="hidden" id="is_virtual" name="is_virtual" value="{$product->is_virtual|escape:'html':'UTF-8'}" /> *}
<!-- changed input field to make product virtual by default -->
<input type="hidden" id="is_virtual" name="is_virtual" value="1"/>
{if isset($smarty.request.page) && $smarty.request.page > 1}
<input type="hidden" id="page" name="page" value="{$smarty.request.page|intval}" />
{/if}

View File

@@ -100,38 +100,9 @@
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Informations"}
<div class="form-group hidden">
<label class="control-label col-lg-3" for="simple_product">
{$bullet_common_field} {l s='Type'}
</label>
<div class="col-lg-9">
<div class="radio">
<label for="simple_product">
<input type="radio" name="type_product" id="simple_product" value="{Product::PTYPE_SIMPLE}" {if $product_type == Product::PTYPE_SIMPLE}checked="checked"{/if}>
{l s='Standard product'}</label>
</div>
<div class="radio">
<label for="pack_product">
<input type="radio" name="type_product" {if $is_in_pack}disabled="disabled"{/if} id="pack_product" value="{Product::PTYPE_PACK}" {if $product_type == Product::PTYPE_PACK}checked="checked"{/if}> {l s='Pack of existing products'}</label>
</div>
<div class="radio">
<label for="virtual_product">
<input type="radio" name="type_product" id="virtual_product" {if $is_in_pack}disabled="disabled"{/if} value="{Product::PTYPE_VIRTUAL}" {if $product_type == Product::PTYPE_VIRTUAL}checked="checked"{/if}>
{l s='Virtual product (services, booking, downloadable products, etc.)'}</label>
</div>
<div class="row row-padding-top">
<div id="warn_virtual_combinations" class="alert alert-warning" style="display:none">{l s='You cannot use combinations with a virtual product.'}</div>
<div id="warn_pack_combinations" class="alert alert-warning" style="display:none">{l s='You cannot use combinations with a pack.'}</div>
</div>
</div>
</div>
<div id="product-pack-container" {if $product_type != Product::PTYPE_PACK}style="display:none"{/if}></div>
{*<hr />*}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="name" type="default" multilang="true"}</span></div>
<label class="control-label col-lg-2 required" for="name_{$id_lang}">
<label class="control-label col-lg-2 required" id="name" for="name_{$id_lang}">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Write the name of the Room Type for ex. Delux, Executive etc.'} {l s='Invalid characters:'} &lt;&gt;;=#{}">
{l s='Room Type'}
</span>
@@ -151,9 +122,9 @@
<input type="hidden" value="{$htl_room_type['id']}" name="wk_id_room_type">
{/if}
<div class="form-group">
<div class="form-group" id="hotel_selection">
{if isset($htl_room_type)}
<label class="control-label col-sm-3 required" for="hotel_place">
<label class="control-label col-sm-3 required">
{l s='Hotel'}
</label>
<div class="col-sm-5">
@@ -335,7 +306,7 @@
</div>
</div>
</div>
<div class="form-group">
{* <div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="condition" type="default"}</span></div>
<label class="control-label col-lg-2" for="condition">
{l s='Condition'}
@@ -347,7 +318,7 @@
<option value="refurbished" {if $product->condition == 'refurbished'}selected="selected"{/if}>{l s='Refurbished'}</option>
</select>
</div>
</div>
</div> *}
</div>
</div>
<hr/>

View File

@@ -1,74 +0,0 @@
{*
* 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
*}
<input type="hidden" name="submitted_tabs[]" value="Pack" />
<hr />
<div class="form-group listOfPack">
<label class="control-label col-lg-3 product_description">
{l s='List of products of this pack'}
</label>
<div class="col-lg-9">
<p class="alert alert-warning pack-empty-warning" {if $pack_items|@count != 0}style="display:none"{/if}>{l s='This pack is empty. You must add at least one product item.'}</p>
<ul id="divPackItems" class="list-unstyled">
{foreach $pack_items as $pack_item}
<li class="product-pack-item media-product-pack" data-product-name="{$curPackItemName}" data-product-qty="{$pack_item.pack_quantity}" data-product-id="{$pack_item.id}" data-product-id-attribute="{$pack_item.id_product_attribute}">
<img class="media-product-pack-img" src="{$pack_item.image}"/>
<span class="media-product-pack-title">{$pack_item.name}</span>
<span class="media-product-pack-ref">REF: {$pack_item.reference}</span>
<span class="media-product-pack-quantity"><span class="text-muted">x</span>{$pack_item.pack_quantity}</span>
<button type="button" class="btn btn-default delPackItem media-product-pack-action" data-delete="{$pack_item.id}" data-delete-attr="{$pack_item.id_product_attribute}"><i class="icon-trash"></i></button>
</li>
{/foreach}
</ul>
</div>
</div>
<div class="form-group addProductToPack">
<label class="control-label col-lg-3" for="curPackItemName">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Start by typing the first letters of the product name, then select the product from the drop-down list.'}">
{l s='Add product in your pack'}
</span>
</label>
<div class="col-lg-9">
<div class="row">
<div class="col-lg-6">
<input type="text" id="curPackItemName" name="curPackItemName" class="form-control" />
</div>
<div class="col-lg-2">
<div class="input-group">
<span class="input-group-addon">&times;</span>
<input type="number" name="curPackItemQty" id="curPackItemQty" class="form-control" min="1" value="1"/>
</div>
</div>
<div class="col-lg-2">
<button type="button" id="add_pack_item" class="btn btn-default">
<i class="icon-plus-sign-alt"></i> {l s='Add this product'}
</button>
</div>
</div>
</div>
</div>
<input type="hidden" name="inputPackItems" id="inputPackItems" value="{$input_pack_items}" placeholder="inputs"/>
<input type="hidden" name="namePackItems" id="namePackItems" value="{$input_namepack_items}" placeholder="name"/>

View File

@@ -1,301 +0,0 @@
{*
* 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('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></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

@@ -0,0 +1,85 @@
{if isset($product->id)}
<div id="product-configuration" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="ServiceProduct" />
<h3 class="tab"> <i class="icon-AdminAdmin"></i> {l s='Service Products'}</h3>
<div class="from-group table-responsive-row clearfix">
<table class="table tableDnD hotel-roomtype-link-table">
<thead>
<tr class="nodrag nodrop">
<th class="col-sm-1">
<span>{l s='Id Product'}</span>
</th>
<th class="col-sm-3">
<span>{l s='name'}</span>
</th>
<th class="">
<span>{l s='Category'}</span>
</th>
<th>
<span>{l s='Position'}</span>
</th>
<th class="">
<span>{l s='Price'}</span>
</th>
<th class="">
<span>{l s='Tax'}</span>
</th>
<th class="text-right">
<span>{l s='Action'}</span>
</th>
</tr>
</thead>
<tbody>
{if isset($service_products) && $service_products}
{foreach from=$service_products key=key item=service_product}
<tr id='room_type_service_product_{$service_product.id_room_type_service_product|escape:'html':'UTF-8'}' position='{$service_product.position|escape:'html':'UTF-8'}' id_product='{$service_product.id_product|escape:'html':'UTF-8'}' id_element="{$product->id}" data-roomtype_url="{$link->getAdminLink('AdminProducts', true)|addslashes}">
<td class="col-sm-1">{$service_product.id_product|escape:'html':'UTF-8'} <a target="blank" href="{$link->getAdminLink('AdminNormalProducts')|escape:'html':'UTF-8'}&amp;id_product={$service_product.id_product|escape:'html':'UTF-8'}&amp;updateproduct"><i class="icon-external-link-sign"></i></a></td>
<td class="">{$service_product.name}</td>
<td class="">{$service_product.category}</td>
<td class="pointer dragHandle center positionImage">
<div class="dragGroup">
<div class="positions">
{$service_product.position + 1}
</div>
</div>
</td>
<td class="">
<span class="field-view service-product-price-text">{if isset($service_product.custom_price) && $service_product.custom_price}{displayPrice price=$service_product.custom_price currency=$id_currency}{else}{displayPrice price=$service_product.default_price currency=$id_currency}{/if}</span>
<div class="field-edit" style="display:none">
<div class="input-group">
<input type="text" value="{if isset($service_product.custom_price) && $service_product.custom_price}{$service_product.custom_price|escape:'html':'UTF-8'}{else}{$service_product.default_price|escape:'html':'UTF-8'}{/if}" class="service-product-price" data-id_product="{$service_product.id_product|escape:'html':'UTF-8'}">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
</div>
</div>
<div class="help-block">{l s='Default price: %s' sprintf={displayPrice price=$service_product.default_price currency=$id_currency}}
</td>
<td>
<span class="field-view service_product_tax_text">{if isset($service_product.tax_rules_group_name) && $service_product.tax_rules_group_name}{$service_product.tax_rules_group_name}{else}{$service_product.default_tax_rules_group_name}{/if}</span>
<div class="field-edit" style="display:none">
<select class="service_product_id_tax_rules_group"{if $tax_exclude_taxe_option}disabled="disabled"{/if}>
<option value="0">{l s='No Tax'}</option>
{foreach from=$tax_rules_groups item=tax_rules_group}
<option value="{$tax_rules_group.id_tax_rules_group}" {if $service_product.id_tax_rules_group == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >
{$tax_rules_group['name']|htmlentitiesUTF8}
</option>
{/foreach}
</select>
</div>
<div class="help-block">{l s='Default tax rule: %s' sprintf=$service_product.default_tax_rules_group_name}
</td>
<td class="text-right">
<a href="#" class="btn btn-default button-edit-price field-view"><i class="icon-pencil"></i></a>
<span class="field-edit" style="display:none">
<a href="#" class="btn btn-default btn-save" data-roomtype_url="{$link->getAdminLink('AdminProducts', true)|addslashes}" data-id_product="{$service_product.id_product|escape:'html':'UTF-8'}" data-id_room_type_service_product_price="{$service_product.id_room_type_service_product_price|escape:'html':'UTF-8'}"><i class="icon-save"></i> {l s='save'}</a>
<a href="#" class="btn btn-default btn-cancel"><i class="icon-times"></i></a>
</span>
</td>
</tr>
{/foreach}
{/if}
</tbody>
</table>
</div>
</div>
{/if}

View File

@@ -1,118 +0,0 @@
{*
* 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
*}
<div id="product-shipping" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Shipping" />
<h3>{l s='Shipping'}</h3>
{if isset($display_common_field) && $display_common_field}
<div class="alert alert-info">{l s='Warning, if you change the value of fields with an orange bullet %s, the value will be changed for all other shops for this product' sprintf=$bullet_common_field}</div>
{/if}
<div class="form-group">
<label class="control-label col-lg-3" for="width">{$bullet_common_field} {l s='Package width'}</label>
<div class="input-group col-lg-2">
<span class="input-group-addon">{$ps_dimension_unit}</span>
<input maxlength="14" id="width" name="width" type="text" value="{$product->width}" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="height">{$bullet_common_field} {l s='Package height'}</label>
<div class="input-group col-lg-2">
<span class="input-group-addon">{$ps_dimension_unit}</span>
<input maxlength="14" id="height" name="height" type="text" value="{$product->height}" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="depth">{$bullet_common_field} {l s='Package depth'}</label>
<div class="input-group col-lg-2">
<span class="input-group-addon">{$ps_dimension_unit}</span>
<input maxlength="14" id="depth" name="depth" type="text" value="{$product->depth}" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="weight">{$bullet_common_field} {l s='Package weight'}</label>
<div class="input-group col-lg-2">
<span class="input-group-addon">{$ps_weight_unit}</span>
<input maxlength="14" id="weight" name="weight" type="text" value="{$product->weight}" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="additional_shipping_cost">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='If a carrier has a tax, it will be added to the shipping fees.'}">
{l s='Additional shipping fees (for a single item)'}
</span>
</label>
<div class="input-group col-lg-2">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix} {if $country_display_tax_label}({l s='tax excl.'}){/if}</span>
<input type="text" id="additional_shipping_cost" name="additional_shipping_cost" onchange="this.value = this.value.replace(/,/g, '.');" value="{$product->additional_shipping_cost|htmlentities}" />
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="availableCarriers">{l s='Carriers'}</label>
<div class="col-lg-9">
<div class="form-control-static row">
<div class="col-xs-6">
<p>{l s='Available carriers'}</p>
<select id="availableCarriers" name="availableCarriers" multiple="multiple">
{foreach $carrier_list as $carrier}
{if !isset($carrier.selected) || !$carrier.selected}
<option value="{$carrier.id_reference}">{$carrier.name}</option>
{/if}
{/foreach}
</select>
<a href="#" id="addCarrier" class="btn btn-default btn-block">{l s='Add'} <i class="icon-arrow-right"></i></a>
</div>
<div class="col-xs-6">
<p>{l s='Selected carriers'}</p>
<select id="selectedCarriers" name="selectedCarriers[]" multiple="multiple">
{foreach $carrier_list as $carrier}
{if isset($carrier.selected) && $carrier.selected}
<option value="{$carrier.id_reference}">{$carrier.name}</option>
{/if}
{/foreach}
</select>
<a href="#" id="removeCarrier" class="btn btn-default btn-block"><i class="icon-arrow-left"></i> {l s='Remove'}</a>
</div>
</div>
</div>
</div>
<div class="form-group" id="no-selected-carries-alert">
<div class="col-lg-offset-3">
<div class="alert alert-warning">{l s='If no carrier is selected then all the carriers will be available for customers orders.'}</div>
</div>
</div>
<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>
</div>

View File

@@ -1,138 +0,0 @@
{*
* 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
*}
<input type="hidden" name="supplier_loaded" value="1">
{if isset($product->id)}
<div id="product-suppliers" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Suppliers" />
<h3>{l s='Suppliers of the current product'}</h3>
<div class="alert alert-info">
{l s='This interface allows you to specify the suppliers of the current product and eventually its combinations.'}<br />
{l s='It is also possible to specify supplier references according to previously associated suppliers.'}<br />
<br />
{l s='When using the advanced stock management tool (see Preferences/Products), the values you define (prices, references) will be used in supply orders.'}
</div>
<label>{l s='Please choose the suppliers associated with this product. Please select a default supplier, as well.'}</label>
<table class="table">
<thead>
<tr>
<th class="fixed-width-xs"><span class="title_box">{l s='Selected'}</span></th>
<th><span class="title_box">{l s='Supplier Name'}</span></th>
<th class="fixed-width-xs"><span class="title_box">{l s='Default'}</span></th>
</tr>
</thead>
<tbody>
{foreach from=$suppliers item=supplier}
<tr>
<td><input type="checkbox" class="supplierCheckBox" name="check_supplier_{$supplier['id_supplier']}" {if $supplier['is_selected'] == true}checked="checked"{/if} value="{$supplier['id_supplier']}" /></td>
<td>{$supplier['name']}</td>
<td><input type="radio" id="default_supplier_{$supplier['id_supplier']}" name="default_supplier" value="{$supplier['id_supplier']}" {if $supplier['is_selected'] == false}disabled="disabled"{/if} {if $supplier['is_default'] == true}checked="checked"{/if} /></td>
</tr>
{/foreach}
</tbody>
</table>
<a class="btn btn-link bt-icon confirm_leave" href="{$link->getAdminLink('AdminSuppliers')|escape:'html':'UTF-8'}&addsupplier">
<i class="icon-plus"></i> {l s='Create a new supplier'} <i class="icon-external-link-sign"></i>
</a>
<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>
</div>
<div class="panel">
<h3>{l s='Supplier reference(s)'}</h3>
<div class="alert alert-info">
{if $associated_suppliers|@count == 0}
{l s='You must specify the suppliers associated with this product. You must also select the default product supplier before setting references.'}
{else}
{l s='You can specify product reference(s) for each associated supplier.'}
{/if}
{l s='Click "Save and Stay" after changing selected suppliers to display the associated product references.'}
</div>
<div class="panel-group" id="accordion-supplier">
{foreach from=$associated_suppliers item=supplier name=data}
<div class="panel">
<div class="panel-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion-supplier" href="#supplier-{$supplier->id}">{if isset($supplier->name)}{$supplier->name}{/if}</a>
</div>
<div id="supplier-{$supplier->id}">
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th><span class="title_box">{l s='Product name'}</span></th>
<th><span class="title_box">{l s='Supplier reference'}</span></th>
<th><span class="title_box">{l s='Unit price tax excluded'}</span></th>
<th><span class="title_box">{l s='Unit price currency'}</span></th>
</tr>
</thead>
<tbody>
{foreach $attributes AS $index => $attribute}
{assign var=reference value=''}
{assign var=price_te value=''}
{assign var=id_currency value=$id_default_currency}
{foreach from=$associated_suppliers_collection item=asc}
{if $asc->id_product == $attribute['id_product'] && $asc->id_product_attribute == $attribute['id_product_attribute'] && $asc->id_supplier == $supplier->id_supplier}
{assign var=reference value=$asc->product_supplier_reference}
{assign var=price_te value=Tools::ps_round($asc->product_supplier_price_te, 2)}
{if $asc->id_currency}
{assign var=id_currency value=$asc->id_currency}
{/if}
{/if}
{/foreach}
<tr {if $index is odd}class="alt_row"{/if}>
<td>{$product_designation[$attribute['id_product_attribute']]}</td>
<td>
<input type="text" value="{$reference|escape:'html':'UTF-8'}" name="supplier_reference_{$attribute['id_product']}_{$attribute['id_product_attribute']}_{$supplier->id_supplier}" />
</td>
<td>
<input type="text" value="{$price_te|htmlentities}" name="product_price_{$attribute['id_product']}_{$attribute['id_product_attribute']}_{$supplier->id_supplier}" />
</td>
<td>
<select name="product_price_currency_{$attribute['id_product']}_{$attribute['id_product_attribute']}_{$supplier->id_supplier}">
{foreach $currencies AS $currency}
<option value="{$currency['id_currency']}"
{if $currency['id_currency'] == $id_currency}selected="selected"{/if}
>{$currency['name']}</option>
{/foreach}
</select>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
{/foreach}
</div>
<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>
</div>
{/if}

View File

@@ -1,155 +0,0 @@
{*
* 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
*}
<script type="text/javascript">
var newLabel = '{l s='New label'}';
var choose_language = '{l s='Choose language:'}';
var required = '{l s='Required'}';
var customizationUploadableFileNumber = '{$product->uploadable_files}';
var customizationTextFieldNumber = '{$product->text_fields}';
var uploadableFileLabel = 0;
var textFieldLabel = 0;
</script>
<div id="product-virtualproduct" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="VirtualProduct" />
<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="{$product->productDownload->filename}" />
<h3>{l s='Virtual Product (services, booking or downloadable products)'}</h3>
<div class="is_virtual_good" class="form-group">
<input type="checkbox" id="is_virtual_good" name="is_virtual_good" value="true" {if $product->is_virtual && $product->productDownload->active}checked="checked"{/if} />
<label for="is_virtual_good" class="t bold">{l s='Is this a virtual product?'}</label>
</div>
<div id="virtual_good" {if !$product->productDownload->id || $product->productDownload->active}style="display:none"{/if} class="form-group">
<div class="form-group">
<label class="control-label col-lg-3">{l s='Does this product have an associated file?'}</label>
<div class="col-lg-2">
<span class="switch prestashop-switch">
<input type="radio" name="is_virtual_file" id="is_virtual_file_on" value="1" {if $product_downloaded} checked="checked"{/if} />
<label for="is_virtual_file_on">{l s='Yes'}</label>
<input type="radio" name="is_virtual_file" id="is_virtual_file_off" value="0" {if !$product_downloaded} checked="checked"{/if} />
<label for="is_virtual_file_off">{l s='No'}</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div id="is_virtual_file_product" style="display:none;">
{if $download_product_file_missing}
<div class="form-group">
<div class="col-lg-push-3 col-lg-9">
<div class="alert alert-danger" id="file_missing">
{$download_product_file_missing} :<br/>
<strong>{l s='Server file name : %s'|sprintf:$product->productDownload->filename}</strong>
</div>
</div>
</div>
{/if}
{if !$download_dir_writable}
<div class="form-group">
<div class="col-lg-push-3 col-lg-9">
<div class="alert alert-danger">
{l s='Your download repository is not writable.'}
</div>
</div>
</div>
{/if}
{* Don't display file form if the product has combinations *}
{if empty($product->cache_default_attribute)}
{if $product->productDownload->id}
<input type="hidden" id="virtual_product_id" name="virtual_product_id" value="{$product->productDownload->id}" />
{/if}
<div class="form-group"{if $is_file} style="display:none"{/if}>
<label id="virtual_product_file_label" for="virtual_product_file" class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Upload a file from your computer'} ({Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE')|string_format:'%.2f'} {l s='MB max.'})">
{l s='File'}
</span>
</label>
<div class="col-lg-5">
{$virtual_product_file_uploader}
<p class="help-block">{l s='Upload a file from your computer'} ({Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE')|string_format:'%.2f'} {l s='MB max.'})</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3 required">{l s='Filename'}</label>
<div class="col-lg-5">
<input type="text" id="virtual_product_name" name="virtual_product_name" value="{$product->productDownload->display_filename|escape:'html':'UTF-8'}" />
<p class="help-block">{l s='The full filename with its extension (e.g. Book.pdf)'}</p>
</div>
</div>
{if $is_file}
<div class="form-group">
<label class="control-label col-lg-3">{l s='Link to the file:'}</label>
<div class="col-lg-5">
<a href="{$product->productDownload->getTextLink(true)}" class="btn btn-default"><i class="icon-download"></i> {l s='Download file'}</a>
<a href="{$currentIndex|escape:'html':'UTF-8'}&amp;deleteVirtualProduct=true&amp;updateproduct&amp;token={$token|escape:'html':'UTF-8'}&amp;id_product={$product->id}" class="btn btn-default" onclick="return confirm('{l s='Do you really want to delete this file?' js=1}');"><i class="icon-trash"></i> {l s='Delete this file'}</a>
</div>
</div>
{/if}
<div class="form-group">
<label class="control-label col-lg-3">{l s='Number of allowed downloads'}</label>
<div class="col-lg-3">
<input type="text" id="virtual_product_nb_downloable" name="virtual_product_nb_downloable" value="{$product->productDownload->nb_downloadable|htmlentities}" class="" size="6" />
<p class="help-block">{l s='Number of downloads allowed per customer. Set to 0 for unlimited downloads.'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" title="" data-original-title="{l s='Format: YYYY-MM-DD.'}">
{l s='Expiration date'}
</span>
</label>
<div class="col-lg-5">
<input class="datepicker" type="text" id="virtual_product_expiration_date" name="virtual_product_expiration_date" value="{$product->productDownload->date_expiration}" size="11" maxlength="10" autocomplete="off" />
<p class="help-block">{l s='If set, the file will not be downloadable after this date. Leave blank if you do not wish to attach an expiration date.'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3 required">{l s='Number of days'}</label>
<div class="col-lg-3">
<input type="text" id="virtual_product_nb_days" name="virtual_product_nb_days" value="{if !$product->productDownload->nb_days_accessible}0{else}{$product->productDownload->nb_days_accessible|htmlentities}{/if}" class="" size="4" />
<p class="help-block">{l s='Number of days this file can be accessed by customers. Set to zero for unlimited access.'}</p>
</div>
</div>
{* Feature not implemented *}
{*<div class="form-group">*}
{*<label for="virtual_product_is_shareable" class="control-label col-lg-3">{l s='is shareable'}</label>*}
{*<div class="col-lg-9">*}
{*<input type="checkbox" id="virtual_product_is_shareable" name="virtual_product_is_shareable" value="1" {if $product->productDownload->is_shareable}checked="checked"{/if} />*}
{*<span class="alert alert-info" name="help_box" style="display:none">{l s='Please specify if the file can be shared.'}</span>*}
{*</div>*}
{*</div>*}
{else}
<div class="alert alert-info">
{l s='You cannot edit your file here because you used combinations. Please edit this file in the Combinations tab.'}
</div>
{if isset($error_product_download)}{$error_product_download}{/if}
{/if}
</div>
</div>
<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>
</div>

View File

@@ -1,100 +0,0 @@
{*
* 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
*}
<input type="hidden" name="warehouse_loaded" value="1">
{if isset($product->id)}
<div id="product-warehouses" class="panel product-tab">
<input type="hidden" name="submitted_tabs[]" value="Warehouses" />
<h3>{l s='Product location in warehouses'}</h3>
<div class="row">
<div class="alert alert-info" style="display:block; position:'auto';">
<p>{l s='This interface allows you to specify the warehouse in which the product is stocked.'}</p>
<p>{l s='You can also specify product/product combinations as it relates to warehouse location. '}</p>
</div>
<p>{l s='Please choose the warehouses associated with this product.'}</p>
</div>
<div class="row">
<a class="btn btn-link confirm_leave" href="{$link->getAdminLink('AdminWarehouses')|escape:'html':'UTF-8'}&addwarehouse">{l s='Create a new warehouse'} <i class="icon-external-link-sign"></i></a>
</div>
<div class="row">
<div class="panel-group" id="warehouse-accordion">
{foreach from=$warehouses item=warehouse name=data}
<div class="panel panel-default">
<div class="panel-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#warehouse-accordion" href="#warehouse-{$warehouse['id_warehouse']}">{$warehouse['name']}</a>
</div>
<div id="warehouse-{$warehouse['id_warehouse']}">
<table class="table">
<thead>
<tr>
<th class="fixed-width-xs" align="center"><span class="title_box">{l s='Stored'}</span></th>
<th><span class="title_box">{l s='Product'}</span></th>
<th><span class="title_box">{l s='Location (optional)'}</span></th>
</tr>
</thead>
<tbody>
{foreach $attributes AS $index => $attribute}
{assign var=location value=''}
{assign var=selected value=''}
{foreach from=$associated_warehouses item=aw}
{if $aw->id_product == $attribute['id_product'] && $aw->id_product_attribute == $attribute['id_product_attribute'] && $aw->id_warehouse == $warehouse['id_warehouse']}
{assign var=location value=$aw->location}
{assign var=selected value=true}
{/if}
{/foreach}
<tr {if $index is odd}class="alt_row"{/if}>
<td class="fixed-width-xs" align="center"><input type="checkbox"
name="check_warehouse_{$warehouse['id_warehouse']}_{$attribute['id_product']}_{$attribute['id_product_attribute']}"
{if $selected == true}checked="checked"{/if}
value="1" />
</td>
<td>{$product_designation[$attribute['id_product_attribute']]}</td>
<td><input type="text"
name="location_warehouse_{$warehouse['id_warehouse']}_{$attribute['id_product']}_{$attribute['id_product_attribute']}"
value="{$location|escape:'html':'UTF-8'}"
size="20" />
</td>
</tr>
{/foreach}
</table>
{if $attributes|@count gt 1}
<button type="button" class="btn btn-default check_all_warehouse" value="check_warehouse_{$warehouse['id_warehouse']}"><i class="icon-check-sign"></i> {l s='Mark / Unmark all product combinations as stored in this warehouse'}</button>
<!--<tr>
<td><input type="checkbox" class="check_all_warehouse" value="check_warehouse_{$warehouse['id_warehouse']}" /></td>
<td colspan="2"><i></i></td>
</tr>-->
{/if}
</div>
</div>
{/foreach}
</div>
</div>
<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>
</div>
{/if}

View File

@@ -0,0 +1,102 @@
{*
* 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
*}
<div class="panel">
{if isset($header)}{$header}{/if}
{if isset($nodes)}
<ul id="{$id|escape:'html':'UTF-8'}" class="cattree tree">
{$nodes}
</ul>
{/if}
</div>
<script type="text/javascript">
var currentToken="{$token|@addslashes}";
{if isset($use_checkbox) && $use_checkbox == true}
function checkAllAssociatedCategories($tree)
{
$tree.find(":input[type=checkbox]").each(
function()
{
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
}
);
}
function uncheckAllAssociatedCategories($tree)
{
$tree.find(":input[type=checkbox]").each(
function()
{
$(this).prop("checked", false);
$(this).parent().removeClass("tree-selected");
}
);
}
{/if}
{if isset($use_search) && $use_search == true}
$("#{$id|escape:'html':'UTF-8'}-categories-search").bind("typeahead:selected", function(obj, datum) {
$("#{$id|escape:'html':'UTF-8'}").find(":input").each(
function()
{
if ($(this).val() == datum.id_category)
{
{if (!(isset($use_checkbox) && $use_checkbox == true))}
$("#{$id|escape:'html':'UTF-8'} label").removeClass("tree-selected");
{/if}
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents('ul.tree').each(function(){
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
}
}
);
});
{/if}
$(document).ready(function () {
$("#{$id|escape:'html':'UTF-8'}").tree("collapseAll");
{if isset($selected_categories)}
{assign var=imploded_selected_categories value='","'|implode:$selected_categories}
var selected_categories = new Array("{$imploded_selected_categories}");
$("#{$id|escape:'html':'UTF-8'}").find(":input").each(
function()
{
if ($.inArray($(this).val(), selected_categories) != -1)
{
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
$(this).parents('ul.tree').each(function(){
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
}
}
);
{/if}
});
</script>

View File

@@ -0,0 +1,37 @@
{*
* 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
*}
<li class="tree-folder">
<span class="tree-folder-name{if isset($node['disabled']) && $node['disabled'] == true} tree-folder-name-disable{/if}">
{if isset($node['id_hotel'])}
<input type="checkbox" class="select_hotel" name="{$input_name}[]" value="{$node['id_hotel']}"{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} />
{* {if isset($node['id_category']) && $node['id_category'] != $root_category} *}
{/if}
<i class="icon-folder-close"></i>
<label class="tree-toggler">{if isset($node['name'])}{$node['name']|escape:'html':'UTF-8'}{/if}{if isset($node['selected_childs']) && (int)$node['selected_childs'] > 0} {l s='(%s selected)' sprintf=$node['selected_childs']}{/if}</label>
</span>
<ul class="tree">
{$children|escape:'UTF-8'}
</ul>
</li>

View File

@@ -0,0 +1,31 @@
{*
* 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
*}
<li class="tree-item{if isset($node['disabled']) && $node['disabled'] == true} tree-item-disable{/if}">
<span class="tree-item-name{if isset($node['disabled']) && $node['disabled'] == true} tree-item-name-disable{/if}">
<input type="checkbox" class="select_room_type" name="{$input_name}[]" value="{$node['id_product']}"{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} />
<i class="tree-dot"></i>
<label class="tree-toggler">{$node['room_type']}</label>
</span>
</li>

View File

@@ -177,6 +177,14 @@ class CartCore extends ObjectModel
const ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING = 8;
const ADVANCE_PAYMENT = 9;
const ADVANCE_PAYMENT_ONLY_PRODUCTS = 10;
const ONLY_ROOMS = 11;
const ONLY_ROOM_SERVICES = 12;
const ONLY_SERVICE_PRODUCTS = 13;
const ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE = 14;
const ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD = 16;
const ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE = 17;
const ONLY_CONVENIENCE_FEE = 18;
public function __construct($id = null, $id_lang = null)
{
@@ -334,7 +342,6 @@ class CartCore extends ObjectModel
foreach ($products as $product) {
// products refer to the cart details
$address_id = Cart::getIdAddressForTaxCalculation($product['id_product']);
if (!Address::addressExists($address_id)) {
$address_id = null;
@@ -525,7 +532,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`,
$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`, product_shop.`allow_multiple_quantity`,
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`,
@@ -561,6 +568,10 @@ class CartCore extends ObjectModel
$sql->where('cp.`id_product` = '.(int)$id_product);
}
$sql->where('p.`id_product` IS NOT NULL');
// hide invisible products
// if ($front) {
// $sql->where('p.`is_invisible` = 0');
// }
// Build ORDER BY
$sql->orderBy('cp.`date_add`, cp.`id_product`, cp.`id_product_attribute` ASC');
@@ -735,18 +746,19 @@ class CartCore extends ObjectModel
//
/*By Webkul */
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
// by webkul to calculate rates of the product from hotelreservation syatem tables with feature prices....
$objCartBookingData = new HotelCartBookingData();
$roomTypesByIdProduct = $objCartBookingData->getCartInfoIdCartIdProduct($this->id, (int)$row['id_product']);
if ($row['booking_product']) {
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
// by webkul to calculate rates of the product from hotelreservation syatem tables with feature prices....
$objCartBookingData = new HotelCartBookingData();
$roomTypesByIdProduct = $objCartBookingData->getCartInfoIdCartIdProduct($this->id, (int)$row['id_product']);
// by webkul to calculate rates of the product from hotelreservation syatem tables with feature prices....
$totalPriceByProductTaxIncl = 0;
$totalPriceByProductTaxExcl = 0;
$priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id);
foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) {
$roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
// by webkul to calculate rates of the product from hotelreservation syatem tables with feature prices....
$totalPriceByProductTaxIncl = 0;
$totalPriceByProductTaxExcl = 0;
$priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id);
foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) {
$roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$cartRoomInfo['id_product'],
$cartRoomInfo['date_from'],
$cartRoomInfo['date_to'],
@@ -754,11 +766,34 @@ class CartCore extends ObjectModel
Group::getCurrent()->id,
$cartRoomInfo['id_cart'],
$cartRoomInfo['id_guest'],
$cartRoomInfo['id_room']
$cartRoomInfo['id_room'],
0
);
$totalPriceByProductTaxIncl += $roomTotalPrice['total_price_tax_incl'];
$totalPriceByProductTaxExcl += $roomTotalPrice['total_price_tax_excl'];
$totalPriceByProductTaxIncl += $roomTotalPrice['total_price_tax_incl'];
$totalPriceByProductTaxExcl += $roomTotalPrice['total_price_tax_excl'];
}
switch (Configuration::get('PS_ROUND_TYPE')) {
case Order::ROUND_TOTAL:
$row['total'] = $totalPriceByProductTaxExcl;
$row['total_wt'] = $totalPriceByProductTaxIncl;
break;
case Order::ROUND_LINE:
$row['total'] = Tools::ps_round($totalPriceByProductTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$row['total_wt'] = Tools::ps_round($totalPriceByProductTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
break;
case Order::ROUND_ITEM:
default:
$row['total'] = Tools::ps_round($totalPriceByProductTaxExcl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
$row['total_wt'] = Tools::ps_round($totalPriceByProductTaxIncl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
break;
}
}
} else if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $row['service_product_type']) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$totalPriceByProductTaxIncl = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart($this->id, (int)$row['id_product'], 0, 0, 0, 0, 0, 1, true, null);
$totalPriceByProductTaxExcl = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart($this->id, (int)$row['id_product'], 0, 0, 0, 0, 0, 1, false, null);
switch (Configuration::get('PS_ROUND_TYPE')) {
case Order::ROUND_TOTAL:
@@ -776,6 +811,29 @@ class CartCore extends ObjectModel
$row['total_wt'] = Tools::ps_round($totalPriceByProductTaxIncl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
break;
}
} 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);
switch (Configuration::get('PS_ROUND_TYPE'))
{
case Order::ROUND_TOTAL:
$row['total'] = $unitPriceByProductTaxExcl * (int)$row['cart_quantity'];
$row['total_wt'] = $unitPriceByProductTaxIncl * (int)$row['cart_quantity'];
break;
case Order::ROUND_LINE:
$row['total'] = Tools::ps_round($unitPriceByProductTaxExcl * (int)$row['cart_quantity'], _PS_PRICE_COMPUTE_PRECISION_);
$row['total_wt'] = Tools::ps_round($unitPriceByProductTaxIncl * (int)$row['cart_quantity'], _PS_PRICE_COMPUTE_PRECISION_);
break;
case Order::ROUND_ITEM:
default:
$row['total'] = Tools::ps_round($unitPriceByProductTaxExcl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
$row['total_wt'] = Tools::ps_round($unitPriceByProductTaxIncl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
break;
}
$row['price_wt'] = $row['price_with_reduction'];
}
/*END*/
@@ -808,6 +866,45 @@ class CartCore extends ObjectModel
return $this->_products;
}
public function getServiceProducts($productList = false)
{
if (!is_array($productList)) {
$productList = $this->getProducts();
}
$serviceProducts = array();
$context = Context::getContext();
foreach ($productList as $key => $product) {
if (!$product['booking_product'] && (Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE == $product['service_product_type'])) {
if (Validate::isLoadedObject(
$objProduct = new Product($product['id_product'], false, $this->id_lang)
)) {
// $address = Address::initialize($product['id_address_delivery']);
// $product['id_hotel'] = $address->id_hotel;
// $objHotelBranch = new HotelBranchInformation();
// $product['hotel'] = $objHotelBranch->hotelBranchInfoById($product['id_hotel']);
$coverImageArr = $objProduct->getCover($product['id_product']);
if (!empty($coverImageArr)) {
$coverImg = $context->link->getImageLink(
$objProduct->link_rewrite,
$objProduct->id.'-'.$coverImageArr['id_image'],
'small_default'
);
} else {
$coverImg = $context->link->getImageLink(
$objProduct->link_rewrite,
$context->language->iso_code.'-default',
'small_default'
);
}
$product['cover_img'] = $coverImg;
$serviceProducts[] = $product;
}
}
}
return $serviceProducts;
}
public static function cacheSomeAttributesLists($ipa_list, $id_lang)
{
if (!Combination::isFeatureActive()) {
@@ -1036,7 +1133,7 @@ class CartCore extends ObjectModel
if ((int)$quantity <= 0) {
return $this->deleteProduct($id_product, $id_product_attribute, (int)$id_customization, 0, $auto_add_cart_rule);
} elseif (!$product->available_for_order || (Configuration::get('PS_CATALOG_MODE') && !defined('_PS_ADMIN_DIR_'))) {
} elseif (Configuration::get('PS_CATALOG_MODE') && !defined('_PS_ADMIN_DIR_')) {
return false;
} else {
/* Check if the product is already in the cart */
@@ -1081,12 +1178,12 @@ class CartCore extends ObjectModel
return -1;
} else {
Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'cart_product`
SET `quantity` = `quantity` '.$qty.', `date_add` = NOW()
WHERE `id_product` = '.(int)$id_product.
UPDATE `'._DB_PREFIX_.'cart_product`
SET `quantity` = `quantity` '.$qty.', `date_add` = NOW()
WHERE `id_product` = '.(int)$id_product.
(!empty($id_product_attribute) ? ' AND `id_product_attribute` = '.(int)$id_product_attribute : '').'
AND `id_cart` = '.(int)$this->id.(Configuration::get('PS_ALLOW_MULTISHIPPING') && $this->isMultiAddressDelivery() ? ' AND `id_address_delivery` = '.(int)$id_address_delivery : '').'
LIMIT 1'
AND `id_cart` = '.(int)$this->id.(Configuration::get('PS_ALLOW_MULTISHIPPING') && $this->isMultiAddressDelivery() ? ' AND `id_address_delivery` = '.(int)$id_address_delivery : '').'
LIMIT 1'
);
}
}
@@ -1132,7 +1229,7 @@ class CartCore extends ObjectModel
// refresh cache of self::_products
$this->_products = $this->getProducts(true);
$this->update();
$this->update(false);
$context = Context::getContext()->cloneContext();
$context->cart = $this;
Cache::clean('getContextualValue_*');
@@ -1504,6 +1601,13 @@ class CartCore extends ObjectModel
$type = (int)$type;
$array_type = array(
Cart::ONLY_PRODUCTS,
Cart::ONLY_ROOMS,
Cart::ONLY_ROOM_SERVICES,
Cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE,
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_DISCOUNTS,
Cart::BOTH,
Cart::BOTH_WITHOUT_SHIPPING,
@@ -1561,7 +1665,7 @@ class CartCore extends ObjectModel
$param_product = true;
if (is_null($products)) {
$param_product = false;
$products = $this->getProducts();
$products = $this->getProducts(false, false, null, false);
}
if ($type == Cart::ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING) {
@@ -1583,8 +1687,57 @@ class CartCore extends ObjectModel
$totalDemandsPrice = 0;
$objCartBookingData = new HotelCartBookingData();
foreach ($products as $product) {
// products refer to the cart details
// 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_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;
}
} else {
if ($type == Cart::ONLY_ROOMS) {
continue;
}
if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type']) {
if ($type == Cart::ONLY_SERVICE_PRODUCTS) {
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;
}
} else {
if ($type == Cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE
|| $type == Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE
) {
continue;
}
}
} else {
if ($type == Cart::ONLY_CONVENIENCE_FEE
|| $type == Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE
) {
continue;
}
}
} else {
if ($type == Cart::ONLY_ROOM_SERVICES) {
continue;
}
}
}
// products refer to the cart details
if ($virtual_context->shop->id != $product['id_shop']) {
$virtual_context->shop = new Shop((int)$product['id_shop']);
}
@@ -1615,7 +1768,8 @@ class CartCore extends ObjectModel
$null,
$ps_use_ecotax,
true,
$virtual_context
$virtual_context,
false
);
$address = $address_factory->findOrCreate($id_address, true);
@@ -1635,62 +1789,93 @@ class CartCore extends ObjectModel
$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']) {
// by webkul to calculate rates of the product from hotelreservation syatem tables with feature prices....
$roomTypesByIdProduct = $objCartBookingData->getCartInfoIdCartIdProduct($this->id, $product['id_product']);
$totalPriceByProduct = 0;
$priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id);
foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) {
// get the real price of the room type
$roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$cartRoomInfo['id_product'],
$cartRoomInfo['date_from'],
$cartRoomInfo['date_to'],
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$totalPriceByProduct = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$this->id,
(int)$product['id_product'],
isset($product['id_hotel']) ? $product['id_hotel'] : 0,
0,
Group::getCurrent()->id,
$cartRoomInfo['id_cart'],
$cartRoomInfo['id_guest'],
$cartRoomInfo['id_room']
0,
0,
0,
1,
$with_taxes,
null
);
if ($with_taxes) {
$totalPriceByProduct += $roomTotalPrice['total_price_tax_incl'];
} else {
$totalPriceByProduct += $roomTotalPrice['total_price_tax_excl'];
}
// 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,
} else if ($roomTypesByIdProduct = $objCartBookingData->getCartInfoIdCartIdProduct($this->id, $product['id_product'])) {
// by webkul to calculate rates of the product from hotelreservation syatem tables with feature prices....
$totalPriceByProduct = 0;
$priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id);
foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) {
// get the real price of the room type
$roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$cartRoomInfo['id_product'],
$cartRoomInfo['date_from'],
$cartRoomInfo['date_to'],
0,
0,
$with_taxes
Group::getCurrent()->id,
$cartRoomInfo['id_cart'],
$cartRoomInfo['id_guest'],
$cartRoomInfo['id_room'],
0
);
if ($with_taxes) {
$totalPriceByProduct += $roomTotalPrice['total_price_tax_incl'];
} else {
$totalPriceByProduct += $roomTotalPrice['total_price_tax_excl'];
}
// set advance payment price only if it is greater than real price
if ($advProductPrice < $totalPriceByProduct) {
$totalPriceByProduct = $advProductPrice;
// 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'],
0,
0,
$with_taxes
);
// set advance payment price only if it is greater than real price
if ($advProductPrice < $totalPriceByProduct) {
$totalPriceByProduct = $advProductPrice;
}
}
}
}
switch ($ps_round_type) {
case Order::ROUND_TOTAL:
$products_total[$id_tax_rules_group.'_'.$id_address] += $totalPriceByProduct;
if ($product['booking_product'] || (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type'])) {
$products_total[$id_tax_rules_group.'_'.$id_address] += $totalPriceByProduct;
} else {
$products_total[$id_tax_rules_group.'_'.$id_address] += $price * (int)$product['cart_quantity'];
}
break;
case Order::ROUND_LINE:
$product_price = $totalPriceByProduct;
if ($product['booking_product'] || (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type'])) {
$product_price = $totalPriceByProduct;
} else {
$product_price = $price * $product['cart_quantity'];
}
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision);
break;
case Order::ROUND_ITEM:
default:
$product_price = $totalPriceByProduct;
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision);
if ($product['booking_product'] || (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type'])) {
$product_price = $totalPriceByProduct;
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision);
} else {
$product_price = /*$with_taxes ? $tax_calculator->addTaxes($price) : */$price;
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision) * (int)$product['cart_quantity'];
}
break;
}
@@ -1732,7 +1917,19 @@ class CartCore extends ObjectModel
$order_total_discount = 0;
$order_shipping_discount = 0;
$advance_payment_products_discount = 0;
if (!in_array($type, array(Cart::ONLY_SHIPPING, Cart::ONLY_PRODUCTS, Cart::ADVANCE_PAYMENT_ONLY_PRODUCTS)) && CartRule::isFeatureActive()) {
if (!in_array($type, array(
Cart::ONLY_SHIPPING,
Cart::ONLY_PRODUCTS,
Cart::ONLY_ROOMS,
Cart::ADVANCE_PAYMENT_ONLY_PRODUCTS,
Cart::ONLY_ROOM_SERVICES,
Cart::ONLY_SERVICE_PRODUCTS,
Cart::ONLY_CONVENIENCE_FEE,
Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD,
Cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE,
Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE)
) && CartRule::isFeatureActive()
) {
// First, retrieve the cart rules associated to this "getOrderTotal"
if ($with_shipping || $type == Cart::ONLY_DISCOUNTS) {
$cart_rules = $this->getCartRules(CartRule::FILTER_ACTION_ALL);
@@ -1916,7 +2113,7 @@ class CartCore extends ObjectModel
return $cache[$cache_key];
}
$product_list = $this->getProducts($flush);
$product_list = $this->getProducts($flush, false, null, true);
// Step 1 : Get product informations (warehouse_list and carrier_list), count warehouse
// Determine the best warehouse to determine the packages
// For that we count the number of time we can use a warehouse for a specific delivery address
@@ -2146,42 +2343,163 @@ class CartCore extends ObjectModel
// Step 6 : Break $package_list hotel wise
$orderPackage = array();
$serviceProducts = array();
$objRoomType = new HotelRoomType();
$objHtlCartBookingData = new HotelCartBookingData();
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$objHotelServiceProductCartDetail = new HotelServiceProductCartDetail();
foreach ($final_package_list as $id_address => $packages) {
foreach ($packages as $id_package => $package) {
foreach ($package['product_list'] as $product) {
$productInfo = $objRoomType->getRoomTypeInfoByIdProduct($product['id_product']);
$idHotel = $productInfo['id_hotel'] ? $productInfo['id_hotel'] : 0;
if ($product['booking_product']) {
$productInfo = $objRoomType->getRoomTypeInfoByIdProduct($product['id_product']);
$idHotel = $productInfo['id_hotel'] ? $productInfo['id_hotel'] : 0;
$orderPackage[$id_address][$idHotel]['product_list'][] = $product;
if (!isset($orderPackage[$id_address][$idHotel]['carrier_list'])) {
$orderPackage[$id_address][$idHotel]['carrier_list'] = $product['carrier_list'];
$orderPackage[$id_address][$idHotel]['product_list'][] = $product;
$orderPackage[$id_address][$idHotel]['id_hotel'] = $idHotel;
if (!isset($orderPackage[$id_address][$idHotel]['id_hotel'])) {
$orderPackage[$id_address][$idHotel]['id_hotel'] = $productInfo['id_hotel'];
}
if (!isset($orderPackage[$id_address][$idHotel]['carrier_list'])) {
$orderPackage[$id_address][$idHotel]['carrier_list'] = $product['carrier_list'];
} else {
$orderPackage[$id_address][$idHotel]['carrier_list'] = array_intersect($orderPackage[$id_address][$idHotel]['carrier_list'], $product['carrier_list']);
}
if (!isset($orderPackage[$id_address][$idHotel]['warehouse_list'])) {
$orderPackage[$id_address][$idHotel]['warehouse_list'] = $package['warehouse_list'];
}
if (!isset($orderPackage[$id_address][$idHotel]['id_warehouse'])) {
$orderPackage[$id_address][$idHotel]['id_warehouse'] = $package['id_warehouse'];
}
if (isset($package['id_carrier'])) {
if (!isset($orderPackage[$id_address][$idHotel]['id_carrier'])) {
$orderPackage[$id_address][$idHotel]['id_carrier'] = $package['id_carrier'];
}
}
} else {
$orderPackage[$id_address][$idHotel]['carrier_list'] = array_intersect($orderPackage[$id_address][$idHotel]['carrier_list'], $product['carrier_list']);
}
if (!isset($orderPackage[$id_address][$idHotel]['warehouse_list'])) {
$orderPackage[$id_address][$idHotel]['warehouse_list'] = $package['warehouse_list'];
}
if (!isset($orderPackage[$id_address][$idHotel]['id_warehouse'])) {
$orderPackage[$id_address][$idHotel]['id_warehouse'] = $package['id_warehouse'];
}
if (isset($package['id_carrier'])) {
if (!isset($orderPackage[$id_address][$idHotel]['id_carrier'])) {
$orderPackage[$id_address][$idHotel]['id_carrier'] = $package['id_carrier'];
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)) {
$array = array();
foreach($selectedServiceProducts as $selectedProduct) {
if (isset($array[$selectedProduct['id_hotel']])) {
$array[$selectedProduct['id_hotel']]['quantity'] += $selectedProduct['quantity'];
} else {
$array[$selectedProduct['id_hotel']] = array(
'quantity' => $selectedProduct['quantity'],
'id_hotel' => $selectedProduct['id_hotel']
);
}
}
foreach($array as $selectedProduct) {
$product['cart_quantity'] = $selectedProduct['quantity'];
$product['id_hotel'] = $selectedProduct['id_hotel'];
$orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $product;
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'] = $selectedProduct['id_hotel'];
}
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = $product['carrier_list'];
} else {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'], $product['carrier_list']);
}
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list'];
}
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse'];
}
if (isset($package['id_carrier'])) {
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'] = $package['id_carrier'];
}
}
}
}
} else {
if ($selectedServiceProducts = $objHotelServiceProductCartDetail->getHotelProducts($this->id, $product
['id_product'])) {
foreach($selectedServiceProducts 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_wt'] = $unitPriceWt;
// 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
);
// }
// }
}
}
}
}
}
}
}
$hotelWisePackageList = array();
$numHotels = 0;
if (!empty($serviceProducts)) {
foreach ($serviceProducts as $id_address => $packagesByHotels) {
foreach ($packagesByHotels as $packageByHotel) {
$hotelWisePackageList[$id_address][] = $packageByHotel;
}
}
}
foreach ($orderPackage as $id_address => $packageByAddress) {
$numHotels += count($packageByAddress);
foreach ($packageByAddress as $id_package => $package) {
$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;
return $final_package_list;
}
@@ -2339,9 +2657,9 @@ class CartCore extends ObjectModel
$best_price_carrier[$id_carrier]['product_list'] = array_merge($best_price_carrier[$id_carrier]['product_list'], $packages[$id_package]['product_list']);
$best_price_carrier[$id_carrier]['instance'] = $carriers_instance[$id_carrier];
$real_best_price = !isset($real_best_price) || $real_best_price > $carriers_price[$id_address][$id_package][$id_carrier]['with_tax'] ?
$carriers_price[$id_address][$id_package][$id_carrier]['with_tax'] : $real_best_price;
$carriers_price[$id_address][$id_package][$id_carrier]['with_tax'] : $real_best_price;
$real_best_price_wt = !isset($real_best_price_wt) || $real_best_price_wt > $carriers_price[$id_address][$id_package][$id_carrier]['without_tax'] ?
$carriers_price[$id_address][$id_package][$id_carrier]['without_tax'] : $real_best_price_wt;
$carriers_price[$id_address][$id_package][$id_carrier]['without_tax'] : $real_best_price_wt;
}
// Add the delivery option with best price as best price
@@ -2711,9 +3029,15 @@ class CartCore extends ObjectModel
return $collection;
}
public static function getIdAddressForTaxCalculation($id_product)
public static function getIdAddressForTaxCalculation($id_product, $id_hotel = false)
{
return HotelRoomType::getHotelIdAddressByIdProduct($id_product);
if (Product::isBookingProduct($id_product)) {
return HotelRoomType::getHotelIdAddressByIdProduct($id_product);
} else if ($id_hotel) {
$addressInfo = HotelBranchInformation::getAddress($id_hotel);
return $addressInfo['id_address'];
}
return false;
}
/**
@@ -3357,10 +3681,21 @@ class CartCore extends ObjectModel
$total_shipping_tax_exc = $this->getTotalShippingCost(null, false);
$total_products_wt = $this->getOrderTotal(true, Cart::ONLY_PRODUCTS);
$total_products = $this->getOrderTotal(false, Cart::ONLY_PRODUCTS);
$total_rooms_wt = $this->getOrderTotal(true, Cart::ONLY_ROOMS);
$total_rooms = $this->getOrderTotal(false, Cart::ONLY_ROOMS);
$total_additional_services_wt = $this->getOrderTotal(true, Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD);
$total_additional_services = $this->getOrderTotal(false, Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD);
$total_additional_services_auto_add_wt = $this->getOrderTotal(true, Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE);
$total_additional_services_auto_add = $this->getOrderTotal(false, Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE);
$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_discounts = $this->getOrderTotal(true, Cart::ONLY_DISCOUNTS);
$total_discounts_tax_exc = $this->getOrderTotal(false, Cart::ONLY_DISCOUNTS);
$objCartBookingData = new HotelCartBookingData();
$totalDemandsWT = $objCartBookingData->getCartExtraDemands(
$total_demands_wt = $objCartBookingData->getCartExtraDemands(
$this->id,
0,
0,
@@ -3370,7 +3705,7 @@ class CartCore extends ObjectModel
0,
1
);
$totalDemandsTaxExcl = $objCartBookingData->getCartExtraDemands(
$total_demands = $objCartBookingData->getCartExtraDemands(
$this->id,
0,
0,
@@ -3408,6 +3743,15 @@ class CartCore extends ObjectModel
$total_products_wt = Tools::ps_round($total_products_wt - $product['price_wt'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
$total_products = Tools::ps_round($total_products - $product['price'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
if ($product['is_virtual']) {
$total_rooms_wt = Tools::ps_round($total_rooms_wt - $product['price_wt'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
$total_rooms = Tools::ps_round($total_rooms - $product['price'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
} else {
$total_normal_products_wt = Tools::ps_round($total_normal_products_wt - $product['price_wt'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
$total_normal_products = Tools::ps_round($total_normal_products - $product['price'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
}
// Update total discounts
$total_discounts = Tools::ps_round($total_discounts - $product['price_wt'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
$total_discounts_tax_exc = Tools::ps_round($total_discounts_tax_exc - $product['price'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
@@ -3465,8 +3809,19 @@ class CartCore extends ObjectModel
'total_shipping_tax_exc' => $total_shipping_tax_exc,
'total_products_wt' => $total_products_wt,
'total_products' => $total_products,
'total_extra_demands_wt' => $totalDemandsWT,
'total_extra_demands_tax_exc' => $totalDemandsTaxExcl,
'total_rooms_wt' => $total_rooms_wt,
'total_rooms' => $total_rooms,
'total_additional_services_wt' => $total_additional_services_wt,
'total_additional_services' => $total_additional_services,
'total_additional_services_auto_add_wt' => $total_additional_services_auto_add_wt,
'total_additional_services_auto_add' => $total_additional_services_auto_add,
'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_extra_demands_wt' => $total_demands_wt,
'total_extra_demands' => $total_demands,
'total_price' => $base_total_tax_inc,
'total_tax' => $total_tax,
'total_price_without_tax' => $base_total_tax_exc,

View File

@@ -592,9 +592,9 @@ class CategoryCore extends ObjectModel
SELECT c.*, cl.*
FROM `'._DB_PREFIX_.'category` c
'.($use_shop_restriction ? Shop::addSqlAssociation('category', 'c') : '').'
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').'
'.(isset($groups) && Group::isFeatureActive() ? 'LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON c.`id_category` = cg.`id_category`' : '').'
'.(isset($root_category) ? 'RIGHT JOIN `'._DB_PREFIX_.'category` c2 ON c2.`id_category` = '.(int)$root_category.' AND c.`nleft` >= c2.`nleft` AND c.`nright` <= c2.`nright`' : '').'
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').''.(isset($groups) && Group::isFeatureActive() ? '
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON c.`id_category` = cg.`id_category`' : '').''.(isset($root_category) ? '
RIGHT JOIN `'._DB_PREFIX_.'category` c2 ON c2.`id_category` = '.(int)$root_category.' AND c.`nleft` >= c2.`nleft` AND c.`nright` <= c2.`nright`' : '').'
WHERE 1 '.$sql_filter.' '.($id_lang ? 'AND `id_lang` = '.(int)$id_lang : '').'
'.($active ? ' AND c.`active` = 1' : '').'
'.(isset($groups) && Group::isFeatureActive() ? ' AND cg.`id_group` IN ('.implode(',', $groups).')' : '').'
@@ -723,10 +723,9 @@ class CategoryCore extends ObjectModel
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
WHERE cp.`id_category` = '.(int)$this->id.
($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').
($front ? ' AND product_shop.`show_at_front` = 1' : '').
($active ? ' AND product_shop.`active` = 1' : '').
($id_supplier ? 'AND p.id_supplier = '.(int)$id_supplier : '');
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
}
@@ -788,7 +787,7 @@ class CategoryCore extends ObjectModel
WHERE product_shop.`id_shop` = '.(int)$context->shop->id.'
AND cp.`id_category` = '.(int)$this->id
.($active ? ' AND product_shop.`active` = 1' : '')
.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '')
.($front ? ' AND product_shop.`show_at_front` = 1' : '')
.($id_supplier ? ' AND p.id_supplier = '.(int)$id_supplier : '');
if ($random === true) {
@@ -911,6 +910,22 @@ class CategoryCore extends ObjectModel
return Cache::retrieve($cache_id);
}
/**
* check if current category is nested in $id_parent category
*/
public function hasParent($id_parent)
{
$id_category = $this->id;
$sql = 'SELECT c.`id_category`
FROM `'._DB_PREFIX_.'category` c
'.Shop::addSqlAssociation('category', 'c').'
WHERE c.`nleft` < ' .(int)$this->nleft. ' AND c.`nright` > ' .(int)$this->nright. '
AND c.`id_category` = '.(int)$id_parent;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
return $result;
}
/**
* Return an array of all children of the current category
*

View File

@@ -268,7 +268,6 @@ abstract class PaymentModuleCore extends Module
}
Hook::exec('actionPackageListGenerateOrder', array('package_list' => &$package_list));
foreach ($package_list as $id_address => $packageByAddress) {
foreach ($packageByAddress as $id_package => $package) {
/** @var Order $order */
@@ -296,7 +295,9 @@ 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;
$order->id_address_tax = (int)Cart::getIdAddressForTaxCalculation($order->product_list[0]['id_product']);
$addressInfo = HotelBranchInformation::getAddress($package['id_hotel']);
$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;
@@ -338,6 +339,7 @@ abstract class PaymentModuleCore extends Module
$order->total_paid_tax_excl = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(false, Cart::BOTH, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_);
$order->total_paid_tax_incl = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_);
$order->total_paid = $order->total_paid_tax_incl;
$order->round_mode = Configuration::get('PS_PRICE_ROUND_MODE');
$order->round_type = Configuration::get('PS_ROUND_TYPE');
@@ -537,8 +539,11 @@ abstract class PaymentModuleCore extends Module
$virtual_product = true;
$product_var_tpl_list = array();
$orderServiceProducts = array();
$objProduct = new Product();
foreach ($order->product_list as $product) {
$price = Product::getPriceStatic((int)$product['id_product'], false, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 6, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart);
$price = Product::getPriceStatic((int)$product['id_product'], false, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 6, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart);
$price_wt = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 2, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart);
@@ -589,6 +594,17 @@ abstract class PaymentModuleCore extends Module
$idHotel = $roomDetail['id_hotel'];
}
}
if (!$product['booking_product'] && $product['service_product_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
$cover_image_arr = $objProduct->getCover($product['id_product']);
if (!empty($cover_image_arr)) {
$cover_img = $this->context->link->getImageLink($product['link_rewrite'], $product['id_product'].'-'.$cover_image_arr['id_image'], 'small_default');
} else {
$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;
}
} // end foreach ($products)
$product_list_txt = '';
@@ -758,7 +774,7 @@ abstract class PaymentModuleCore extends Module
$vatAddress = new Address((int)$order->id_address_tax);
$idLang = (int)$this->context->cart->id_lang;
$normalProducts = array();
foreach ($order->product_list as $product) {
$objCartBookingData = new HotelCartBookingData();
$idProduct = $product['id_product'];
@@ -795,7 +811,8 @@ abstract class PaymentModuleCore extends Module
Group::getCurrent()->id,
$objCartBookingData->id_cart,
$objCartBookingData->id_guest,
$objCartBookingData->id_room
$objCartBookingData->id_room,
0
);
$objBookingDetail->date_from = $objCartBookingData->date_from;
$objBookingDetail->date_to = $objCartBookingData->date_to;
@@ -818,7 +835,7 @@ abstract class PaymentModuleCore extends Module
$objBookingDetail->email = $objHotelBranch->email;
$objBookingDetail->check_in_time = $objHotelBranch->check_in;
$objBookingDetail->check_out_time = $objHotelBranch->check_out;
if ($hotelAddress = $objHotelBranch->getAddress($objCartBookingData->id_hotel)) {
if ($hotelAddress = HotelBranchInformation::getAddress($objCartBookingData->id_hotel)) {
$objBookingDetail->city = $hotelAddress['city'];
$objBookingDetail->state = $hotelAddress['state'];
$objBookingDetail->country = $hotelAddress['country'];
@@ -903,6 +920,51 @@ abstract class PaymentModuleCore extends Module
}
}
}
} else {
$normalProducts[] = $product;
}
}
if (!empty($normalProducts)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
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();
}
}
}
}
@@ -970,11 +1032,52 @@ abstract class PaymentModuleCore extends Module
$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']);
$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);
$room_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, true);
$room_price_tax_incl = $order->getTotalProductsWithTaxes(false, true);
$room_tax = ($order->getTotalProductsWithTaxes(false, true) - $order->getTotalProductsWithoutTaxes(false, true));
$room_price_tax_excl += $service_products_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
$room_price_tax_incl += $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));
$additional_service_price_tax_excl = ($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $cart_booking_data['total_extra_demands_te']);
$additional_service_price_tax_incl = ($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $cart_booking_data['total_extra_demands_ti']);
$additional_service_tax = (($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $cart_booking_data['total_extra_demands_ti']) - ($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $cart_booking_data['total_extra_demands_te']));
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$room_price_tax_incl -= $total_convenience_fee_ti = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order->id,
0,
0,
0,
0,
0,
0,
1,
1,
1
);
$room_price_tax_excl -= $total_convenience_fee_te = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order->id,
0,
0,
0,
0,
0,
0,
1,
0,
1
);
$data = array(
'{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,
'{total_extra_demands_te}' => Tools::displayPrice(
$cart_booking_data['total_extra_demands_te'],
$this->context->currency,
@@ -1030,7 +1133,20 @@ abstract class PaymentModuleCore extends Module
'{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),
'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false)
// '{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false),
'{total_tax_paid}' => Tools::displayPrice(($order->total_paid_tax_incl - $order->total_paid_tax_excl), $this->context->currency, false),
// additional data
'{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),
'{service_products_price_tax_excl}' => Tools::displayPrice($service_products_price_tax_excl, $this->context->currency, false),
'{service_products_price_tax_incl}' => Tools::displayPrice($service_products_price_tax_incl, $this->context->currency, false),
'{service_products_tax}' => Tools::displayPrice($service_products_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),
);
if (is_array($extra_vars)) {
@@ -1416,8 +1532,11 @@ abstract class PaymentModuleCore extends Module
$obj_htl_bk_dtl = new HotelBookingDetail();
$obj_rm_type = new HotelRoomType();
$objBookingDemand = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$result['total_extra_demands_te'] = 0;
$result['total_extra_demands_ti'] = 0;
$result['total_additional_services_te'] =0;
$result['total_additional_services_ti'] =0;
$cart_htl_data = array();
if (!empty($products)) {
foreach ($products as $type_key => $type_value) {
@@ -1436,100 +1555,200 @@ abstract class PaymentModuleCore extends Module
} else {
$cart_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']);
}
$rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']);
if ($cart_bk_data) {
$rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']);
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
$cart_htl_data[$type_key]['name'] = $product->name;
$cart_htl_data[$type_key]['hotel_name'] = $rm_dtl['hotel_name'];
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
$cart_htl_data[$type_key]['name'] = $product->name;
$cart_htl_data[$type_key]['hotel_name'] = $rm_dtl['hotel_name'];
foreach ($cart_bk_data as $data_k => $data_v) {
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
foreach ($cart_bk_data as $data_k => $data_v) {
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
$vart_quant = (int)$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl'];
// extra demands prices
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1
);
} else {
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl'];
$roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice($type_value['id_product'], $data_v['date_from'], $data_v['date_to']);
// extra demands prices
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1
);
$result['total_extra_demands_te'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'];
$result['total_extra_demands_ti'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $roomTypeDateRangePrice['total_price_tax_incl']*$vart_quant;
// extra demands prices
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order->id,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
1,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order->id,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += ($data_v['total_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']);
} else {
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
/*$amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1);
$amount *= $num_days;*/
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
// extra demands prices
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order->id,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to']
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order->id,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
1
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order->id,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order->id,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
1,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order->id,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = ($data_v['total_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']);
$result['total_extra_demands_te'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'];
$result['total_extra_demands_ti'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'];
$result['total_additional_services_te'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'];
$result['total_additional_services_ti'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'];
}
}
}
// calculate averages now

View File

@@ -74,6 +74,9 @@ class ProductCore extends ObjectModel
/** @var int Minimal quantity for add to cart */
public $minimal_quantity = 1;
/** @var bool allow order for multiple quantities */
public $allow_multiple_quantity;
/** @var string available_now */
public $available_now;
@@ -175,6 +178,16 @@ class ProductCore extends ObjectModel
/** @var bool Product available for order */
public $available_for_order = true;
// Room type required to buy
public $service_product_type;
// add product to cart automatically
public $auto_add_to_cart = false;
public $price_addition_type;
public $show_at_front;
/** @var string Object available order date */
public $available_date = '0000-00-00';
@@ -226,6 +239,8 @@ class ProductCore extends ObjectModel
public $cache_is_pack;
public $cache_has_attachments;
public $is_virtual;
public $booking_product;
public $is_invisible;
public $id_pack_product_attribute;
public $cache_default_attribute;
@@ -281,6 +296,9 @@ class ProductCore extends ObjectModel
'cache_is_pack' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'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'),
'is_invisible' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'service_product_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
/* Shop fields */
'id_category_default' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedId'),
@@ -289,6 +307,7 @@ class ProductCore extends ObjectModel
'online_only' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
'ecotax' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice'),
'minimal_quantity' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedInt'),
'allow_multiple_quantity' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
'price' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice', 'required' => true),
'wholesale_price' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice'),
'unity' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isString'),
@@ -303,6 +322,9 @@ class ProductCore extends ObjectModel
'available_for_order' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
'available_date' => array('type' => self::TYPE_DATE, 'shop' => true, 'validate' => 'isDateFormat'),
'condition' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('new', 'used', 'refurbished'), 'default' => 'new'),
'auto_add_to_cart' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
'price_addition_type' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedInt'),
'show_at_front' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
'show_price' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
'indexed' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
'visibility' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isProductVisibility', 'values' => array('both', 'catalog', 'search', 'none'), 'default' => 'both'),
@@ -475,6 +497,16 @@ class ProductCore extends ObjectModel
const PTYPE_PACK = 1;
const PTYPE_VIRTUAL = 2;
const PRICE_DISPALY_COMBINE = 1;
const PRICE_DISPALY_INDIVISUAL = 2;
const SERVICE_PRODUCT_WITH_ROOMTYPE = 1;
const SERVICE_PRODUCT_WITHOUT_ROOMTYPE = 2;
const PRICE_ADDITION_TYPE_WITH_ROOM = 1;
const PRICE_ADDITION_TYPE_INDEPENDENT = 2;
public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
{
parent::__construct($id_product, $id_lang, $id_shop);
@@ -880,6 +912,14 @@ class ProductCore extends ObjectModel
return parent::toggleStatus();
}
public static function isBookingProduct($id_product)
{
return Db::getInstance()->getValue('
SELECT `booking_product` FROM `'._DB_PREFIX_.'product` p
WHERE p.`id_product` = '.(int)$id_product
);
}
public function delete()
{
/*
@@ -919,6 +959,12 @@ class ProductCore extends ObjectModel
return true;
}
if (!$this->booking_product) {
if (!$this->deleteServiceInfo()) {
return false;
}
}
Hook::exec('actionProductDelete', array('id_product' => (int)$this->id, 'product' => $this));
if (!$result ||
!GroupReduction::deleteProductReduction($this->id) ||
@@ -943,6 +989,16 @@ class ProductCore extends ObjectModel
return true;
}
public function deleteServiceInfo()
{
if (!RoomTypeServiceProduct::deleteRoomProductLink($this->id)
||RoomTypeServiceProductPrice::deleteRoomProductPrices($this->id)
) {
return false;
}
return true;
}
public function deleteSelection($products)
{
$return = 1;
@@ -1253,6 +1309,157 @@ class ProductCore extends ObjectModel
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
public function getProductServiceProducts($id_lang, $p, $n, $front = false, $available_for_order = 2, $auto_add_to_cart = 0, $get_total = false, $active = true, $sub_category = false, Context $context = null)
{
if (!$context) {
$context = Context::getContext();
}
// first check if product is booking product
if (!$this->booking_product) {
return false;
}
// get hotel and room type by id_product
$objHotelRoomType = new HotelRoomType();
$roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct((int)$this->id);
if ($get_total) {
$sql = 'SELECT COUNT(DISTINCT(p.`id_product`)) AS total
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product` rsp ON (rsp.`id_product` = p.`id_product`)
WHERE
('.
'(`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
.($sub_category? ' AND product_shop.`id_category_default` = '.(int)$sub_category : '')
.($front ? ' AND product_shop.`show_at_front` = 1':'')
.(!is_null($auto_add_to_cart) ? ' AND product_shop.`auto_add_to_cart` = '.$auto_add_to_cart:'')
.($front ? ' AND p.`is_invisible` = 0':'')
.($available_for_order != 2 ? ' AND p.`available_for_order` = '.(int)$available_for_order:'')
.($active ? ' AND product_shop.`active` = 1' : '');
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
}
if ($p < 1) {
$p = 1;
}
$nb_days_new_product = Configuration::get('PS_NB_DAYS_NEW_PRODUCT');
if (!Validate::isUnsignedInt($nb_days_new_product)) {
$nb_days_new_product = 20;
}
$sql = 'SELECT p.*, product_shop.*,
stock.`out_of_stock`, IFNULL(stock.`quantity`, 0) AS quantity, pl.`description`, pl.`description_short`, pl.`available_now`,
pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image` id_image,
il.`legend` as legend, cl.`name` AS category_default,
DATEDIFF(product_shop.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00",
INTERVAL '.(int)$nb_days_new_product.' DAY)) > 0 AS new, product_shop.price AS orderprice
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product` rsp ON (rsp.`id_product` = p.`id_product`)'
.Product::sqlStock('p', 0).'
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
ON (product_shop.`id_category_default` = cl.`id_category`
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').')
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
ON (p.`id_product` = pl.`id_product`
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
LEFT JOIN `'._DB_PREFIX_.'image_lang` il
ON (image_shop.`id_image` = il.`id_image`
AND il.`id_lang` = '.(int)$id_lang.')
WHERE
('.
'(`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
.($sub_category? ' AND product_shop.`id_category_default` = '.(int)$sub_category : '')
.($front ? ' AND product_shop.`show_at_front` = 1':'')
.(!is_null($auto_add_to_cart) ? ' AND product_shop.`auto_add_to_cart` = '.$auto_add_to_cart:'')
.($front ? ' AND p.`is_invisible` = 0':'')
.($available_for_order != 2 ? ' AND p.`available_for_order` = '.(int)$available_for_order:'')
.($active ? ' AND product_shop.`active` = 1' : '');
$sql .= ' GROUP BY p.`id_product`';
$sql .= ' ORDER BY rsp.`position` ASC';
if ($p && $n) {
$sql .= ' LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
}
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql, true, false);
return $result;
}
public function getAvailableServiceProductsCategories($id_lang, $front = false, $active = true, Context $context = null)
{
if (!$context) {
$context = Context::getContext();
}
// first check if product is booking product
if (!$this->booking_product) {
return false;
}
// get hotel and room type by id_product
$objHotelRoomType = new HotelRoomType();
$roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct((int)$this->id);
$sql = 'SELECT cl.*, COUNT(DISTINCT(p.`id_product`)) as num_products
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product` rsp ON (rsp.`id_product` = p.`id_product`)'
.Product::sqlStock('p', 0).'
INNER JOIN `'._DB_PREFIX_.'category_lang` cl
ON (product_shop.`id_category_default` = cl.`id_category`
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').')
WHERE
('.
'(`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
.($front ? ' AND product_shop.`auto_add_to_cart` = 0 AND product_shop.`show_at_front` = 1':'')
.($front ? ' AND p.`is_invisible` = 0':'')
.($active ? ' AND product_shop.`active` = 1' : '');
$sql .= ' GROUP BY cl.`id_category`';
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql, true, false);
return $result;
}
public function getServiceProducts($idLang, $front = false, $context = false)
{
if (!$context) {
$context = Context::getContext();
}
$sql = 'SELECT p.*, product_shop.*, pl.*, image_shop.`id_image` id_image, il.`legend` as legend
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.Shop::addSqlRestrictionOnLang('pl').')
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
LEFT JOIN `'._DB_PREFIX_.'image_lang` il
ON (image_shop.`id_image` = il.`id_image`
AND il.`id_lang` = '.(int)$idLang.')';
$sql .= 'WHERE pl.`id_lang` = '.(int)$idLang.' AND p.`booking_product` = 0
AND p.`service_product_type` = '.Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE.'
ORDER BY pl.`name`';
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
public function isNew()
{
$result = Db::getInstance()->executeS('
@@ -2770,7 +2977,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)
$use_customer_price = true, $id_roomtype = false)
{
if (!$context) {
$context = Context::getContext();
@@ -2837,7 +3044,11 @@ class ProductCore extends ObjectModel
if ($id_address) {
$address_infos = Address::getCountryAndState($id_address);
} else {
$address_infos = Address::getCountryAndState(Cart::getIdAddressForTaxCalculation($id_product));
// if ($id_roomtype) {
// $address_infos = Address::getCountryAndState(Cart::getIdAddressForTaxCalculation($id_roomtype));
// } else {
$address_infos = Address::getCountryAndState(Cart::getIdAddressForTaxCalculation($id_product));
// }
}
if ($address_infos['id_country']) {
@@ -2874,7 +3085,8 @@ class ProductCore extends ObjectModel
$id_customer,
$use_customer_price,
$id_cart,
$cart_quantity
$cart_quantity,
$id_roomtype
);
return $return;
@@ -2908,8 +3120,9 @@ 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_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0, $id_roomtype = false)
{
static $address = null;
static $context = null;
@@ -2936,7 +3149,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;
'-'.($only_reduc?'1':'0').'-'.($use_reduc?'1':'0').'-'.($use_tax?'1':'0').'-'.(int)$decimals.'-'.($id_roomtype?(int)$id_roomtype:'0');
// reference parameter is filled before any returns
$specific_price = SpecificPrice::getSpecificPrice(
@@ -2999,11 +3212,23 @@ class ProductCore extends ObjectModel
$result = self::$_pricesLevel2[$cache_id_2][(int)$id_product_attribute];
if (!$specific_price || $specific_price['price'] < 0) {
// get price per room type
if ($id_roomtype) {
$priceForRoomInfo = RoomTypeServiceProductPrice::getProductRoomTypePriceAndTax(
$id_product,
$id_roomtype,
RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE
);
}
if (isset($priceForRoomInfo) && isset($priceForRoomInfo['price'])) {
$price = (float)$priceForRoomInfo['price'];
} elseif (!$specific_price || $specific_price['price'] < 0) {
$price = (float)$result['price'];
} else {
$price = (float)$specific_price['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);
@@ -3021,12 +3246,29 @@ class ProductCore extends ObjectModel
}
}
// find and add if any auto_add services are attached
Hook::exec(
'actionProductPriceModifier',
array(
'price' => &$price,
'type' => 'pre_tax'
)
);
// Tax
$address->id_country = $id_country;
$address->id_state = $id_state;
$address->postcode = $zipcode;
$tax_manager = TaxManagerFactory::getManager($address, Product::getIdTaxRulesGroupByIdProduct((int)$id_product, $context));
if (isset($priceForRoomInfo) && isset($priceForRoomInfo['id_tax_rules_group'])) {
$id_tax_rule_group = $priceForRoomInfo['id_tax_rules_group'];
} else {
$id_tax_rule_group = Product::getIdTaxRulesGroupByIdProduct((int)$id_product, $context);
}
$tax_manager = TaxManagerFactory::getManager($address, $id_tax_rule_group);
$product_tax_calculator = $tax_manager->getTaxCalculator();
// Add Tax
@@ -3057,6 +3299,14 @@ class ProductCore extends ObjectModel
}
}
Hook::exec(
'actionProductPriceModifier',
array(
'price' => &$price,
'type' => 'post_tax'
)
);
// Reduction
$specific_price_reduction = 0;
if (($only_reduc || $use_reduc) && $specific_price) {
@@ -3138,7 +3388,7 @@ class ProductCore extends ObjectModel
$quantity = $cart_quantity ? $cart_quantity : $quantity;
$id_currency = (int)$context->currency->id;
$ids = Address::getCountryAndState(cart::getIdAddressForTaxCalculation($id_product));
$ids = Address::getCountryAndState(Cart::getIdAddressForTaxCalculation($id_product));
$id_country = $ids['id_country'] ? (int)$ids['id_country'] : (int)Configuration::get('PS_COUNTRY_DEFAULT');
return (bool)SpecificPrice::getSpecificPrice((int)$id_product, $context->shop->id, $id_currency, $id_country, $id_group, $quantity, null, 0, 0, $quantity);
}
@@ -3743,7 +3993,7 @@ class ProductCore extends ObjectModel
}
$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`');
$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', '

View File

@@ -335,7 +335,7 @@ class SpecificPriceCore extends ObjectModel
}
}
public static function getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0, $id_cart = 0, $real_quantity = 0)
public static function getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0, $id_cart = 0, $real_quantity = 0, $id_room = 0)
{
if (!SpecificPrice::isFeatureActive()) {
return array();

View File

@@ -0,0 +1,468 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/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 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/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class HelperTreeHotelsCore extends TreeCore
{
const DEFAULT_TEMPLATE = 'tree_categories.tpl';
const DEFAULT_NODE_FOLDER_TEMPLATE = 'tree_node_folder_radio.tpl';
const DEFAULT_NODE_ITEM_TEMPLATE = 'tree_node_item_radio.tpl';
private $_disabled_categories;
private $_input_name;
private $_lang;
private $_root_category;
private $_selected_hotels;
private $_selected_room_types;
private $_full_tree = false;
private $_shop;
private $_use_checkbox;
private $_use_bulk_actions = true;
private $_use_search;
private $_use_shop_restriction;
private $_rooms_only = false;
private $_disable_all_categories = false;
private $_accessed_hotels = false;
public function __construct($id, $title = null, $root_category = null,
$lang = null, $use_shop_restriction = true)
{
parent::__construct($id);
if (isset($title)) {
$this->setTitle($title);
}
if (isset($root_category)) {
$this->setRootCategory($root_category);
}
$this->setLang($lang);
$this->setUseShopRestriction($use_shop_restriction);
}
private function fillTree($hotels, $onlyRoomType = false)
{
$tree = array();
$idLang = Context::getContext()->language->id;
$objRoomType = new HotelRoomType();
foreach($hotels as $hotel) {
if (!$onlyRoomType) {
$tree[$hotel['id_hotel']] = array(
'id_hotel' => $hotel['id_hotel'],
'id_category' => $hotel['id_category'],
'name' => $hotel['hotel_name'],
'children' => array()
);
}
if (!empty($roomTypes = $objRoomType->getRoomTypeByHotelId($hotel['id_hotel'], $idLang))) {
if ($onlyRoomType) {
$tree = array_merge($tree, $roomTypes);
} else {
$tree[$hotel['id_hotel']]['children'] = array_merge($tree[$hotel['id_hotel']]['children'], $roomTypes);
}
}
}
return $tree;
}
public function getData()
{
if (!isset($this->_data)) {
$shop = $this->getShop();
$lang = $this->getLang();
$root_category = (int)$this->getRootCategory();
if (($hotels = $this->getAccessedHotels()) === false) {
$objHotelBanch = new HotelBranchInformation();
$hotels = $objHotelBanch->hotelBranchesInfo();
}
$tree = $this->fillTree($hotels, $this->_rooms_only);
if (!empty($children)) {
$tree[$root_category]['children'] = $children;
}
$this->setData($tree);
$this->setDataSearch(Category::getAllCategoriesName($root_category, $lang, false, null, $this->useShopRestriction()));
}
return $this->_data;
}
public function setRoomsOnly($value)
{
$this->_rooms_only = $value;
return $this;
}
public function setFullTree($value)
{
$this->_full_tree = $value;
return $this;
}
public function getFullTree()
{
return $this->_full_tree;
}
public function setDisabledCategories($value)
{
$this->_disabled_categories = $value;
return $this;
}
public function setAccessedHotels($values)
{
$this->_accessed_hotels = $values;
return $this;
}
public function getAccessedHotels()
{
return $this->_accessed_hotels;
}
public function setDisablAllCategories($value)
{
$this->_disable_all_categories = $value;
return $this;
}
public function getDisabledCategories()
{
return $this->_disabled_categories;
}
public function getDisablAllCategories()
{
return $this->_disable_all_categories;
}
public function setInputName($value)
{
$this->_input_name = $value;
return $this;
}
public function getInputName()
{
if (!isset($this->_input_name)) {
$this->setInputName('categoryBox');
}
return $this->_input_name;
}
public function setLang($value)
{
$this->_lang = $value;
return $this;
}
public function getLang()
{
if (!isset($this->_lang)) {
$this->setLang($this->getContext()->employee->id_lang);
}
return $this->_lang;
}
public function getNodeFolderTemplate()
{
if (!isset($this->_node_folder_template)) {
$this->setNodeFolderTemplate(self::DEFAULT_NODE_FOLDER_TEMPLATE);
}
return $this->_node_folder_template;
}
public function getNodeItemTemplate()
{
if (!isset($this->_node_item_template)) {
$this->setNodeItemTemplate(self::DEFAULT_NODE_ITEM_TEMPLATE);
}
return $this->_node_item_template;
}
public function setRootCategory($value)
{
if (!Validate::isInt($value)) {
throw new PrestaShopException('Root category must be an integer value');
}
$this->_root_category = $value;
return $this;
}
public function getRootCategory()
{
return $this->_root_category;
}
public function setSelectedHotels($value)
{
if (!is_array($value)) {
throw new PrestaShopException('Selected categories value must be an array');
}
$this->_selected_hotels = $value;
return $this;
}
public function getSelectedHotels()
{
if (!isset($this->_selected_hotels)) {
$this->_selected_hotels = array();
}
return $this->_selected_hotels;
}
public function setSelectedRoomTypes($value)
{
if (!is_array($value)) {
throw new PrestaShopException('Selected categories value must be an array');
}
$this->_selected_room_types = $value;
return $this;
}
public function getSelectedRoomTypes()
{
if (!isset($this->_selected_room_types)) {
$this->_selected_room_types = array();
}
return $this->_selected_room_types;
}
public function setShop($value)
{
$this->_shop = $value;
return $this;
}
public function getShop()
{
if (!isset($this->_shop)) {
if (Tools::isSubmit('id_shop')) {
$this->setShop(new Shop(Tools::getValue('id_shop')));
} elseif ($this->getContext()->shop->id) {
$this->setShop(new Shop($this->getContext()->shop->id));
} elseif (!Shop::isFeatureActive()) {
$this->setShop(new Shop(Configuration::get('PS_SHOP_DEFAULT')));
} else {
$this->setShop(new Shop(0));
}
}
return $this->_shop;
}
public function getTemplate()
{
if (!isset($this->_template)) {
$this->setTemplate(self::DEFAULT_TEMPLATE);
}
return $this->_template;
}
public function setUseCheckBox($value)
{
$this->_use_checkbox = (bool)$value;
return $this;
}
public function setUseBulkActions($value)
{
$this->_use_bulk_actions = (bool)$value;
return $this;
}
public function setUseSearch($value)
{
$this->_use_search = (bool)$value;
return $this;
}
public function setUseShopRestriction($value)
{
$this->_use_shop_restriction = (bool)$value;
return $this;
}
public function useCheckBox()
{
return (isset($this->_use_checkbox) && $this->_use_checkbox);
}
public function useBulkActions()
{
return (isset($this->_use_bulk_actions) && $this->_use_bulk_actions);
}
public function useSearch()
{
return (isset($this->_use_search) && $this->_use_search);
}
public function useShopRestriction()
{
return (isset($this->_use_shop_restriction) && $this->_use_shop_restriction);
}
public function render($data = null)
{
if (!isset($data)) {
$data = $this->getData();
}
if (isset($this->_disabled_categories)
&& !empty($this->_disabled_categories)) {
$this->_disableCategories($data, $this->getDisabledCategories());
}
if($this->getDisablAllCategories()) {
$this->_disableCategories($data);
}
//Default bootstrap style of search is push-right, so we add this button first
if ($this->useSearch()) {
$this->addAction(new TreeToolbarSearchCategories(
'Find a category:',
$this->getId().'-categories-search')
);
$this->setAttribute('use_search', $this->useSearch());
}
$collapse_all = new TreeToolbarLink(
'Collapse All',
'#',
'$(\'#'.$this->getId().'\').tree(\'collapseAll\');$(\'#collapse-all-'.$this->getId().'\').hide();$(\'#expand-all-'.$this->getId().'\').show(); return false;',
'icon-collapse-alt');
$collapse_all->setAttribute('id', 'collapse-all-'.$this->getId());
$expand_all = new TreeToolbarLink(
'Expand All',
'#',
'$(\'#'.$this->getId().'\').tree(\'expandAll\');$(\'#collapse-all-'.$this->getId().'\').show();$(\'#expand-all-'.$this->getId().'\').hide(); return false;',
'icon-expand-alt');
$expand_all->setAttribute('id', 'expand-all-'.$this->getId());
$this->addAction($collapse_all);
$this->addAction($expand_all);
if ($this->useCheckBox()) {
$this->setNodeFolderTemplate('tree_node_hotel_folder_checkbox.tpl');
$this->setNodeItemTemplate('tree_node_hotel_item_checkbox.tpl');
$this->setAttribute('use_checkbox', $this->useCheckBox());
}
$this->setAttribute('selected_hotels', $this->getSelectedHotels());
$this->setAttribute('selected_roomtypes', $this->getSelectedRoomTypes());
$this->getContext()->smarty->assign('root_category', Configuration::get('PS_ROOT_CATEGORY'));
$this->getContext()->smarty->assign('token', Tools::getAdminTokenLite('AdminProducts'));
return parent::render($data);
}
/* Override */
public function renderNodes($data = null)
{
if (!isset($data)) {
$data = $this->getData();
}
if (!is_array($data) && !$data instanceof Traversable) {
throw new PrestaShopException('Data value must be an traversable array');
}
$html = '';
foreach ($data as $item) {
if (array_key_exists('children', $item)) {
$html .= $this->getContext()->smarty->createTemplate(
$this->getTemplateFile($this->getNodeFolderTemplate()),
$this->getContext()->smarty
)->assign(array(
'input_name' => 'hotelBox',
'children' => $this->renderNodes($item['children']),
'node' => $item
))->fetch();
} else {
$html .= $this->getContext()->smarty->createTemplate(
$this->getTemplateFile($this->getNodeItemTemplate()),
$this->getContext()->smarty
)->assign(array(
'input_name' => 'roomTypeBox',
'node' => $item
))->fetch();
}
}
return $html;
}
private function _disableCategories(&$categories, $disabled_categories = null)
{
foreach ($categories as &$category) {
if (!isset($disabled_categories) || in_array($category['id_category'], $disabled_categories)) {
$category['disabled'] = true;
if (array_key_exists('children', $category) && is_array($category['children'])) {
self::_disableCategories($category['children']);
}
} elseif (array_key_exists('children', $category) && is_array($category['children'])) {
self::_disableCategories($category['children'], $disabled_categories);
}
}
}
private function _getSelectedChildNumbers(&$categories, $selected, &$parent = null)
{
$selected_childs = 0;
foreach ($categories as $key => &$category) {
if (isset($parent) && in_array($category['id_category'], $selected)) {
$selected_childs++;
}
if (isset($category['children']) && !empty($category['children'])) {
$selected_childs += $this->_getSelectedChildNumbers($category['children'], $selected, $category);
}
}
if (!isset($parent['selected_childs'])) {
$parent['selected_childs'] = 0;
}
$parent['selected_childs'] = $selected_childs;
return $selected_childs;
}
}

View File

@@ -183,9 +183,7 @@ class HelperUploaderCore extends Uploader
public function getTemplateFile($template)
{
if (preg_match_all('/((?:^|[A-Z])[a-z]+)/', get_class($this->getContext()->controller), $matches) !== false) {
$controller_name = strtolower($matches[0][1]);
}
$controller_name = Tools::toUnderscoreCase(substr($this->getContext()->controller->controller_name, 5));
if ($this->getContext()->controller instanceof ModuleAdminController && file_exists($this->_normalizeDirectory(
$this->getContext()->controller->getTemplatePath()).$this->getTemplateDirectory().$template)) {

View File

@@ -580,14 +580,20 @@ class OrderCore extends ObjectModel
return self::$_historyCache[$this->id.'_'.$id_order_state.'_'.$filters];
}
public function getProductsDetail()
public function getProductsDetail($is_booking = null, $product_service_type = null)
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *
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)
WHERE od.`id_order` = '.(int)$this->id);
$sql = 'SELECT *
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)
WHERE od.`id_order` = '.(int)$this->id;
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;
}
}
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
public function getFirstMessage()
@@ -646,9 +652,11 @@ class OrderCore extends ObjectModel
// Change qty if selected
if ($selected_qty) {
$row['product_quantity'] = 0;
foreach ($selected_products as $key => $id_product) {
if ($row['id_order_detail'] == $id_product) {
$row['product_quantity'] = (int)$selected_qty[$key];
if (is_array($selected_products)) {
foreach ($selected_products as $key => $id_product) {
if ($row['id_order_detail'] == $id_product) {
$row['product_quantity'] = (int)$selected_qty[$key];
}
}
}
if (!$row['product_quantity']) {
@@ -1049,9 +1057,19 @@ class OrderCore extends ObjectModel
*
* @return Product total without taxes
*/
public function getTotalProductsWithoutTaxes($products = false)
public function getTotalProductsWithoutTaxes($products = false, $bookingProducts = null, $product_service_type = null)
{
return $this->total_products;
// update
if (!$products) {
$products = $this->getProductsDetail($bookingProducts, $product_service_type);
}
$return = 0;
foreach ($products as $row) {
$return += $row['total_price_tax_excl'];
}
return $return;
}
/**
@@ -1059,15 +1077,11 @@ class OrderCore extends ObjectModel
*
* @return Product total with taxes
*/
public function getTotalProductsWithTaxes($products = false)
public function getTotalProductsWithTaxes($products = false, $bookingProducts = null, $product_service_type = null)
{
if ($this->total_products_wt != '0.00' && !$products) {
return $this->total_products_wt;
}
/* Retro-compatibility (now set directly on the validateOrder() method) */
if (!$products) {
$products = $this->getProductsDetail();
$products = $this->getProductsDetail($bookingProducts, $product_service_type);
}
$return = 0;
@@ -1075,10 +1089,6 @@ class OrderCore extends ObjectModel
$return += $row['total_price_tax_incl'];
}
if (!$products) {
$this->total_products_wt = $return;
$this->update();
}
return $return;
}
@@ -1781,7 +1791,7 @@ class OrderCore extends ObjectModel
public function addOrderPaymentDetail(OrderPayment $payment, $amount = null, $order_invoice = null)
{
if (Validate::isLoadedObject($payment)) {
if (!is_null($amount)) {
if (is_null($amount)) {
$amount = $payment->amount;
}
$order_payment_detail = new OrderPaymentDetail();
@@ -2341,7 +2351,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)
public function getProductTaxesDetails($limitToOrderDetails = false, $bookingProducts = null, $product_service_type = null)
{
$round_type = $this->round_type;
if ($round_type == 0) {
@@ -2358,6 +2368,11 @@ class OrderCore extends ObjectModel
$product_specific_discounts = array();
$expected_total_base = $this->total_products - $this->total_discounts_tax_excl;
$expected_total_base = (float)$this->getTotalProductsWithoutTaxes(
$limitToOrderDetails,
$bookingProducts,
$product_service_type
);
foreach ($this->getCartRules() as $order_cart_rule) {
if ($order_cart_rule['free_shipping'] && $free_shipping_tax === 0) {
@@ -2386,7 +2401,12 @@ class OrderCore extends ObjectModel
$breakdown = array();
// Get order_details
$order_details = $limitToOrderDetails ? $limitToOrderDetails : $this->getOrderDetailList();
if ($limitToOrderDetails !== false) {
$order_details = $limitToOrderDetails;
} else {
$order_details = $this->getOrderDetailList();
}
$expected_total_tax = (float)$this->getTotalProductsWithTaxes($limitToOrderDetails) - (float)$this->getTotalProductsWithoutTaxes($limitToOrderDetails);
$order_ecotax_tax = 0;
@@ -2420,7 +2440,6 @@ class OrderCore extends ObjectModel
foreach ($tax_calculator->taxes as $tax) {
$tax_rates[$tax->id] = $tax->rate;
}
foreach ($tax_calculator->getTaxesAmount($discounted_price_tax_excl) as $id_tax => $unit_amount) {
$total_tax_base = 0;
switch ($round_type) {
@@ -2456,7 +2475,6 @@ class OrderCore extends ObjectModel
);
}
}
if (!empty($order_detail_tax_rows)) {
foreach ($breakdown as $data) {
$actual_total_tax += Tools::ps_round($data['tax_amount'], _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode);

View File

@@ -98,6 +98,15 @@ class OrderDetailCore extends ObjectModel
/** @var float */
public $product_quantity_discount;
/** @var bool */
public $is_booking_product;
/** @var int */
public $product_service_type;
/** @var bool */
public $product_allow_multiple_quantity;
/** @var string */
public $product_ean13;
@@ -184,6 +193,11 @@ class OrderDetailCore extends ObjectModel
'reduction_amount_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'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'),
'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'),
'product_ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13'),
'product_upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc'),
'product_reference' => array('type' => self::TYPE_STRING, 'validate' => 'isReference'),
@@ -638,6 +652,12 @@ class OrderDetailCore extends ObjectModel
$this->product_quantity_in_stock = ($product_quantity - (int)$product['cart_quantity'] < 0) ?
$product_quantity : (int)$product['cart_quantity'];
$this->is_booking_product = $product['booking_product'];
$this->product_service_type = $product['service_product_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'];
$this->setVirtualProductInformation($product);
$this->checkProductStock($product, $id_order_state);
@@ -696,6 +716,17 @@ class OrderDetailCore extends ObjectModel
return $this->outOfStock;
}
public function getBookingProducts($id_order)
{
$orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
'SELECT *
FROM '._DB_PREFIX_.'order_detail od
WHERE od.`is_booking_product` = true and `id_order` = '.(int) $id_order
);
return $orders;
}
/**
* Set the additional shipping information
*

View File

@@ -401,6 +401,257 @@ class OrderInvoiceCore extends ObjectModel
return $breakdown;
}
public function getRoomsTaxesBreakdown($order = null)
{
if (!$order) {
$order = $this->getOrder();
}
$sum_composite_taxes = !$this->useOneAfterAnotherTaxComputationMethod();
// $breakdown will be an array with tax rates as keys and at least the columns:
// - 'total_price_tax_excl'
// - 'total_amount'
$breakdown = array();
$order_detail = $order->getOrderDetailList();
$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['product_price_addition_type'] == ProductCore::PRICE_ADDITION_TYPE_WITH_ROOM)
);
});
$details = $order->getProductTaxesDetails($order_detail, true);
if ($sum_composite_taxes) {
$grouped_details = array();
foreach ($details as $row) {
if (!isset($grouped_details[$row['id_order_detail']])) {
$grouped_details[$row['id_order_detail']] = array(
'tax_rate' => 0,
'total_tax_base' => 0,
'total_amount' => 0,
'id_tax' => $row['id_tax'],
);
}
$grouped_details[$row['id_order_detail']]['tax_rate'] += $row['tax_rate'];
$grouped_details[$row['id_order_detail']]['total_tax_base'] += $row['total_tax_base'];
$grouped_details[$row['id_order_detail']]['total_amount'] += $row['total_amount'];
}
$details = $grouped_details;
}
foreach ($details as $row) {
$rate = sprintf('%.3f', $row['tax_rate']);
if (!isset($breakdown[$rate])) {
$breakdown[$rate] = array(
'total_price_tax_excl' => 0,
'total_amount' => 0,
'id_tax' => $row['id_tax'],
'rate' => $rate,
);
}
$breakdown[$rate]['total_price_tax_excl'] += $row['total_tax_base'];
$breakdown[$rate]['total_amount'] += $row['total_amount'];
}
foreach ($breakdown as $rate => $data) {
$breakdown[$rate]['total_price_tax_excl'] = Tools::ps_round($data['total_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
$breakdown[$rate]['total_amount'] = Tools::ps_round($data['total_amount'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
}
ksort($breakdown);
return $breakdown;
}
public function getAdditionalServicesTaxesBreakdown($order = null)
{
if (!$order) {
$order = $this->getOrder();
}
$sum_composite_taxes = !$this->useOneAfterAnotherTaxComputationMethod();
// $breakdown will be an array with tax rates as keys and at least the columns:
// - 'total_price_tax_excl'
// - 'total_amount'
$breakdown = array();
$order_detail = $order->getOrderDetailList();
$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);
});
$details = $order->getProductTaxesDetails($order_detail, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE);
if ($sum_composite_taxes) {
$grouped_details = array();
foreach ($details as $row) {
if (!isset($grouped_details[$row['id_order_detail']])) {
$grouped_details[$row['id_order_detail']] = array(
'tax_rate' => 0,
'total_tax_base' => 0,
'total_amount' => 0,
'id_tax' => $row['id_tax'],
);
}
$grouped_details[$row['id_order_detail']]['tax_rate'] += $row['tax_rate'];
$grouped_details[$row['id_order_detail']]['total_tax_base'] += $row['total_tax_base'];
$grouped_details[$row['id_order_detail']]['total_amount'] += $row['total_amount'];
}
$details = $grouped_details;
}
foreach ($details as $row) {
$rate = sprintf('%.3f', $row['tax_rate']);
if (!isset($breakdown[$rate])) {
$breakdown[$rate] = array(
'total_price_tax_excl' => 0,
'total_amount' => 0,
'id_tax' => $row['id_tax'],
'rate' => $rate,
);
}
$breakdown[$rate]['total_price_tax_excl'] += $row['total_tax_base'];
$breakdown[$rate]['total_amount'] += $row['total_amount'];
}
foreach ($breakdown as $rate => $data) {
$breakdown[$rate]['total_price_tax_excl'] = Tools::ps_round($data['total_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
$breakdown[$rate]['total_amount'] = Tools::ps_round($data['total_amount'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
}
ksort($breakdown);
return $breakdown;
}
public function getConvenienceFeeTaxesBreakdown($order = null)
{
if (!$order) {
$order = $this->getOrder();
}
$sum_composite_taxes = !$this->useOneAfterAnotherTaxComputationMethod();
// $breakdown will be an array with tax rates as keys and at least the columns:
// - 'total_price_tax_excl'
// - 'total_amount'
$breakdown = array();
$order_detail = $order->getOrderDetailList();
$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['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT
);
});
$details = $order->getProductTaxesDetails($order_detail, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE);
if ($sum_composite_taxes) {
$grouped_details = array();
foreach ($details as $row) {
if (!isset($grouped_details[$row['id_order_detail']])) {
$grouped_details[$row['id_order_detail']] = array(
'tax_rate' => 0,
'total_tax_base' => 0,
'total_amount' => 0,
'id_tax' => $row['id_tax'],
);
}
$grouped_details[$row['id_order_detail']]['tax_rate'] += $row['tax_rate'];
$grouped_details[$row['id_order_detail']]['total_tax_base'] += $row['total_tax_base'];
$grouped_details[$row['id_order_detail']]['total_amount'] += $row['total_amount'];
}
$details = $grouped_details;
}
foreach ($details as $row) {
$rate = sprintf('%.3f', $row['tax_rate']);
if (!isset($breakdown[$rate])) {
$breakdown[$rate] = array(
'total_price_tax_excl' => 0,
'total_amount' => 0,
'id_tax' => $row['id_tax'],
'rate' => $rate,
);
}
$breakdown[$rate]['total_price_tax_excl'] += $row['total_tax_base'];
$breakdown[$rate]['total_amount'] += $row['total_amount'];
}
foreach ($breakdown as $rate => $data) {
$breakdown[$rate]['total_price_tax_excl'] = Tools::ps_round($data['total_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
$breakdown[$rate]['total_amount'] = Tools::ps_round($data['total_amount'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
}
ksort($breakdown);
return $breakdown;
}
public function getServiceProductsTaxesBreakdown($order = null)
{
if (!$order) {
$order = $this->getOrder();
}
$sum_composite_taxes = !$this->useOneAfterAnotherTaxComputationMethod();
// $breakdown will be an array with tax rates as keys and at least the columns:
// - 'total_price_tax_excl'
// - 'total_amount'
$breakdown = array();
$order_detail = $order->getOrderDetailList();
$order_detail = array_filter($order_detail, function($v) {
return (!$v['is_booking_product'] && $v['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
});
$details = $order->getProductTaxesDetails($order_detail, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
if ($sum_composite_taxes) {
$grouped_details = array();
foreach ($details as $row) {
if (!isset($grouped_details[$row['id_order_detail']])) {
$grouped_details[$row['id_order_detail']] = array(
'tax_rate' => 0,
'total_tax_base' => 0,
'total_amount' => 0,
'id_tax' => $row['id_tax'],
);
}
$grouped_details[$row['id_order_detail']]['tax_rate'] += $row['tax_rate'];
$grouped_details[$row['id_order_detail']]['total_tax_base'] += $row['total_tax_base'];
$grouped_details[$row['id_order_detail']]['total_amount'] += $row['total_amount'];
}
$details = $grouped_details;
}
foreach ($details as $row) {
$rate = sprintf('%.3f', $row['tax_rate']);
if (!isset($breakdown[$rate])) {
$breakdown[$rate] = array(
'total_price_tax_excl' => 0,
'total_amount' => 0,
'id_tax' => $row['id_tax'],
'rate' => $rate,
);
}
$breakdown[$rate]['total_price_tax_excl'] += $row['total_tax_base'];
$breakdown[$rate]['total_amount'] += $row['total_amount'];
}
foreach ($breakdown as $rate => $data) {
$breakdown[$rate]['total_price_tax_excl'] = Tools::ps_round($data['total_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
$breakdown[$rate]['total_amount'] = Tools::ps_round($data['total_amount'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
}
ksort($breakdown);
return $breakdown;
}
public function getExtraDemandTaxesBreakdown($order = null)
{
if (!$order) {

View File

@@ -197,6 +197,7 @@ class OrderReturnCore extends ObjectModel
}
$objBookingDemands = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
foreach ($returnDetails as &$bookingRow) {
$bookingRow['extra_demands_price_tax_incl'] = $objBookingDemands->getRoomTypeBookingExtraDemands(
$bookingRow['id_order'],
@@ -217,6 +218,18 @@ class OrderReturnCore extends ObjectModel
1,
0
);
$bookingRow['additional_services_tax_excl'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$id_order,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0
);
if ($customerView) {
$dateJoin = $bookingRow['id_product'].'_'.strtotime($bookingRow['date_from']).strtotime($bookingRow['date_to']);
if (isset($returnsCustView[$dateJoin]['num_rooms'])) {

View File

@@ -271,7 +271,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
'ecotax_taxes' => $total_taxes - $product_taxes - $wrapping_taxes - $shipping_taxes,
'total_taxes' => $total_taxes,
'total_paid_tax_excl' => $this->order_invoice->total_paid_tax_excl,
'total_paid_tax_incl' => $this->order_invoice->total_paid_tax_incl
'total_paid_tax_incl' => $this->order_invoice->total_paid_tax_incl,
);
foreach ($footer as $key => $value) {
@@ -309,175 +309,327 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$order_obj = new Order($this->order->id);
$this->context = Context::getContext();
$products = $order_obj->getProducts();
if (Module::isInstalled('hotelreservationsystem')) {
require_once(_PS_MODULE_DIR_.'hotelreservationsystem/define.php');
$obj_cart_bk_data = new HotelCartBookingData();
$obj_htl_bk_dtl = new HotelBookingDetail();
$obj_rm_type = new HotelRoomType();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$customer = new Customer($this->order->id_customer);
if (!empty($products)) {
if (!empty($order_details)) {
$processed_product = array();
$cart_bk_data=array();
$cart_htl_data = array();
$service_product_data = array();
$room_extra_demands = array();
$room_additinal_services = array();
$totalConvenienceFeeTE = 0;
$totalConvenienceFeeTI = 0;
$totalDemandsPriceTE = 0;
$totalDemandsPriceTI = 0;
foreach ($products as $type_key => $type_value) {
foreach ($order_details 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 ($type_value['is_booking_product']) {
if ($display_product_images) {
$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)) {
$coverImageObj = new Image($cover_image_arr['id_image']);
$cover_img = _PS_PROD_IMG_DIR_.$coverImageObj->getExistingImgPath().'.jpg';
} else {
$cover_img = _PS_PROD_IMG_DIR_.$this->context->language->iso_code.'-default-small_default.jpg';
}
if (isset($customer->id)) {
$cart_obj = new Cart($this->order->id_cart);
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $cart_obj->id_guest, $type_value['product_id'], $customer->id);
} else {
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $customer->id_guest, $type_value['product_id']);
}
$rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']);
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
$cart_htl_data[$type_key]['hotel_name'] = $rm_dtl['hotel_name'];
$objBookingDemand = new HotelBookingDemands();
foreach ($order_bk_data as $data_k => $data_v) {
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
/*Product price when order was created*/
$order_details_obj = new OrderDetail($data_v['id_order_detail']);
$unit_price_tax_excl = 0;
$unit_price_tax_incl = 0;
$unit_price_tax_excl = $order_details_obj->unit_price_tax_excl;
$unit_price_tax_incl = $order_details_obj->unit_price_tax_incl;
$cart_htl_data[$type_key]['name'] = $order_details_obj->product_name;
$cart_htl_data[$type_key]['unit_price_tax_excl'] = $unit_price_tax_excl;
$cart_htl_data[$type_key]['unit_price_tax_incl'] = $unit_price_tax_incl;
if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order_obj->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
$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
);
$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
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] += $data_v['total_price_tax_excl'];
// 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]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order_obj->id,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
$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
);
$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
);
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $data_v['total_price_tax_excl'];
// For order refund
$cart_htl_data[$type_key]['date_diff'][$date_join]['id_room'] = $data_v['id_room'];
$totalDemandsPriceTE += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'];
$totalDemandsPriceTI += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'];
}
// Set tax_code
if ($taxes = OrderDetail::getTaxListStatic($data_v['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), '');
if (!empty($cover_image_arr)) {
$coverImageObj = new Image($cover_image_arr['id_image']);
$cover_img = _PS_PROD_IMG_DIR_.$coverImageObj->getExistingImgPath().'.jpg';
} else {
$cover_img = _PS_PROD_IMG_DIR_.$this->context->language->iso_code.'-default-small_default.jpg';
}
$cart_htl_data[$type_key]['order_detail_tax_label'] = implode(', ', $tax_temp);
} else {
$cart_htl_data[$type_key]['order_detail_tax_label'] = HTMLTemplateInvoice::l('No tax');
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
}
}
// calculate averages now
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);
if ($type_value)
if (isset($customer->id)) {
$cart_obj = new Cart($this->order->id_cart);
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $cart_obj->id_guest, $type_value['product_id'], $customer->id);
} else {
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $customer->id_guest, $type_value['product_id']);
}
$rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']);
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
$cart_htl_data[$type_key]['hotel_name'] = $rm_dtl['hotel_name'];
$objBookingDemand = new HotelBookingDemands();
foreach ($order_bk_data as $data_k => $data_v) {
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
/*Product price when order was created*/
$order_details_obj = new OrderDetail($data_v['id_order_detail']);
$unit_price_tax_excl = 0;
$unit_price_tax_incl = 0;
$unit_price_tax_excl = $order_details_obj->unit_price_tax_excl;
$unit_price_tax_incl = $order_details_obj->unit_price_tax_incl;
$cart_htl_data[$type_key]['name'] = $order_details_obj->product_name;
$cart_htl_data[$type_key]['unit_price_tax_excl'] = $unit_price_tax_excl;
$cart_htl_data[$type_key]['unit_price_tax_incl'] = $unit_price_tax_incl;
if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) {
// $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
// $order_obj->id,
// $type_value['product_id'],
// 0,
// $data_v['date_from'],
// $data_v['date_to']
// );
$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
);
$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
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
1,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
$var_quant = (int)$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] += ($data_v['total_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']);
// 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]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
// $order_obj->id,
// $type_value['product_id'],
// 0,
// $data_v['date_from'],
// $data_v['date_to']
// );
$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
);
$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
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0
);
$totalConvenienceFeeTI += $cart_htl_data[$type_key]['date_diff'][$date_join]['convenience_fee_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
1,
1,
Product::PRICE_ADDITION_TYPE_INDEPENDENT
);
$totalConvenienceFeeTE += $cart_htl_data[$type_key]['date_diff'][$date_join]['convenience_fee_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0,
1,
Product::PRICE_ADDITION_TYPE_INDEPENDENT
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
1,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = ($data_v['total_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']);
// For order refund
$cart_htl_data[$type_key]['date_diff'][$date_join]['id_room'] = $data_v['id_room'];
$totalDemandsPriceTE += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'];
$totalDemandsPriceTI += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'];
}
if ($extraDemands = array_shift($objBookingDemand->getRoomTypeBookingExtraDemands(
$order_obj->id,
$type_value['product_id'],
$data_v['id_room'],
$data_v['date_from'],
$data_v['date_to']
))) {
$extraDemands['product_id'] = $type_value['product_id'];
$extraDemands['room_type_name'] = $type_value['product_name'];
$extraDemands['date_from'] = $data_v['date_from'];
$extraDemands['date_to'] = $data_v['date_to'];
$room_extra_demands[] = $extraDemands;
}
if ($additionalServices = array_shift($objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$order_obj->id,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room']
))) {
$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;
}
// Set tax_code
if ($taxes = OrderDetail::getTaxListStatic($data_v['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), '');
}
$cart_htl_data[$type_key]['order_detail_tax_label'] = implode(', ', $tax_temp);
} else {
$cart_htl_data[$type_key]['order_detail_tax_label'] = HTMLTemplateInvoice::l('No tax');
}
}
// calculate averages now
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;
}
}
unset($tax_temp);
@@ -485,11 +637,21 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
// enter extra demands price to the footer total details
$footer['total_extra_demands_ti'] = $totalDemandsPriceTI;
$footer['total_extra_demands_te'] = $totalDemandsPriceTE;
$footer['total_convenience_fee_ti'] = $totalConvenienceFeeTI;
$footer['total_convenience_fee_te'] = $totalConvenienceFeeTE;
}
}
$footer['room_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, true);
$footer['room_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, true);
$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) + $totalDemandsPriceTE;
$footer['additional_service_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTI;
$data = array(
'cart_htl_data' => $cart_htl_data,
'service_product_data' => $service_product_data,
'room_extra_demands' => $room_extra_demands,
'room_additinal_services' => $room_additinal_services,
'order' => $this->order,
'order_invoice' => $this->order_invoice,
'order_details' => $order_details,
@@ -519,6 +681,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
'addresses_tab' => $this->smarty->fetch($this->getTemplate('invoice.addresses-tab')),
'summary_tab' => $this->smarty->fetch($this->getTemplate('invoice.summary-tab')),
'product_tab' => $this->smarty->fetch($this->getTemplate('invoice.product-tab')),
'service_product_tab' => $this->smarty->fetch($this->getTemplate('invoice.service-product-tab')),
'extra_demands_tab' => $this->smarty->fetch($this->getTemplate('invoice.extra-demands-tab')),
'tax_tab' => $this->getTaxTabContent(),
'payment_tab' => $this->smarty->fetch($this->getTemplate('invoice.payment-tab')),
@@ -545,6 +708,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
// code to send name of the taxes applied on the order to show names od taxes in the invoice for GST
$showTaxName = 0;
if ($tax_breakdowns = $this->getTaxBreakdown()) {
if (Configuration::get('PS_INVOICE_TAXES_BREAKDOWN')) {
$showTaxName = 1;
@@ -567,7 +731,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
'showTaxName' => $showTaxName,
'use_one_after_another_method' => $this->order_invoice->useOneAfterAnotherTaxComputationMethod(),
'display_tax_bases_in_breakdowns' => $this->order_invoice->displayTaxBasesInProductTaxesBreakdown(),
'product_tax_breakdown' => $this->order_invoice->getProductTaxesBreakdown($this->order),
// 'product_tax_breakdown' => $this->order_invoice->getProductTaxesBreakdown($this->order),
'shipping_tax_breakdown' => $this->order_invoice->getShippingTaxesBreakdown($this->order),
'ecotax_tax_breakdown' => $this->order_invoice->getEcoTaxTaxesBreakdown(),
'wrapping_tax_breakdown' => $this->order_invoice->getWrappingTaxesBreakdown(),
@@ -594,13 +758,15 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
protected function getTaxBreakdown()
{
$breakdowns = array(
'product_tax' => $this->order_invoice->getProductTaxesBreakdown($this->order),
'room_tax' => $this->order_invoice->getRoomsTaxesBreakdown($this->order),
'additional_services_tax' => $this->order_invoice->getAdditionalServicesTaxesBreakdown($this->order),
'convenience_fee_tax' => $this->order_invoice->getConvenienceFeeTaxesBreakdown($this->order),
'extra_demands_tax' => $this->order_invoice->getExtraDemandTaxesBreakdown($this->order),
'service_products_tax' => $this->order_invoice->getServiceProductsTaxesBreakdown($this->order),
'shipping_tax' => $this->order_invoice->getShippingTaxesBreakdown($this->order),
'ecotax_tax' => $this->order_invoice->getEcoTaxTaxesBreakdown(),
'wrapping_tax' => $this->order_invoice->getWrappingTaxesBreakdown(),
);
foreach ($breakdowns as $type => $bd) {
if (empty($bd)) {
unset($breakdowns[$type]);
@@ -617,12 +783,36 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
}
}
if (isset($breakdowns['additional_services_tax'])) {
foreach ($breakdowns['additional_services_tax'] as &$bd) {
$bd['total_tax_excl'] = $bd['total_price_tax_excl'];
}
}
if (isset($breakdowns['room_tax'])) {
foreach ($breakdowns['room_tax'] as &$bd) {
$bd['total_tax_excl'] = $bd['total_price_tax_excl'];
}
}
if (isset($breakdowns['extra_demands_tax'])) {
foreach ($breakdowns['extra_demands_tax'] as &$bd) {
$bd['total_tax_excl'] = $bd['total_price_tax_excl'];
}
}
if (isset($breakdowns['service_products_tax'])) {
foreach ($breakdowns['service_products_tax'] as &$bd) {
$bd['total_tax_excl'] = $bd['total_price_tax_excl'];
}
}
if (isset($breakdowns['convenience_fee_tax'])) {
foreach ($breakdowns['convenience_fee_tax'] as &$bd) {
$bd['total_tax_excl'] = $bd['total_price_tax_excl'];
}
}
if (isset($breakdowns['ecotax_tax'])) {
foreach ($breakdowns['ecotax_tax'] as &$bd) {
$bd['total_tax_excl'] = $bd['ecotax_tax_excl'];

View File

@@ -279,8 +279,8 @@ class TreeCore
public function getTemplateFile($template)
{
if (preg_match_all('/((?:^|[A-Z])[a-z]+)/', get_class($this->getContext()->controller), $matches) !== false) {
$controller_name = strtolower($matches[0][1]);
if (preg_match_all('/[^Admin].*(?=Controller)/', get_class($this->getContext()->controller), $matches) !== false) {
$controller_name = strtolower(Tools::toUnderscoreCase($matches[0][0]));
}
if ($this->getContext()->controller instanceof ModuleAdminController && isset($controller_name) && file_exists($this->_normalizeDirectory(

View File

@@ -350,7 +350,6 @@ class AdminCartsControllerCore extends AdminController
$this->context->cart->recyclable = 0;
$this->context->cart->gift = 0;
}
/*if (!$this->context->cart->id_customer)
$this->context->cart->id_customer = $id_customer;*/
if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists()) {
@@ -596,6 +595,7 @@ class AdminCartsControllerCore extends AdminController
$cart_detail_data = $cart_detail_data_obj->getCartFormatedBookinInfoByIdCart((int) $id_cart);
$this->context->smarty->assign(array(
'cart_detail_data' => $cart_detail_data,
'currency' => new Currency((int)$this->context->cart->id_currency),
));
$tpl_path = 'default/template/controllers/orders/_current_cart_details_data.tpl';
@@ -939,7 +939,7 @@ class AdminCartsControllerCore extends AdminController
if ($bookingInfo['id'] == $id_booking_data) {
$amt_with_qty = $bookingInfo['amt_with_qty'];
$bookingInfo['amt_with_qty'] = Tools::displayPrice($amt_with_qty);
$bookingInfo['total_price'] = Tools::displayPrice($amt_with_qty + $bookingInfo['demand_price']);
$bookingInfo['total_price'] = Tools::displayPrice($amt_with_qty + $bookingInfo['demand_price'] + $bookingInfo['additional_service_price']);
$response = array(
'curr_booking_info' => $bookingInfo,
'cart_info' => $this->ajaxReturnVars(),
@@ -1065,14 +1065,50 @@ class AdminCartsControllerCore extends AdminController
}
$this->context->smarty->assign('roomTypeDemands', $roomTypeDemands);
$this->context->smarty->assign('selectedRoomDemands', $selectedRoomDemands);
$response['status'] = true;
$response['html_exta_demands'] = $this->context->smarty->fetch(
_PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_cart_booking_demands.tpl'
);
}
}
$htlCartBoookingata = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange(
$idCart,
$idProduct,
$dateFrom,
$dateTo,
$idRoom
);
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($selectedRoomServiceProduct = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$idCart,
0,
0,
$idProduct,
$dateFrom,
$dateTo,
$htlCartBoookingata['id'],
0,
null,
null
)) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null);
foreach ($selectedRoomServiceProduct as $key => $selectedProducts) {
$objRoom = new HotelRoomInformation($selectedProducts['id_room']);
$selectedRoomServiceProduct[$key]['room_num'] = $objRoom->room_num;
foreach ($selectedProducts['selected_products_info'] as $product) {
$selectedRoomServiceProduct[$key]['selected_products'][] = $product['id_product'];
}
}
$this->context->smarty->assign(array(
'roomTypeServiceProducts' => $roomTypeServiceProducts,
'selectedRoomServiceProduct' => $selectedRoomServiceProduct
));
}
}
}
$response['status'] = true;
$response['html_exta_demands'] = $this->context->smarty->fetch(
_PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_cart_booking_demands.tpl'
);
$this->ajaxDie(json_encode($response));
}

View File

@@ -45,10 +45,7 @@ class AdminCategoriesControllerCore extends AdminController
public function __construct()
{
// redirect to admin dashboard as no entry allowed in category controller. It will be managed solely from
// hotel creation , updation and deletion
$this->context = Context::getContext();
// Tools::redirectAdmin($this->context->link->getAdminLink('AdminDashboard'));
$this->bootstrap = true;
$this->table = 'category';
@@ -116,13 +113,18 @@ class AdminCategoriesControllerCore extends AdminController
// context->shop is set in the init() function, so we move the _category instanciation after that
if (($id_category = Tools::getvalue('id_category')) && $this->action != 'select_delete') {
$this->_category = new Category($id_category);
// check if this category lies in location, if true then set category to products category.
if (!$this->_category->hasParent(Configuration::get('PS_SERVICE_CATEGORY'))) {
$this->_category = new Category(Configuration::get('PS_SERVICE_CATEGORY'));
}
} else {
if (Shop::getContext() == Shop::CONTEXT_SHOP) {
$this->_category = new Category($this->context->shop->id_category);
$this->_category = new Category(Configuration::get('PS_SERVICE_CATEGORY'));
} elseif (count(Category::getCategoriesWithoutParent()) > 1 && Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(true, null, true)) != 1) {
$this->_category = Category::getTopCategory();
} else {
$this->_category = new Category(Configuration::get('PS_HOME_CATEGORY'));
$this->_category = new Category(Configuration::get('PS_SERVICE_CATEGORY'));
}
}
@@ -141,7 +143,7 @@ class AdminCategoriesControllerCore extends AdminController
$id_parent = (int)Configuration::get('PS_ROOT_CATEGORY');
}
} else {
$id_parent = $this->context->shop->id_category;
$id_parent = Configuration::get('PS_SERVICE_CATEGORY');
}
$this->_select = 'sa.position position';
$this->original_filter = $this->_filter .= ' AND `id_parent` = '.(int)$id_parent.' ';
@@ -172,8 +174,6 @@ class AdminCategoriesControllerCore extends AdminController
public function initPageHeaderToolbar()
{
parent::initPageHeaderToolbar();
if ($this->display != 'edit' && $this->display != 'add') {
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE')) {
$this->page_header_toolbar_btn['new-url'] = array(
@@ -189,6 +189,7 @@ class AdminCategoriesControllerCore extends AdminController
'icon' => 'process-icon-new'
);
}
parent::initPageHeaderToolbar();
}
public function initContent()
@@ -334,7 +335,7 @@ class AdminCategoriesControllerCore extends AdminController
}
}
if (!$this->lite_display && isset($this->toolbar_btn['back']['href']) && $this->_category->level_depth > 1
&& $this->_category->id_parent && $this->_category->id_parent != (int)Configuration::get('PS_ROOT_CATEGORY')) {
&& $this->_category->id_parent && $this->_category->id_parent != (int)Configuration::get('PS_SERVICE_CATEGORY')) {
$this->toolbar_btn['back']['href'] .= '&id_category='.(int)$this->_category->id_parent;
}
}
@@ -381,14 +382,14 @@ class AdminCategoriesControllerCore extends AdminController
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_categories';
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-empty-categories';
$helper->icon = 'icon-bookmark-empty';
$helper->color = 'color2';
$helper->href = $this->context->link->getAdminLink('AdminTracking');
$helper->title = $this->l('Empty Categories', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=empty_categories';
$kpis[] = $helper->generate();
// $helper = new HelperKpi();
// $helper->id = 'box-empty-categories';
// $helper->icon = 'icon-bookmark-empty';
// $helper->color = 'color2';
// $helper->href = $this->context->link->getAdminLink('AdminTracking');
// $helper->title = $this->l('Empty Categories', null, null, false);
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=empty_categories';
// $kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-top-category';
@@ -505,7 +506,7 @@ class AdminCategoriesControllerCore extends AdminController
'id' => 'categories-tree',
'selected_categories' => $selected_categories,
'disabled_categories' => (!Tools::isSubmit('add'.$this->table) && !Tools::isSubmit('submitAdd'.$this->table)) ? array($this->_category->id) : null,
'root_category' => $context->shop->getCategory()
'root_category' => Configuration::get('PS_SERVICE_CATEGORY')
)
),
array(

View File

@@ -254,7 +254,7 @@ class AdminDashboardControllerCore extends AdminController
$hotelOptions = array(array('id_hotel' => false, 'hotel_name' => $this->l('All Hotels')));
foreach ($idsHotel as $idHotel) {
$objHotelBranchInfo = new HotelBranchInformation($idHotel, $this->context->language->id);
$hotelAddressInfo = $objHotelBranchInfo->getAddress($idHotel);
$hotelAddressInfo = HotelBranchInformation::getAddress($idHotel);
$hotelOptions[] = array(
'id_hotel' => (int) $idHotel,
'hotel_name' => $objHotelBranchInfo->hotel_name.', '.$hotelAddressInfo['city'],

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -298,6 +298,15 @@ class AdminPPreferencesControllerCore extends AdminController
'required' => false,
'type' => 'bool'
),
'PS_SERVICE_PRODUCT_CATEGORY_FILTER' => array(
'title' => $this->l('Show category filter for service products'),
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
'type' => 'bool'
),
'PS_HOTEL_IMAGES_PER_PAGE' => array(
'title' => $this->l('Number of hotel images per page'),
'hint' => $this->l('Number of hotel images displayed per page. Default is 9.'),

View File

@@ -205,6 +205,7 @@ class AdminPdfControllerCore extends AdminController
public function generatePDF($object, $template)
{
$pdf = new PDF($object, $template, Context::getContext()->smarty);
$pdf->render();
// @todo remove "I"
$pdf->render("I");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -176,13 +176,31 @@ class AdminStatsControllerCore extends AdminStatsTabController
'.Shop::addSqlAssociation('category', 'c'));
}
public static function getDisabledRoomTypes()
{
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
WHERE product_shop.active = 0 AND p.`booking_product` = 1');
}
public static function getTotalRoomTypes()
{
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
WHERE p.`booking_product` = 1');
}
public static function getDisabledProducts()
{
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
WHERE product_shop.active = 0');
WHERE product_shop.active = 0 AND p.`booking_product` = 0');
}
public static function getTotalProducts()
@@ -190,7 +208,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p'));
'.Shop::addSqlAssociation('product', 'p').'
WHERE p.`booking_product` = 0');
}
public static function getTotalSales($date_from, $date_to, $granularity = false, $id_hotel = false)
@@ -370,6 +389,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
GROUP BY pr.`id_product`
) t ON t.`id_product` = pr.`id_product`
) t ON t.`id_product` = capr.`id_product`
RIGHT JOIN `'._DB_PREFIX_.'category` c2
ON c2.`id_category` = '.(int)Configuration::get('PS_SERVICE_CATEGORY').' AND ca.`nleft` >= c2.`nleft` AND ca.`nright` <= c2.`nright`
WHERE ca.`level_depth` > 1
GROUP BY ca.`id_category`
ORDER BY SUM(t.`totalPriceSold`) DESC');
@@ -618,8 +639,22 @@ class AdminStatsControllerCore extends AdminStatsTabController
$value = AdminStatsController::getDisabledCategories();
break;
case 'disabled_room_types':
if (AdminStatsController::getTotalRoomTypes()) {
$value = round(100 * AdminStatsController::getDisabledRoomTypes() / AdminStatsController::getTotalRoomTypes(), 2).'%';
} else {
$value = '0%';
}
ConfigurationKPI::updateValue('DISABLED_ROOM_TYPES', $value);
ConfigurationKPI::updateValue('DISABLED_ROOM_TYPES_EXPIRE', strtotime('+2 hour'));
break;
case 'disabled_products':
$value = round(100 * AdminStatsController::getDisabledProducts() / AdminStatsController::getTotalProducts(), 2).'%';
if (AdminStatsController::getTotalProducts()) {
$value = round(100 * AdminStatsController::getDisabledProducts() / AdminStatsController::getTotalProducts(), 2).'%';
} else {
$value = '0%';
}
break;
case '8020_sales_catalog':

View File

@@ -459,21 +459,19 @@ class AuthControllerCore extends FrontController
$objHtlCart = new HotelCartBookingData();
if ($htlCartInfo = $objHtlCart->getCartCurrentDataByCartId($this->context->cart->id)) {
if (isset($htlCartInfo[0]['id_hotel']) && ($idHotel = $htlCartInfo[0]['id_hotel'])) {
if ($objHotel = new HotelBranchInformation()) {
if ($address_info = $objHotel->getAddress($idHotel)) {
$_POST['lastname'] = Tools::getValue('customer_lastname');
$_POST['firstname'] = Tools::getValue('customer_firstname');
$_POST['address1'] = $address_info['address1'];
$_POST['city'] = $address_info['city'];
$_POST['postcode'] = $address_info['postcode'];
$_POST['alias'] = 'My address';
$_POST['id_country'] = $address_info['id_country'];
$_POST['id_state'] = $address_info['id_state'];
$_POST['auto_generated'] = true;
// if form is shorter then address name will be customer name
$lastnameAddress = $_POST['lastname'];
$firstnameAddress = $_POST['firstname'];
}
if ($address_info = HotelBranchInformation::getAddress($idHotel)) {
$_POST['lastname'] = Tools::getValue('customer_lastname');
$_POST['firstname'] = Tools::getValue('customer_firstname');
$_POST['address1'] = $address_info['address1'];
$_POST['city'] = $address_info['city'];
$_POST['postcode'] = $address_info['postcode'];
$_POST['alias'] = 'My address';
$_POST['id_country'] = $address_info['id_country'];
$_POST['id_state'] = $address_info['id_state'];
$_POST['auto_generated'] = true;
// if form is shorter then address name will be customer name
$lastnameAddress = $_POST['lastname'];
$firstnameAddress = $_POST['firstname'];
}
}
}

View File

@@ -84,6 +84,9 @@ class CartControllerCore extends FrontController
} elseif (Tools::getIsset('duplicate')) {
$this->processDuplicateProduct();
CheckoutProcess::refreshCheckoutProcess();
} elseif (Tools::getIsset('updateServiceProduct')) {
$this->processUpdateServiceProduct();
CheckoutProcess::refreshCheckoutProcess();
}
// Make redirection
if (!$this->errors && !$this->ajax) {
@@ -123,8 +126,8 @@ class CartControllerCore extends FrontController
$customization_product = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'customization`
WHERE `id_cart` = '.(int)$this->context->cart->id.' AND `id_product` = '.(int)$this->id_product.' AND `id_customization` != '.(int)$this->customization_id);
$product = new Product((int)$this->id_product);
if (count($customization_product)) {
$product = new Product((int)$this->id_product);
if ($this->id_product_attribute > 0) {
$minimal_quantity = (int)Attribute::getAttributeMinimalQty($this->id_product_attribute);
} else {
@@ -144,7 +147,41 @@ class CartControllerCore extends FrontController
}
}
if ($this->context->cart->deleteProduct($this->id_product, $this->id_product_attribute, $this->customization_id, $this->id_address_delivery)) {
if ($product->booking_product) {
// delete booking data from hotel booking table(do not delete from ps cart here)
$objCartBooking = new HotelCartBookingData();
$objCartBooking->deleteCartBookingData($this->context->cart->id, $this->id_product, 0, 0, 0, 1);
$result = $this->context->cart->deleteProduct($this->id_product, $this->id_product_attribute, $this->customization_id, $this->id_address_delivery);
// now get updated available rooms
$date_from = Tools::getValue('dateFrom');
$date_to = Tools::getValue('dateTo');
$date_from = date("Y-m-d", strtotime($date_from));
$date_to = date("Y-m-d", strtotime($date_to));
$objRoomType = new HotelRoomType();
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) {
if ($id_hotel = $roomTypeInfo['id_hotel']) {
$objBookingDetail = new HotelBookingDetail();
$bookingParams = array(
'date_from' => $date_from,
'date_to' => $date_to,
'hotel_id' => $id_hotel,
'id_room_type' => $this->id_product,
'only_search_data' => 1,
);
if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) {
$total_available_rooms = $hotelRoomData['stats']['num_avail'];
}
}
}
if ($result) {
$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);
}
if ($result) {
Hook::exec('actionAfterDeleteProductInCart', array(
'id_cart' => (int)$this->context->cart->id,
'id_product' => (int)$this->id_product,
@@ -161,39 +198,6 @@ class CartControllerCore extends FrontController
}
}
if (Module::isInstalled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
$id_cart = $this->context->cart->id;
$id_product = (int) $this->id_product;
$date_from = Tools::getValue('dateFrom');
$date_to = Tools::getValue('dateTo');
$date_from = date("Y-m-d", strtotime($date_from));
$date_to = date("Y-m-d", strtotime($date_to));
$objRoomType = new HotelRoomType();
$objCartBooking = new HotelCartBookingData();
// delete booking data from hotel booking table(do not delete from ps cart here)
$result = $objCartBooking->deleteCartBookingData($id_cart, $id_product, 0, 0, 0, 0);
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($id_product)) {
if ($id_hotel = $roomTypeInfo['id_hotel']) {
$objBookingDetail = new HotelBookingDetail();
$bookingParams = array(
'date_from' => $date_from,
'date_to' => $date_to,
'hotel_id' => $id_hotel,
'id_room_type' => $id_product,
'only_search_data' => 1,
);
if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) {
$total_available_rooms = $hotelRoomData['stats']['num_avail'];
}
}
}
if ($result) {
$this->context->cookie->avail_rooms = $total_available_rooms;
}
}
$removed = CartRule::autoRemoveFromCart();
CartRule::autoAddToCart();
if (count($removed) && (int)Tools::getValue('allow_refresh')) {
@@ -264,34 +268,12 @@ class CartControllerCore extends FrontController
protected function processChangeProductInCart()
{
$mode = (Tools::getIsset('update') && $this->id_product) ? 'update' : 'add';
$date_from = Tools::getValue('dateFrom');
$date_to = Tools::getValue('dateTo');
$date_from = date("Y-m-d", strtotime($date_from));
$date_to = date("Y-m-d", strtotime($date_to));
$operator = Tools::getValue('op', 'up');
$occupancyRequiredForBooking = false;
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$occupancyRequiredForBooking = true;
}
if ($occupancyRequiredForBooking) {
if ($occupancy = json_decode(Tools::getValue('occupancy'), true)) {
$this->qty = count($occupancy);
} else {
$this->errors[] = Tools::displayError('Invalid occupnacy.');
}
} else {
$occupancy = Tools::getValue('qty');
$this->qty = $occupancy;
}
$id_cart = $this->context->cart->id;
$id_guest = $this->context->cart->id_guest;
if ($this->qty == 0) {
$this->errors[] = Tools::displayError('Null quantity.', !Tools::getValue('ajax'));
} elseif (!$this->id_product) {
if (!$this->id_product) {
$this->errors[] = Tools::displayError('Product not found', !Tools::getValue('ajax'));
}
@@ -301,101 +283,158 @@ class CartControllerCore extends FrontController
return;
}
// valdiate occupancy if providede
if ($operator == 'up') {
if ($product->booking_product) {
$occupancyRequiredForBooking = false;
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$occupancyRequiredForBooking = true;
}
if ($occupancyRequiredForBooking) {
foreach($occupancy as $key => $roomOccupancy) {
if (!isset($roomOccupancy['adults']) || !$roomOccupancy['adults'] || !Validate::isUnsignedInt($roomOccupancy['adults'])) {
$this->errors[] = sprintf(Tools::displayError('Invalid number of adults for Room %s.'), ($key + 1));
}
if (isset($roomOccupancy['children'])) {
if (!Validate::isUnsignedInt($roomOccupancy['children'])) {
$this->errors[] = sprintf(Tools::displayError('Invalid number of children for Room %s.'), ($key + 1));
}
if ($roomOccupancy['children'] > 0) {
if (!isset($roomOccupancy['child_ages']) || ($roomOccupancy['children'] != count($roomOccupancy['child_ages'])) || !is_array($roomOccupancy['child_ages'])) {
$this->errors[] = sprintf(Tools::displayError('Please provide all children age for Room %s.'), ($key + 1));
} else {
if (is_array($roomOccupancy['child_ages'])) {
foreach($roomOccupancy['child_ages'] as $childAge) {
if (!Validate::isUnsignedInt($childAge)) {
$this->errors[] = sprintf(Tools::displayError('Invalid children age for Room %s.'), ($key + 1));
if ($occupancy = json_decode(Tools::getValue('occupancy'), true)) {
$this->qty = count($occupancy);
} else {
$this->errors[] = Tools::displayError('Invalid occupnacy.');
}
} else {
$occupancy = Tools::getValue('qty');
$this->qty = $occupancy;
}
}
if ($this->qty == 0) {
$this->errors[] = Tools::displayError('Null quantity.', !Tools::getValue('ajax'));
}
// check if the product is booking product, if booking product will check room availability
if ($product->booking_product) {
// By Webkul : This code is to check available quantity of Room before adding it to cart.
// only check availability if qty is increasing
if (!$this->errors) {
$objRoomType = new HotelRoomType();
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) {
$date_from = Tools::getValue('dateFrom');
$date_to = Tools::getValue('dateTo');
$date_from = date("Y-m-d", strtotime($date_from));
$date_to = date("Y-m-d", strtotime($date_to));
$serviceProducts = json_decode(Tools::getValue('serviceProducts'),true);
// valdiate occupancy if providede
if ($operator == 'up') {
if ($occupancyRequiredForBooking) {
foreach($occupancy as $key => $roomOccupancy) {
if (!isset($roomOccupancy['adults']) || !$roomOccupancy['adults'] || !Validate::isUnsignedInt($roomOccupancy['adults'])) {
$this->errors[] = sprintf(Tools::displayError('Invalid number of adults for Room %s.'), ($key + 1));
}
if (isset($roomOccupancy['children'])) {
if (!Validate::isUnsignedInt($roomOccupancy['children'])) {
$this->errors[] = sprintf(Tools::displayError('Invalid number of children for Room %s.'), ($key + 1));
}
if ($roomOccupancy['children'] > 0) {
if (!isset($roomOccupancy['child_ages']) || ($roomOccupancy['children'] != count($roomOccupancy['child_ages'])) || !is_array($roomOccupancy['child_ages'])) {
$this->errors[] = sprintf(Tools::displayError('Please provide all children age for Room %s.'), ($key + 1));
} else {
if (is_array($roomOccupancy['child_ages'])) {
foreach($roomOccupancy['child_ages'] as $childAge) {
if (!Validate::isUnsignedInt($childAge)) {
$this->errors[] = sprintf(Tools::displayError('Invalid children age for Room %s.'), ($key + 1));
}
}
}
}
}
}
}
}
}
}
}
}
// By Webkul : This code is to check available quantity of Room before adding it to cart.
// only check availability if qty is increasing
if (!$this->errors) {
$objRoomType = new HotelRoomType();
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) {
if ($id_hotel = $roomTypeInfo['id_hotel']) {
if (strtotime($date_from) < strtotime(date('Y-m-d'))) {
$this->errors[] = Tools::displayError('You can\'t book room before current date');
} elseif (strtotime($date_from) >= strtotime($date_to)) {
$this->errors[] = Tools::displayError('Check-out date must be after check-in date');
} elseif ($maxOrdDate = HotelOrderRestrictDate::getMaxOrderDate($id_hotel)) {
// Check Order restrict condition before adding in to cart
if (strtotime('-1 day', strtotime($maxOrdDate)) < strtotime($date_from)
|| strtotime($maxOrdDate) < strtotime($date_to)
) {
$maxOrdDate = date('d-m-Y', strtotime($maxOrdDate));
$this->errors[] = Tools::displayError('You can\'t book room after date '.$maxOrdDate);
}
}
if ($occupancyRequiredForBooking) {
foreach($occupancy as $key => $roomOccupancy) {
if ($roomOccupancy['adults'] > $roomTypeInfo['max_adults']) {
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have adults more than %s'), $key + 1, $roomTypeInfo['max_adults']);
}
if ($roomOccupancy['children'] > $roomTypeInfo['max_children']) {
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have children more than %s'), $key + 1, $roomTypeInfo['max_children']);
}
if ($roomOccupancy['adults'] + $roomOccupancy['children'] > $roomTypeInfo['max_guests']) {
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have total guests more than %s'), $key + 1, $roomTypeInfo['max_guests']);
if ($id_hotel = $roomTypeInfo['id_hotel']) {
if (strtotime($date_from) < strtotime(date('Y-m-d'))) {
$this->errors[] = Tools::displayError('You can\'t book room before current date');
} elseif (strtotime($date_from) >= strtotime($date_to)) {
$this->errors[] = Tools::displayError('Check-out date must be after check-in date');
} elseif ($maxOrdDate = HotelOrderRestrictDate::getMaxOrderDate($id_hotel)) {
// Check Order restrict condition before adding in to cart
if (strtotime('-1 day', strtotime($maxOrdDate)) < strtotime($date_from)
|| strtotime($maxOrdDate) < strtotime($date_to)
) {
$maxOrdDate = date('d-m-Y', strtotime($maxOrdDate));
$this->errors[] = Tools::displayError('You can\'t book room after date '.$maxOrdDate);
}
}
}
if (!$this->errors) {
$objBookingDetail = new HotelBookingDetail();
$num_days = $objBookingDetail->getNumberOfDays($date_from, $date_to);
$req_rm = $this->qty;
$this->qty = $this->qty * (int) $num_days;
$objBookingDetail = new HotelBookingDetail();
$bookingParams = array(
'date_from' => $date_from,
'date_to' => $date_to,
'hotel_id' => $id_hotel,
'id_room_type' => $this->id_product,
'only_search_data' => 1,
'id_cart' => $id_cart,
'id_guest' => $id_guest,
);
if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) {
if (isset($hotelRoomData['stats']['num_avail'])) {
$total_available_rooms = $hotelRoomData['stats']['num_avail'];
if (Tools::getValue('op', 'up') == 'up') {
if ($total_available_rooms < $req_rm) {
die(json_encode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms)));
if ($occupancyRequiredForBooking) {
foreach($occupancy as $key => $roomOccupancy) {
if ($roomOccupancy['adults'] > $roomTypeInfo['max_adults']) {
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have adults more than %s'), $key + 1, $roomTypeInfo['max_adults']);
}
if ($roomOccupancy['children'] > $roomTypeInfo['max_children']) {
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have children more than %s'), $key + 1, $roomTypeInfo['max_children']);
}
if ($roomOccupancy['adults'] + $roomOccupancy['children'] > $roomTypeInfo['max_guests']) {
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have total guests more than %s'), $key + 1, $roomTypeInfo['max_guests']);
}
}
}
if (!$this->errors) {
$objBookingDetail = new HotelBookingDetail();
$num_days = $objBookingDetail->getNumberOfDays($date_from, $date_to);
$req_rm = $this->qty;
$this->qty = $this->qty * (int) $num_days;
$objBookingDetail = new HotelBookingDetail();
$bookingParams = array(
'date_from' => $date_from,
'date_to' => $date_to,
'hotel_id' => $id_hotel,
'id_room_type' => $this->id_product,
'only_search_data' => 1,
'id_cart' => $id_cart,
'id_guest' => $id_guest,
);
if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) {
if (isset($hotelRoomData['stats']['num_avail'])) {
$total_available_rooms = $hotelRoomData['stats']['num_avail'];
if (Tools::getValue('op', 'up') == 'up') {
if ($total_available_rooms < $req_rm) {
die(json_encode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms)));
} else {
// validate normal products if available
if ($serviceProducts) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
foreach ($serviceProducts as $key => $standartProduct) {
if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($this->id_product, $standartProduct['id_product'])) {
unset($serviceProducts[$key]);
}
}
}
}
}
} else {
$this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates');
}
} else {
$this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates');
}
} else {
$this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates');
}
} else {
die(json_encode(array('status' => 'failed3')));
}
} else {
die(json_encode(array('status' => 'failed3')));
die(json_encode(array('status' => 'failed4')));
}
}
} else {
$obj_htl_cart_booking_data = new HotelCartBookingData();
if ($product->service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
// 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.');
}
}
}
} else {
die(json_encode(array('status' => 'failed4')));
$this->errors[] = Tools::displayError('cannot add product without room in cart');
}
}
@@ -454,7 +493,6 @@ class CartControllerCore extends FrontController
if (!$product->hasAllRequiredCustomizableFields() && !$this->customization_id) {
$this->errors[] = Tools::displayError('Please fill in all of the required fields, and then save your customizations.', !Tools::getValue('ajax'));
}
if (!$this->errors) {
$cart_rules = $this->context->cart->getCartRules();
$available_cart_rules = CartRule::getCustomerCartRules($this->context->language->id, (isset($this->context->customer->id) ? $this->context->customer->id : 0), true, true, true, $this->context->cart, false, true);
@@ -464,35 +502,54 @@ class CartControllerCore extends FrontController
* To add Rooms in hotel cart
*/
$objHotelCartBookingData = new HotelCartBookingData();
$roomDemand = json_decode(Tools::getValue('roomDemands'), true);
$roomDemand = json_encode($roomDemand);
$this->availQty = $total_available_rooms;
$update_quantity = $objHotelCartBookingData->updateRoomCartBookingData(
$this->id_product,
$occupancy,
$operator,
$id_hotel,
$date_from,
$date_to,
$roomDemand,
$id_cart,
$id_guest
);
if ($operator == 'up') {
$this->availQty = $total_available_rooms - $req_rm;
$this->context->cookie->currentAddedProduct = json_encode(array(
'date_from' => $date_from,
'date_to' => $date_to,
'id_product' => $this->id_product,
'occupancy' => $occupancy,
'room_demand' => $roomDemand,
'req_rm' => $req_rm
));
if ($product->booking_product) {
$objHotelCartBookingData = new HotelCartBookingData();
$roomDemand = json_decode(Tools::getValue('roomDemands'), true);
$roomDemand = json_encode($roomDemand);
$this->availQty = $total_available_rooms;
$update_quantity = $objHotelCartBookingData->updateCartBooking(
$this->id_product,
$occupancy,
$operator,
$id_hotel,
0,
$date_from,
$date_to,
$roomDemand,
$serviceProducts,
$id_cart,
$id_guest
);
if ($operator == 'up') {
$this->availQty = $total_available_rooms - $req_rm;
$this->context->cookie->currentAddedProduct = json_encode(array(
'date_from' => $date_from,
'date_to' => $date_to,
'id_product' => $this->id_product,
'occupancy' => $occupancy,
'room_demand' => $roomDemand,
'req_rm' => $req_rm
));
} else {
$this->availQty = $total_available_rooms + $req_rm;
}
$this->context->cookie->avail_rooms = $this->availQty;
} else {
$this->availQty = $total_available_rooms + $req_rm;
$update_quantity = $this->context->cart->updateQty(
$this->qty,
$this->id_product,
$this->id_product_attribute,
$this->customization_id,
$operator,
$this->id_address_delivery
);
if ($operator == 'up') {
$this->context->cookie->currentAddedProduct = json_encode(array(
'id_product' => $this->id_product,
'qty' => $this->qty
));
}
}
$this->context->cookie->avail_rooms = $this->availQty;
/*------ BY Webkul ------*/
@@ -546,6 +603,65 @@ class CartControllerCore extends FrontController
}
}
protected function processUpdateServiceProduct()
{
$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))) {
if ($operator == 'up') {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelCartBookingData->id_product, $idServiceProduct)) {
// validate quanitity
if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) {
if ($objProduct->available_for_order) {
if ($objProduct->allow_multiple_quantity) {
if (!Validate::isUnsignedInt($qty)) {
$this->errors[] = Tools::displayError('The quantity you\'ve entered is invalid.');
}
} else {
$qty = 1;
}
} else {
$this->errors[] = Tools::displayError('This Service is not available.');
}
} 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)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct(
$idCartBooking,
$idServiceProduct,
$qty,
$this->context->cart->id,
$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
)));
}
/**
* Remove discounts on cart
*

View File

@@ -53,7 +53,7 @@ class CategoryControllerCore extends FrontController
$this->addCSS(array(
// _THEME_CSS_DIR_.'scenes.css' => 'all',
_THEME_CSS_DIR_.'category.css' => 'all',
// _THEME_CSS_DIR_.'product_list.css' => 'all',
_THEME_CSS_DIR_.'product_list.css' => 'all',
));
}
@@ -147,7 +147,7 @@ class CategoryControllerCore extends FrontController
return;
}
$htl_id_category = Tools::getValue('id_category');
$id_category = Tools::getValue('id_category');
if (!($date_from = Tools::getValue('date_from'))) {
$date_from = date('Y-m-d');
@@ -162,11 +162,7 @@ class CategoryControllerCore extends FrontController
$currency = new Currency($this->context->currency->id);
if (Module::isInstalled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
$id_hotel = HotelBranchInformation::getHotelIdByIdCategory($htl_id_category);
if ($id_hotel = HotelBranchInformation::getHotelIdByIdCategory($id_category)) {
$id_cart = $this->context->cart->id;
$id_guest = $this->context->cookie->id_guest;
@@ -183,8 +179,7 @@ class CategoryControllerCore extends FrontController
$booking_data = $objBookingDetail->dataForFrontSearch($bookingParams);
$feat_img_dir = _PS_IMG_.'rf/';
$ratting_img = _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png';
$obj_booking_detail = new HotelBookingDetail();
$num_days = $obj_booking_detail->getNumberOfDays($date_from, $date_to);
@@ -210,14 +205,25 @@ class CategoryControllerCore extends FrontController
'booking_date_from' => $date_from,
'booking_date_to' => $date_to,
'booking_data' => $booking_data,
'feat_img_dir' => $feat_img_dir,
'ratting_img' => $ratting_img,
'currency' => $currency,
'max_order_date' => $max_order_date,
'order_date_restrict' => $order_date_restrict
));
} else {
Tools::redirect($this->context->link->getPageLink('index'));
}
$feat_img_dir = _PS_IMG_.'rf/';
$ratting_img = _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png';
$this->context->smarty->assign(array(
'id_hotel' => $id_hotel,
'currency' => $currency,
'feat_img_dir' => $feat_img_dir,
'ratting_img' => $ratting_img,
));
/*if (isset($this->context->cookie->id_compare))
$this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare));

View File

@@ -44,6 +44,7 @@ class HistoryControllerCore extends FrontController
));
$this->addJqueryPlugin(array('fancybox')); //fancybox not found for some client theme
$this->addJqueryPlugin(array('scrollTo', 'footable', 'footable-sort'));
$this->addJqueryUI('ui.tooltip', 'base', true);
}
/**

View File

@@ -111,7 +111,17 @@ class OrderConfirmationControllerCore extends FrontController
$orderTotalInfo['total_demands_price_ti'] = 0;
$orderTotalInfo['total_products_te'] = 0;
$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_services_te'] = 0;
$orderTotalInfo['total_services_ti'] = 0;
$orderTotalInfo['total_convenience_fee_te'] = 0;
$orderTotalInfo['total_convenience_fee_ti'] = 0;
$orderTotalInfo['total_discounts'] = 0;
$orderTotalInfo['total_discounts_te'] = 0;
$orderTotalInfo['total_tax'] = 0;
$orderTotalInfo['total_paid'] = 0;
$orderTotalInfo['total_paid_real'] = 0;
$orderTotalInfo['total_wrapping'] = 0;
@@ -126,10 +136,14 @@ class OrderConfirmationControllerCore extends FrontController
$orderTotalInfo['total_order_amount'] = 0;
$hotelCartBookingData = new HotelCartBookingData();
$objBookingDemand = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
foreach ($cartOrders as $cartOrder) {
$idOrder = $cartOrder['id_order'];
$objCartOrder = new Order($idOrder);
$orderProducts = $objCartOrder->getProducts();
$cart_service_products = array();
$cart_htl_data = array();
if (!empty($orderProducts)) {
foreach ($orderProducts as $type_key => $type_value) {
if (in_array($type_value['product_id'], $processed_product)) {
@@ -138,6 +152,7 @@ class OrderConfirmationControllerCore extends FrontController
$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)) {
@@ -151,133 +166,254 @@ class OrderConfirmationControllerCore extends FrontController
} else {
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($idOrder, $customer->id_guest, $type_value['product_id']);
}
$rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']);
if ($rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id'])) {
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
$cart_htl_data[$type_key]['adults'] = $rm_dtl['adults'];
$cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
$cart_htl_data[$type_key]['adults'] = $rm_dtl['adults'];
$cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
foreach ($order_bk_data as $data_k => $data_v) {
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
/*Product price when order was created*/
$order_details_obj = new OrderDetail($data_v['id_order_detail']);
$cart_htl_data[$type_key]['name'] = $order_details_obj->product_name;
// $ord_refnd_info = $obj_ord_ref_info->getOderRefundInfoByIdOrderIdProductByDate($this->id_order, $type_value['product_id'], $data_v['date_from'], $data_v['date_to']);
// if ($ord_refnd_info) {
// $stage_name = $obj_refund_stages->getNameById($ord_refnd_info['refund_stage_id']);
// } else {
// $non_requested_rooms = 1;
// }
$stage_name = '';
if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
foreach ($order_bk_data as $data_k => $data_v) {
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
/*Product price when order was created*/
$order_details_obj = new OrderDetail($data_v['id_order_detail']);
$cart_htl_data[$type_key]['name'] = $order_details_obj->product_name;
//work on entring refund data
// $ord_refnd_info = $obj_ord_ref_info->getOderRefundInfoByIdOrderIdProductByDate($this->id_order, $type_value['product_id'], $data_v['date_from'], $data_v['date_to']);
// if ($ord_refnd_info) {
// $stage_name = $obj_refund_stages->getNameById($ord_refnd_info['refund_stage_id']);
// } else {
// $non_requested_rooms = 1;
// }
$stage_name = '';
if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
$var_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'];
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
$var_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
//// By webkul New way to calculate product prices with feature Prices
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']*$var_quant;
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']*$var_quant;
$cart_htl_data[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
if ($data_v['is_back_order']) {
$any_back_order = 1;
}
//refund_stage
$cart_htl_data[$type_key]['date_diff'][$date_join]['stage_name'] = $stage_name;
} else {
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
//// By webkul New way to calculate product prices with feature Prices
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']*$var_quant;
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']*$var_quant;
$cart_htl_data[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
if ($data_v['is_back_order']) {
$any_back_order = 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
// By webkul New way to calculate product prices with feature Prices
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl'];
if ($data_v['is_back_order']) {
$any_back_order = 1;
}
//refund_stage
$cart_htl_data[$type_key]['date_diff'][$date_join]['stage_name'] = $stage_name;
$cart_htl_data[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
}
//refund_stage
$cart_htl_data[$type_key]['date_diff'][$date_join]['stage_name'] = $stage_name;
// $orderTotalInfo['total_rooms_te'] += $data_v['total_price_tax_excl'];
// $orderTotalInfo['total_rooms_ti'] += $data_v['total_price_tax_incl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$idOrder,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0;
}
$extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
$idOrder,
$type_value['product_id'],
$data_v['id_room'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI;
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0;
}
$extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
$idOrder,
$type_value['product_id'],
$data_v['id_room'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE;
$orderTotalInfo['total_demands_price_ti'] += $extraDemandPriceTI;
$orderTotalInfo['total_demands_price_te'] += $extraDemandPriceTE;
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl;
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl;
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl;
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl;
$feature_price_diff = (float)($cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff;
//enter hotel name
$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(
$idOrder,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to']
);
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(
$idOrder,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
1
);
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(
$idOrder,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
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(
$idOrder,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
1,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
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(
$idOrder,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
}
} else if ($product->service_product_type == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) {
if ($product->auto_add_to_cart && $product->price_addition_type == Product::PRICE_ADDITION_TYPE_INDEPENDENT) {
$orderTotalInfo['total_convenience_fee_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$idOrder,
$type_value['product_id'],
0,
0,
0,
0,
0,
1,
1,
1
);
$orderTotalInfo['total_convenience_fee_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$idOrder,
$type_value['product_id'],
0,
0,
0,
0,
0,
1,
0,
1
);
}
} else if ($product->service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
$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 {
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
// By webkul New way to calculate product prices with feature Prices
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl'];
if ($data_v['is_back_order']) {
$any_back_order = 1;
}
//refund_stage
$cart_htl_data[$type_key]['date_diff'][$date_join]['stage_name'] = $stage_name;
$cart_htl_data[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
$type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
}
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$idOrder,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0;
}
$extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
$idOrder,
$type_value['product_id'],
$data_v['id_room'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI;
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) {
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0;
}
$extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
$idOrder,
$type_value['product_id'],
$data_v['id_room'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE;
$orderTotalInfo['total_demands_price_ti'] += $extraDemandPriceTI;
$orderTotalInfo['total_demands_price_te'] += $extraDemandPriceTE;
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl;
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl;
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl;
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl;
// $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;
$feature_price_diff = (float)($cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff;
//enter hotel name
$cart_htl_data[$type_key]['hotel_name'] = $data_v['hotel_name'];
}
}
if (!empty($cart_htl_data)) {
$this->context->smarty->assign('cart_htl_data', $cart_htl_data);
}
if (!empty($cart_service_products)) {
$this->context->smarty->assign('cart_service_products', $cart_service_products);
}
}
if (!$objCartOrder->hasInvoice()) {
$orders_has_invoice = 0;
}
$orderTotalInfo['total_wrapping'] += $objCartOrder->total_wrapping;
$orderTotalInfo['total_products_te'] += $objCartOrder->getTotalProductsWithoutTaxes();
$orderTotalInfo['total_products_ti'] += $objCartOrder->getTotalProductsWithTaxes();
$orderTotalInfo['total_rooms_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, true);
$orderTotalInfo['total_rooms_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, true);
$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_services_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $orderTotalInfo['total_demands_price_te'];
$orderTotalInfo['total_services_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $orderTotalInfo['total_demands_price_ti'];
$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;
$orderTotalInfo['total_paid'] += $objCartOrder->total_paid;
$orderTotalInfo['total_paid_real'] += $objCartOrder->total_paid_real;
}
$this->context->smarty->assign('cart_htl_data', $cart_htl_data);
}
$this->context->smarty->assign('orderTotalInfo', $orderTotalInfo);
@@ -354,6 +490,7 @@ class OrderConfirmationControllerCore extends FrontController
$this->addCSS(_THEME_CSS_DIR_.'history.css');
$this->addJS(_THEME_JS_DIR_.'history.js');
$this->addJqueryPlugin(array('fancybox')); //fancybox not found for some client theme
$this->addJqueryUI('ui.tooltip', 'base', true);
}
}
}

View File

@@ -167,7 +167,7 @@ class OrderDetailControllerCore extends FrontController
$method = Tools::getValue('method');
// extra demands popup ajax
if ($method == 'getRoomTypeBookingDemands') {
$extraDemandsTpl = '';
$response = array('reload' => false);
if (($idProduct = Tools::getValue('id_product'))
&& ($idOrder = Tools::getValue('id_order'))
&& ($dateFrom = Tools::getValue('date_from'))
@@ -195,11 +195,28 @@ class OrderDetailControllerCore extends FrontController
'extraDemands' => $extraDemands,
)
);
$extraDemandsTpl .= $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order_booking_demands.tpl');
}
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$idOrder,
0,
0,
$idProduct,
$dateFrom,
$dateTo,
0,
0,
$useTax
)) {
$this->context->smarty->assign(array(
'useTax' => $useTax,
'additionalServices' => $additionalServices,
));
}
$response['extra_demands'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order_booking_demands.tpl');
}
die($extraDemandsTpl);
die(json_encode($response));
} elseif ($method == 'submitRefundRequest') { // room cancellation ajax
$hasError = 0;
if (!$refundReason = Tools::getValue('cancellation_reason')) {
@@ -283,150 +300,270 @@ class OrderDetailControllerCore extends FrontController
//by webkul to show order details properly on order history page
if (Module::isInstalled('hotelreservationsystem')) {
include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
$objHtlBranchInfo = new HotelBranchInformation();
// if (Module::isInstalled('hotelreservationsystem')) {
// include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
// $objHtlBranchInfo = new HotelBranchInformation();
$objBookingDetail = new HotelBookingDetail();
$objRoomType = new HotelRoomType();
$objBookingDemand = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$nonRequestedRooms = 1;
$anyBackOrder = 0;
$processedProducts = array();
$cartHotelData = array();
$cartServiceProducts = array();
$total_demands_price_te = 0;
$total_demands_price_ti = 0;
$total_convenience_fee_te = 0;
$total_convenience_fee_ti = 0;
if (!empty($products)) {
foreach ($products as $type_key => $type_value) {
if (in_array($type_value['product_id'], $processedProducts)) {
continue;
}
$processedProducts[] = $type_value['product_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']);
$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'], 'small_default');
} else {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_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);
} else {
$order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']);
}
$rm_dtl = $objRoomType->getRoomTypeInfoByIdProduct($type_value['product_id']);
$cartHotelData[$type_key]['id_product'] = $type_value['product_id'];
$cartHotelData[$type_key]['cover_img'] = $cover_img;
$objBookingDemand = new HotelBookingDemands();
foreach ($order_bk_data as $data_k => $data_v) {
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
/*Product price when order was created*/
$order_details_obj = new OrderDetail($data_v['id_order_detail']);
$cartHotelData[$type_key]['name'] = $order_details_obj->product_name;
$cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity;
$cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity;
if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
$num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'];
$cartHotelData[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
$cartHotelData[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] += $data_v['total_price_tax_excl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
if ($data_v['is_back_order']) {
$anyBackOrder = 1;
}
if (!empty($cover_image_arr)) {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default');
} else {
$num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
$cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
$cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
$cartHotelData[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
}
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
if ($data_v['is_back_order']) {
$anyBackOrder = 1;
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);
} else {
$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;
$objBookingDemand = new HotelBookingDemands();
foreach ($order_bk_data as $data_k => $data_v) {
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
$cartHotelData[$type_key]['adults'] = $data_v['adults'];
$cartHotelData[$type_key]['children'] = $data_v['children'];
/*Product price when order was created*/
$order_details_obj = new OrderDetail($data_v['id_order_detail']);
$cartHotelData[$type_key]['name'] = $order_details_obj->product_name;
$cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity;
$cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity;
if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
$num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'];
$var_quant = (int) $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'];
$cartHotelData[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
$cartHotelData[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] += $data_v['total_price_tax_excl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
if ($data_v['is_back_order']) {
$anyBackOrder = 1;
}
} else {
$num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
$cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
$cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
$cartHotelData[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
$cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl'];
$cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
if ($data_v['is_back_order']) {
$anyBackOrder = 1;
}
}
$cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id'];
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$id_order,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
$id_order,
$type_value['product_id'],
$data_v['id_room'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1
);
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
$id_order,
$type_value['product_id'],
$data_v['id_room'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
0
);
$total_demands_price_ti += $extraDemandPriceTI;
$total_demands_price_te += $extraDemandPriceTE;
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl;
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl;
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl;
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl;
$feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']);
$cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff;
$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(
$id_order,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to']
);
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(
$id_order,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
1
);
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(
$id_order,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0
);
}
$cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id'];
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
// 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(
$id_order,
$type_value['product_id'],
0,
$data_v['date_from'],
$data_v['date_to']
);
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
$id_order,
0,
$type_value['product_id'],
$data_v['id_room'],
$data_v['date_from'],
$data_v['date_to'],
0,
1,
1
);
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) {
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0;
}
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
$id_order,
$type_value['product_id'],
$data_v['id_room'],
1,
1,
1,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
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(
$id_order,
0,
0,
$type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id_room'],
1,
0,
1,
0
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$total_demands_price_ti += $extraDemandPriceTI;
$total_demands_price_te += $extraDemandPriceTE;
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl;
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl;
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl;
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl;
// calculate averages now
foreach ($cartHotelData[$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);
$value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6);
$feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']);
$cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff;
$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) {
if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) {
$total_convenience_fee_ti += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$id_order,
$type_value['product_id'],
0,
0,
0,
0,
0,
1,
1,
1
);
$total_convenience_fee_te += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$id_order,
$type_value['product_id'],
0,
0,
0,
0,
0,
1,
0,
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']);
$cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name'];
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;
}
}
// calculate averages now
foreach ($cartHotelData[$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);
$value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6);
$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));
}
}
$redirectTermsLink = $this->context->link->getCMSLink(new CMS(3, $this->context->language->id), null, $this->context->language->id);
@@ -435,6 +572,8 @@ class OrderDetailControllerCore extends FrontController
array(
'id_cms_refund_policy' => Configuration::get('WK_GLOBAL_REFUND_POLICY_CMS'),
'THEME_DIR' => _THEME_DIR_,
'total_convenience_fee_ti' => $total_convenience_fee_ti,
'total_convenience_fee_te' => $total_convenience_fee_te,
'total_demands_price_ti' => $total_demands_price_ti,
'total_demands_price_te' => $total_demands_price_te,
'any_back_order' => $anyBackOrder,
@@ -442,10 +581,11 @@ class OrderDetailControllerCore extends FrontController
'back_ord_msg' => Configuration::get('WK_BO_MESSAGE'),
'order_has_invoice' => $order->hasInvoice(),
'cart_htl_data' => $cartHotelData,
'cart_service_products' => $cartServiceProducts,
'non_requested_rooms' => $nonRequestedRooms,
)
);
}
// }
$objOrderReturn = new OrderReturn();
$refundedAmount = 0;
@@ -461,7 +601,6 @@ class OrderDetailControllerCore extends FrontController
'refundReqBookings' => $refundReqBookings,
'hasCompletelyRefunded' => $order->hasCompletelyRefunded(),
'refundedAmount' => $refundedAmount,
'shop_name' => strval(Configuration::get('PS_SHOP_NAME')),
'order' => $order,
'guestInformations' => (array)new Customer($order->id_customer),

View File

@@ -338,7 +338,7 @@ class OrderOpcControllerCore extends ParentOrderController
$this->ajaxDie();
break;
case 'getRoomTypeBookingDemands':
$this->ajaxDie($this->getRoomTypeBookingDemands());
$this->ajaxDie($this->getRoomTypeBookingServices());
exit;
break;
case 'changeRoomDemands':
@@ -452,20 +452,16 @@ class OrderOpcControllerCore extends ParentOrderController
$this->context->smarty->assign('checkout_process_steps', $this->checkoutProcess->getSteps());
// @todo shreesh get this checked with sumit sir
// set room type demands
$objCartBookingData = new HotelCartBookingData();
$objGlobalDemand = new HotelRoomTypeGlobalDemand();
$allDemands = $objGlobalDemand->getAllDemands();
$objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$totalFacilityCostTI = $objCartBookingData->getCartExtraDemands($this->context->cart->id, 0, 0, 0, 0, 1, 0, 1);
$totalFacilityCostTE = $objCartBookingData->getCartExtraDemands($this->context->cart->id, 0, 0, 0, 0, 1, 0, 0);
// $objGlobalDemand = new HotelRoomTypeGlobalDemand();
// $allDemands = $objGlobalDemand->getAllDemands();
// $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$this->context->smarty->assign(
array(
'orderRestrictErr' => $orderRestrictErr,
'additional_facilities_tax' => ($totalFacilityCostTI - $totalFacilityCostTE),
'totalFacilityCostTE' => $totalFacilityCostTE,
'allDemands' => $allDemands,
'defaultcurrencySign' => $objCurrency->sign,
// 'allDemands' => $allDemands,
// 'defaultcurrencySign' => $objCurrency->sign,
'THEME_DIR' => _THEME_DIR_,
'PS_CUSTOMER_ADDRESS_CREATION' => Configuration::get('PS_CUSTOMER_ADDRESS_CREATION'),
'free_shipping' => $free_shipping,
@@ -550,15 +546,20 @@ class OrderOpcControllerCore extends ParentOrderController
$this->setTemplate(_PS_THEME_DIR_ . 'order-opc-advanced.tpl');
} else {
// set used objects in the below code
$objBookingDetail = new HotelBookingDetail();
$objHtlRoomType = new HotelRoomType();
// $objBookingDetail = new HotelBookingDetail();
// $objHtlRoomType = new HotelRoomType();
$roomTypeList = $this->context->cart->getProducts();
if (!empty($roomTypeList)) {
$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();
@@ -944,9 +945,9 @@ class OrderOpcControllerCore extends ParentOrderController
return $result;
}
public function getRoomTypeBookingDemands()
public function getRoomTypeBookingServices()
{
$extraDemandsTpl = '';
$response = array('reload' => true);
if ($idProduct = Tools::getValue('id_product')) {
if (($dateFrom = Tools::getValue('date_from'))
&& ($dateTo = Tools::getValue('date_to'))
@@ -980,14 +981,42 @@ class OrderOpcControllerCore extends ParentOrderController
}
$this->context->smarty->assign('roomTypeDemands', $roomTypeDemands);
$this->context->smarty->assign('selectedRoomDemands', $selectedRoomDemands);
$extraDemandsTpl .= $this->context->smarty->fetch(
_PS_THEME_DIR_.'_partials/cart_booking_demands.tpl'
);
}
}
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($selectedRoomServiceProduct = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
0,
0,
$idProduct,
$dateFrom,
$dateTo,
0,
0,
null,
null
)) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, true, 1);
foreach ($selectedRoomServiceProduct as $key => $selectedProducts) {
foreach ($selectedProducts['selected_products_info'] as $product) {
$selectedRoomServiceProduct[$key]['selected_products'][] = $product['id_product'];
}
}
$this->context->smarty->assign(array(
'roomTypeServiceProducts' => $roomTypeServiceProducts,
'selectedRoomServiceProduct' => $selectedRoomServiceProduct
));
}
}
}
return $extraDemandsTpl;
$response['extra_demands'] = $this->context->smarty->fetch(
_PS_THEME_DIR_.'_partials/cart_booking_demands.tpl'
);
return json_encode($response);
}
public function changeRoomDemands()

View File

@@ -24,7 +24,6 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
class ProductControllerCore extends FrontController
{
public $php_self = 'product';
@@ -63,6 +62,8 @@ class ProductControllerCore extends FrontController
$this->addCSS(_THEME_CSS_DIR_.'occupancy.css');
$this->addJS(_THEME_JS_DIR_.'occupancy.js');
$this->addJqueryUI('ui.tooltip', 'base', true);
if (Configuration::get('PS_DISPLAY_JQZOOM') == 1) {
$this->addJqueryPlugin('jqzoom');
}
@@ -155,7 +156,10 @@ class ProductControllerCore extends FrontController
break;
}
}
} elseif (!$this->product->checkAccess(isset($this->context->customer->id) && $this->context->customer->id ? (int)$this->context->customer->id : 0)) {
} elseif (!$this->product->checkAccess(
isset($this->context->customer->id)
&& $this->context->customer->id ? (int)$this->context->customer->id : 0)
) {
header('HTTP/1.1 403 Forbidden');
header('Status: 403 Forbidden');
$this->errors[] = Tools::displayError('You do not have access to this Room Type.');
@@ -188,6 +192,12 @@ class ProductControllerCore extends FrontController
$this->context->cookie->last_visited_category = (int)$this->category->id_category;
}
}
if (!$this->product->booking_product) {
header('HTTP/1.1 403 Forbidden');
header('Status: 403 Forbidden');
$this->errors[] = Tools::displayError('You do not have access to this Product.');
}
}
}
@@ -286,153 +296,163 @@ class ProductControllerCore extends FrontController
$customization_datas = $this->context->cart->getProductCustomization($this->product->id, null, true);
}
#####################################################################
/*By webkul To send All needed Hotel Information on product.tpl*/
#####################################################################
$htl_features = array();
$obj_hotel_room_type = new HotelRoomType();
$room_info_by_product_id = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($this->product->id);
$productCapacity = array();
$productCapacity['adults'] = $room_info_by_product_id['adults'];
$productCapacity['children'] = $room_info_by_product_id['children'];
$this->product->capacity = $productCapacity;
$hotel_id = $room_info_by_product_id['id_hotel'];
$useTax = HotelBookingDetail::useTax();
if (isset($hotel_id) && $hotel_id) {
$obj_hotel_branch = new HotelBranchInformation();
$hotel_info_by_id = $obj_hotel_branch->hotelBranchesInfo(false, 2, 1, $hotel_id);
$hotel_policies = $hotel_info_by_id['policies'];
$hotel_name = $hotel_info_by_id['hotel_name'];
// Check if product is a booking product or a service product
// Virtual product is booking product
if ($this->product->booking_product) {
#####################################################################
/*By webkul To send All needed Hotel Information on product.tpl*/
#####################################################################
$addressInfo = $obj_hotel_branch->getAddress($room_info_by_product_id['id_hotel']);
$hotel_location = $addressInfo['city'].
$htl_features = array();
$obj_hotel_room_type = new HotelRoomType();
$room_info_by_product_id = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($this->product->id);
$productCapacity = array();
$productCapacity['adults'] = $room_info_by_product_id['adults'];
$productCapacity['children'] = $room_info_by_product_id['children'];
$this->product->capacity = $productCapacity;
if ($hotel_id = $room_info_by_product_id['id_hotel']) {
$obj_hotel_branch = new HotelBranchInformation();
$hotel_info_by_id = $obj_hotel_branch->hotelBranchesInfo(false, 2, 1, $hotel_id);
$hotel_policies = $hotel_info_by_id['policies'];
$hotel_name = $hotel_info_by_id['hotel_name'];
$addressInfo = HotelBranchInformation::getAddress($room_info_by_product_id['id_hotel']);
$hotel_location = $addressInfo['city'].
($addressInfo['id_state']?', '.$addressInfo['state']:'').', '.$addressInfo['country'];
$obj_hotel_feaures_ids = $obj_hotel_branch->getFeaturesOfHotelByHotelId($hotel_id);
$obj_hotel_feaures_ids = $obj_hotel_branch->getFeaturesOfHotelByHotelId($hotel_id);
if (isset($obj_hotel_feaures_ids) && $obj_hotel_feaures_ids) {
foreach ($obj_hotel_feaures_ids as $key => $value) {
$obj_htl_ftr = new HotelFeatures();
$htl_info = $obj_htl_ftr->getFeatureInfoById($value['feature_id']);
$htl_features[] = $htl_info['name'];
if (isset($obj_hotel_feaures_ids) && $obj_hotel_feaures_ids) {
foreach ($obj_hotel_feaures_ids as $key => $value) {
$obj_htl_ftr = new HotelFeatures();
$htl_info = $obj_htl_ftr->getFeatureInfoById($value['feature_id']);
$htl_features[] = $htl_info['name'];
}
}
}
$date_from = Tools::getValue('date_from');
$date_to = Tools::getValue('date_to');
$date_from = Tools::getValue('date_from');
$date_to = Tools::getValue('date_to');
if (!($date_from = Tools::getValue('date_from'))) {
$date_from = date('Y-m-d');
$date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from)));
}
if (!($date_to = Tools::getValue('date_to'))) {
$date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from)));
}
$hotel_branch_obj = new HotelBranchInformation($hotel_id);
/*Max date of ordering for order restrict*/
$order_date_restrict = false;
$max_order_date = HotelOrderRestrictDate::getMaxOrderDate($hotel_id);
if ($max_order_date) {
$max_order_date = date('Y-m-d', strtotime($max_order_date));
if (strtotime('-1 day', strtotime($max_order_date)) < strtotime($date_from)
|| strtotime($max_order_date) < strtotime($date_to)
) {
$order_date_restrict = true;
if (!($date_from = Tools::getValue('date_from'))) {
$date_from = date('Y-m-d');
$date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from)));
}
if (!($date_to = Tools::getValue('date_to'))) {
$date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from)));
}
}
/*End*/
// booking preparation time
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id);
$hotelImageLink = null;
if ($coverImage = HotelImage::getCover($hotel_id)) {
$hotelImagesBaseDir = _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_img/';
$hotelImageLink = $this->context->link->getMediaLink(
$hotelImagesBaseDir.$coverImage['hotel_image_id'].'.jpg'
$hotel_branch_obj = new HotelBranchInformation($hotel_id);
/*Max date of ordering for order restrict*/
$order_date_restrict = false;
$max_order_date = HotelOrderRestrictDate::getMaxOrderDate($hotel_id);
if ($max_order_date) {
$max_order_date = date('Y-m-d', strtotime($max_order_date));
if (strtotime('-1 day', strtotime($max_order_date)) < strtotime($date_from)
|| strtotime($max_order_date) < strtotime($date_to)
) {
$order_date_restrict = true;
}
}
/*End*/
// booking preparation time
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id);
$hotelImageLink = null;
if ($coverImage = HotelImage::getCover($hotel_id)) {
$hotelImagesBaseDir = _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_img/';
$hotelImageLink = $this->context->link->getMediaLink(
$hotelImagesBaseDir.$coverImage['hotel_image_id'].'.jpg'
);
}
// get room type additional demands
$objRoomDemands = new HotelRoomTypeDemand();
if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($this->product->id)) {
foreach ($roomTypeDemands as &$demand) {
// if demand has advance options then set demand price as first advance option price.
if (isset($demand['adv_option']) && $demand['adv_option']) {
$demand['price'] = current($demand['adv_option'])['price'];
}
}
}
Media::addJsDef(array(
'hotel_loc' => array(
'latitude' => $hotel_branch_obj->latitude,
'longitude' => $hotel_branch_obj->longitude,
)
));
$this->context->smarty->assign(
array(
'id_hotel' => $hotel_id,
'room_type_demands' => $roomTypeDemands,
'room_type_info' => $room_info_by_product_id,
'isHotelRefundable' => $hotel_branch_obj->isRefundable(),
'max_order_date' => $max_order_date,
'preparation_time' => $preparationTime,
'warning_num' => Configuration::get('WK_ROOM_LEFT_WARNING_NUMBER'),
'ratting_img_path' => _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png',
'product_controller_url' => $this->context->link->getPageLink('product'),
'date_from' => $date_from,
'date_to' => $date_to,
'hotel_check_in' => date('h:i a', strtotime($hotel_branch_obj->check_in)),
'hotel_check_out' => date('h:i a', strtotime($hotel_branch_obj->check_out)),
'hotel_location' => $hotel_location,
'hotel_latitude' => $hotel_branch_obj->latitude,
'hotel_longitude' => $hotel_branch_obj->longitude,
'hotel_map_input_text' => $hotel_branch_obj->map_input_text,
'hotel_address1' => $addressInfo['address1'],
'hotel_phone' => $addressInfo['phone'],
'hotel_name' => $hotel_name,
'hotel_policies' => $hotel_policies,
'hotel_features' => $htl_features,
'hotel_image_link' => $hotelImageLink,
'hotel_has_images' => (bool) HotelImage::getCover($hotel_id),
'ftr_img_src' => _PS_IMG_.'rf/',
'order_date_restrict' => $order_date_restrict,
'PS_SERVICE_PRODUCT_CATEGORY_FILTER' => Configuration::get('PS_SERVICE_PRODUCT_CATEGORY_FILTER'),
)
);
}
Media::addJsDef(array(
'hotel_loc' => array(
'latitude' => $hotel_branch_obj->latitude,
'longitude' => $hotel_branch_obj->longitude,
)
));
$this->assignBookingFormVars($this->product->id, $date_from, $date_to);
$this->assignServiceProductVars();
// product price after imposing feature prices...
if ($useTax) {
$priceProduct = Product::getPriceStatic($this->product->id, true);
$feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, true);
} else {
$priceProduct = Product::getPriceStatic($this->product->id, false);
$feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, false);
}
$productPriceWithoutReduction = $this->product->getPriceWithoutReduct(!$useTax);
$feature_price_diff = (float)($productPriceWithoutReduction - $feature_price);
$this->context->smarty->assign('feature_price', $feature_price);
$this->context->smarty->assign('feature_price_diff', $feature_price_diff);
// send hotel refund rules
if ($hotel_branch_obj->active_refund) {
$objBranchRefundRules = new HotelBranchRefundRules();
if ($hotelRefundRules = $objBranchRefundRules->getHotelRefundRules($hotel_id, 0, 1, 0, 1)) {
$this->context->smarty->assign('hotelRefundRules', $hotelRefundRules);
}
}
} else {
// when using service product we will not need any new paramaters, will update interface by checking is_virtual
}
if (Tools::getValue('error')) {
$this->context->smarty->assign('error', Tools::getValue('error'));
}
$this->context->smarty->assign(
array(
'room_type_info' => $room_info_by_product_id,
'isHotelRefundable' => $hotel_branch_obj->isRefundable(),
'max_order_date' => $max_order_date,
'preparation_time' => $preparationTime,
'warning_num' => Configuration::get('WK_ROOM_LEFT_WARNING_NUMBER'),
'product_controller_url' => $this->context->link->getPageLink('product'),
'date_from' => $date_from,
'date_to' => $date_to,
'hotel_check_in' => date('h:i a', strtotime($hotel_branch_obj->check_in)),
'hotel_check_out' => date('h:i a', strtotime($hotel_branch_obj->check_out)),
'hotel_location' => $hotel_location,
'hotel_latitude' => $hotel_branch_obj->latitude,
'hotel_longitude' => $hotel_branch_obj->longitude,
'hotel_map_input_text' => $hotel_branch_obj->map_input_text,
'hotel_address1' => $addressInfo['address1'],
'hotel_phone' => $addressInfo['phone'],
'hotel_name' => $hotel_name,
'hotel_policies' => $hotel_policies,
'hotel_features' => $htl_features,
'hotel_image_link' => $hotelImageLink,
'hotel_has_images' => (bool) HotelImage::getCover($hotel_id),
'ftr_img_src' => _PS_IMG_.'rf/',
'order_date_restrict' => $order_date_restrict
)
);
$this->assignBookingFormVars($this->product->id, $date_from, $date_to);
// product price after imposing feature prices...
if ($useTax) {
$priceProduct = Product::getPriceStatic($this->product->id, true);
$feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, true);
} else {
$priceProduct = Product::getPriceStatic($this->product->id, false);
$feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, false);
}
$productPriceWithoutReduction = $this->product->getPriceWithoutReduct(!$useTax);
$feature_price_diff = (float)($productPriceWithoutReduction - $feature_price);
$this->context->smarty->assign('feature_price', $feature_price);
$this->context->smarty->assign('feature_price_diff', $feature_price_diff);
// send hotel refund rules
if ($hotel_branch_obj->active_refund) {
$objBranchRefundRules = new HotelBranchRefundRules();
if ($hotelRefundRules = $objBranchRefundRules->getHotelRefundRules($hotel_id, 0, 1, 0, 1)) {
$this->context->smarty->assign('hotelRefundRules', $hotelRefundRules);
}
}
}
// get room type additional demands
$objRoomDemands = new HotelRoomTypeDemand();
if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($this->product->id)) {
foreach ($roomTypeDemands as &$demand) {
// if demand has advance options then set demand price as first advance option price.
if (isset($demand['adv_option']) && $demand['adv_option']) {
$demand['price'] = current($demand['adv_option'])['price'];
}
}
}
// send all the common variables for all type of products
$this->context->smarty->assign(
array(
'room_type_demands' => $roomTypeDemands,
'product_controller_url' => $this->context->link->getPageLink('product'),
'ratting_img_path' => _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png',
'WK_PRICE_CALC_METHOD_EACH_DAY' => HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY,
'product_id_hotel' => $hotel_id,
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
'customizationFields' => $customization_fields,
'id_customization' => empty($customization_datas) ? null : $customization_datas[0]['id_customization'],
@@ -475,12 +495,58 @@ class ProductControllerCore extends FrontController
$this->setTemplate(_PS_THEME_DIR_.'product.tpl');
}
public function assignServiceProductVars()
{
// get service products for room type
$p = 1;
$n = RoomTypeServiceProduct::WK_NUM_RESULTS;
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$smartyVars = array();
if (Configuration::get('PS_SERVICE_PRODUCT_CATEGORY_FILTER')) {
$serviceProductsByCategory = $objRoomTypeServiceProduct->getServiceProductsGroupByCategory(
$this->product->id,
$p,
$n,
true
);
if ($serviceProductsByCategory) {
$smartyVars['service_products_exists'] = 1;
}
$smartyVars['service_products_by_category'] = $serviceProductsByCategory;
} else {
$roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData(
$this->product->id,
$p,
$n,
true
);
$numTotalServiceProducts = $this->product->getProductServiceProducts(
$this->context->language->id,
$p,
$n,
true,
2,
0,
true
);
if ($roomTypeServiceProducts) {
$smartyVars['service_products_exists'] = 1;
}
$smartyVars['service_products'] = $roomTypeServiceProducts;
$smartyVars['num_total_service_products'] = $numTotalServiceProducts;
}
$this->context->smarty->assign($smartyVars);
}
public function assignBookingFormVars(
$idProduct,
$dateFrom,
$dateTo,
$occupancy = array(),
$jsonDemands = ''
$jsonDemands = '',
$roomServiceProducts = null
) {
$objProduct = new Product($idProduct, true, $this->context->language->id, $this->context->shop->id);
if (!Validate::isLoadedObject($objProduct)) {
@@ -573,13 +639,12 @@ class ProductControllerCore extends FrontController
$featurePriceDiff = (float) ($productPriceWithoutReduction - $featurePrice);
$totalRoomPrice = $roomTypeDateRangePrice * $quantity;
// calculate demand price now
$demandsPrice = 0;
$demandsPricePerRoom = 0;
$roomTypeDemands = $objHRTDemand->getRoomTypeDemands($idProduct);
if ($jsonDemands !== '') {
$cartDemands = json_decode($jsonDemands, true);
$demandsPrice = $objHRTDemandPrice->getRoomTypeDemandsTotalPrice(
$demandsPricePerRoom = $objHRTDemandPrice->getRoomTypeDemandsTotalPrice(
$idProduct,
$cartDemands,
$useTax,
@@ -587,9 +652,58 @@ class ProductControllerCore extends FrontController
$dateTo
);
$demandsPrice *= $quantity;
// send demand info to booking form
foreach($cartDemands as &$demand) {
if (Validate::isLoadedObject(
$objRoomTypeGlobalDemand = new HotelRoomTypeGlobalDemand($demand['id_global_demand'], $this->context->language->id)
)) {
$demand['name'] = $objRoomTypeGlobalDemand->name;
if ($demand['id_option']) {
if (Validate::isLoadedObject($objDemandAdvanceOption = new HotelRoomTypeGlobalDemandAdvanceOption($demand['id_option'], $this->context->language->id))) {
if ($objDemandAdvanceOption->id_global_demand != $objRoomTypeGlobalDemand->id) {
unset($demand);
continue;
}
$demand['advance_option'] = array(
'id_option' => $objDemandAdvanceOption->id,
'name' => $objDemandAdvanceOption->name
);
} else {
unset($demand);
continue;
}
}
$demand['price'] = HotelRoomTypeDemand::getPriceStatic(
$idProduct,
$objRoomTypeGlobalDemand->id,
$demand['id_option'],
$useTax
);
}
}
$smartyVars['selected_demands'] = $cartDemands;
}
if ($roomServiceProducts) {
$serviceProductsPrice = 0;
if ($roomServiceProducts = json_decode($roomServiceProducts, true)) {
$objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice();
foreach ($roomServiceProducts as &$product) {
$objProduct = new ProductCore($product['id_product'], false, $this->context->language->id);
$product['name'] = $objProduct->name;
$product['allow_multiple_quantity'] = $objProduct->allow_multiple_quantity;
$productPrice = $objRoomTypeServiceProductPrice->getProductPrice($product['id_product'], $idProduct, $product['quantity'], $useTax);
$product['price'] = $productPrice;
$serviceProductsPrice += $productPrice;
}
$smartyVars['selected_service_product'] = $roomServiceProducts;
}
$demandsPricePerRoom += $serviceProductsPrice;
$totalPrice += $serviceProductsPrice;
}
// multiply price by number of room required
$demandsPrice = $demandsPricePerRoom * $quantity;
// calculate total price
$totalPrice = $totalRoomPrice + $demandsPrice;
// send occupancy information searched by the user
@@ -612,6 +726,7 @@ class ProductControllerCore extends FrontController
$smartyVars['total_available_rooms'] = $totalAvailableRooms;
$smartyVars['has_room_type_demands'] = $roomTypeDemands ? true : false; // whether to show price breakup
$smartyVars['rooms_price'] = $totalRoomPrice;
$smartyVars['demands_price_per_room'] = $demandsPricePerRoom;
$smartyVars['demands_price'] = $demandsPrice;
$smartyVars['total_price'] = $totalPrice;
$this->context->smarty->assign($smartyVars);
@@ -1091,16 +1206,18 @@ class ProductControllerCore extends FrontController
$dateTo = Tools::getValue('date_to');
$occupancy = Tools::getValue('occupancy');
$roomTypeDemands = Tools::getValue('room_type_demands');
$roomServiceProducts = Tools::getValue('room_service_products');
$dateFrom = date('Y-m-d', strtotime($dateFrom));
$dateTo = date('Y-m-d', strtotime($dateTo));
$this->assignServiceProductVars();
if ($this->assignBookingFormVars(
$idProduct,
$dateFrom,
$dateTo,
$occupancy,
$roomTypeDemands
$roomTypeDemands,
$roomServiceProducts
)) {
$html = $this->context->smarty->fetch('_partials/booking-form.tpl');
$response['status'] = true;
@@ -1145,4 +1262,88 @@ class ProductControllerCore extends FrontController
die(json_encode($response));
}
public function displayAjaxGetServiceProducts()
{
$response = array(
'status' => false
);
$p = Tools::getValue('p');
$id_product = Tools::getValue('id_product');
$id_category = Tools::getValue('id_category');
if ($this->isTokenValid()) {
if ($p && $id_product) {
if (Validate::isLoadedObject($objProduct = new Product($id_product))) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$n = RoomTypeServiceProduct::WK_NUM_RESULTS;
if (Configuration::get('PS_SERVICE_PRODUCT_CATEGORY_FILTER') && !$id_category) {
$response['error'] = Tools::displayError('Invaild Request, please try again');
}
if (empty($response['error'])) {
$response['status'] = true;
if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData(
$objProduct->id,
$p,
$n,
true,
2,
0,
$id_category
)) {
$this->context->smarty->assign('service_products', $roomTypeServiceProducts);
if (Configuration::get('PS_SERVICE_PRODUCT_CATEGORY_FILTER')) {
$this->context->smarty->assign('group', $id_category);
} else {
$this->context->smarty->assign('group', 'all');
}
$response['service_products'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/service-products-list.tpl');
}
}
} else {
$response['error'] = Tools::displayError('Room Type not Found');
}
} else {
$response['error'] = Tools::displayError('Invaild Request, please try again');
}
} else {
$response['error'] = Tools::displayError('Unable to process request, please try again');
}
$this->ajaxDie(json_encode($response));
}
public function displayAjaxCheckServiceProductWithRoomType()
{
$response = array(
'status' => false
);
if ($this->isTokenValid()) {
$idProduct = Tools::getValue('id_product');
$idServiceProduct = Tools::getValue('service_product');
if (Validate::isLoadedObject($objProduct = new Product($idProduct))) {
if (!Product::isBookingProduct($idProduct)) {
$response['error'] = Tools::displayError('Room Type info not Found');
$this->ajaxDie(json_encode($response));
}
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($idProduct, $idServiceProduct)) {
$response['error'] = Tools::displayError('Selected product is not available with current room type');
} else {
$response['status'] = true;
}
} else {
$response['error'] = Tools::displayError('Room Type not Found');
}
} else {
$response['error'] = Tools::displayError('Unable to process request, please try again');
}
$this->ajaxDie(json_encode($response));
}
}

View File

@@ -1249,6 +1249,11 @@ CREATE TABLE `PREFIX_order_detail` (
`reduction_amount_tax_excl` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000',
`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',
`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',
`product_ean13` varchar(13) DEFAULT NULL,
`product_upc` varchar(12) DEFAULT NULL,
`product_reference` varchar(32) DEFAULT NULL,
@@ -1513,6 +1518,7 @@ CREATE TABLE `PREFIX_product` (
`ecotax` decimal(17,6) NOT NULL DEFAULT '0.00',
`quantity` int(10) NOT NULL DEFAULT '0',
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
`allow_multiple_quantity` tinyint(1) unsigned NOT NULL DEFAULT '1',
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
`wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000',
`unity` varchar(255) DEFAULT NULL,
@@ -1534,6 +1540,11 @@ CREATE TABLE `PREFIX_product` (
`redirect_type` ENUM('', '404', '301', '302') NOT NULL DEFAULT '',
`id_product_redirected` int(10) unsigned NOT NULL DEFAULT '0',
`available_for_order` tinyint(1) NOT NULL DEFAULT '1',
`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',
`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',
`show_price` tinyint(1) NOT NULL DEFAULT '1',
@@ -1542,6 +1553,8 @@ CREATE TABLE `PREFIX_product` (
`cache_is_pack` tinyint(1) NOT NULL DEFAULT '0',
`cache_has_attachments` tinyint(1) NOT NULL DEFAULT '0',
`is_virtual` tinyint(1) NOT NULL DEFAULT '0',
`booking_product` tinyint(1) NOT NULL DEFAULT '1',
`is_invisible` tinyint(1) NOT NULL DEFAULT '0',
`cache_default_attribute` int(10) unsigned DEFAULT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
@@ -1564,6 +1577,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_shop` (
`online_only` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ecotax` decimal(17,6) NOT NULL DEFAULT '0.000000',
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
`allow_multiple_quantity` tinyint(1) unsigned NOT NULL DEFAULT '1',
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
`wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000',
`unity` varchar(255) DEFAULT NULL,
@@ -1576,6 +1590,10 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_shop` (
`redirect_type` ENUM('', '404', '301', '302') NOT NULL DEFAULT '',
`id_product_redirected` int(10) unsigned NOT NULL DEFAULT '0',
`available_for_order` tinyint(1) NOT NULL DEFAULT '1',
`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',
`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',
`show_price` tinyint(1) NOT NULL DEFAULT '1',

View File

@@ -7,5 +7,23 @@
<entities>
<category id="Root" id_parent="" active="1"/>
<category id="Home" id_parent="Root" active="1" is_root_category="1" />
<category id="Locations" id_parent="Home" active="1"/>
<category id="Services" id_parent="Home" active="1"/>
</entities>
<category id="Locations" id_shop="1">
<name>Locations</name>
<description/>
<link_rewrite>locations</link_rewrite>
<meta_title/>
<meta_keywords/>
<meta_description/>
</category>
<category id="Services" id_shop="1">
<name>Services</name>
<description/>
<link_rewrite>services</link_rewrite>
<meta_title/>
<meta_keywords/>
<meta_description/>
</category>
</entity_category>

View File

@@ -8,5 +8,11 @@
<category_group id="category_group_1_1" id_category="Home" id_group="Visitor"/>
<category_group id="category_group_1_2" id_category="Home" id_group="Guest"/>
<category_group id="category_group_1_3" id_category="Home" id_group="Customer"/>
<category_group id="category_group_2_1" id_category="Locations" id_group="Visitor"/>
<category_group id="category_group_2_2" id_category="Locations" id_group="Guest"/>
<category_group id="category_group_2_3" id_category="Locations" id_group="Customer"/>
<category_group id="category_group_3_1" id_category="Products" id_group="Visitor"/>
<category_group id="category_group_3_2" id_category="Products" id_group="Guest"/>
<category_group id="category_group_3_3" id_category="Products" id_group="Customer"/>
</entities>
</entity_category_group>

View File

@@ -770,6 +770,12 @@
<configuration id="PS_HOME_CATEGORY" name="PS_HOME_CATEGORY">
<value>2</value>
</configuration>
<configuration id="PS_LOCATIONS_CATEGORY" name="PS_LOCATIONS_CATEGORY">
<value>3</value>
</configuration>
<configuration id="PS_SERVICE_CATEGORY" name="PS_SERVICE_CATEGORY">
<value>4</value>
</configuration>
<configuration id="PS_CONFIGURATION_AGREMENT" name="PS_CONFIGURATION_AGREMENT">
<value>0</value>
</configuration>
@@ -877,6 +883,9 @@
</configuration>
<configuration id="PS_ADVANCED_PAYMENT_API" name="PS_ADVANCED_PAYMENT_API">
<value>0</value>
</configuration>
<configuration id="PS_SERVICE_PRODUCT_CATEGORY_FILTER" name="PS_SERVICE_PRODUCT_CATEGORY_FILTER">
<value>1</value>
</configuration>
</entities>
</entity_configuration>

View File

@@ -66,12 +66,15 @@
<tab id="Stock" id_parent="" active="1" hide_host_mode="0">
<class_name>AdminStock</class_name>
</tab>
<tab id="Products" id_parent="Catalog" active="1" hide_host_mode="0">
<tab id="Room_Types" id_parent="Catalog" active="1" hide_host_mode="0">
<class_name>AdminProducts</class_name>
</tab>
<!-- <tab id="Categories" id_parent="Catalog" active="1" hide_host_mode="0">
<tab id="Products" id_parent="Catalog" active="1" hide_host_mode="0">
<class_name>AdminNormalProducts</class_name>
</tab>
<tab id="Categories" id_parent="Catalog" active="1" hide_host_mode="0">
<class_name>AdminCategories</class_name>
</tab> -->
</tab>
<!-- <tab id="Monitoring" id_parent="Catalog" active="1" hide_host_mode="0">
<class_name>AdminTracking</class_name>
</tab> -->

View File

@@ -16,4 +16,20 @@
<meta_keywords/>
<meta_description/>
</category>
<category id="Locations" id_shop="1">
<name>Locations</name>
<description/>
<link_rewrite>locations</link_rewrite>
<meta_title/>
<meta_keywords/>
<meta_description/>
</category>
<category id="Services" id_shop="1">
<name>Services</name>
<description/>
<link_rewrite>services</link_rewrite>
<meta_title/>
<meta_keywords/>
<meta_description/>
</category>
</entity_category>

View File

@@ -20,7 +20,8 @@
<tab id="Administration" name="Администрация"/>
<tab id="Stats" name="Статистика"/>
<tab id="Stock" name="Стока"/>
<tab id="Products" name="Продукти"/>
<tab id="Products" name="Управление на сервизни продукти"/>
<tab id="Room_Types" name="Управление на типове стаи"/>
<tab id="Categories" name="Категории"/>
<tab id="Monitoring" name="Мониторинг"/>
<tab id="Attributes_and_Values" name="Атрибути на продукт"/>

View File

@@ -16,4 +16,20 @@
<meta_keywords/>
<meta_description/>
</category>
<category id="Locations" id_shop="1">
<name>Locations</name>
<description/>
<link_rewrite>locations</link_rewrite>
<meta_title/>
<meta_keywords/>
<meta_description/>
</category>
<category id="Services" id_shop="1">
<name>Services</name>
<description/>
<link_rewrite>services</link_rewrite>
<meta_title/>
<meta_keywords/>
<meta_description/>
</category>
</entity_category>

View File

@@ -22,7 +22,8 @@
<tab id='Administration' name='প্রশাসন'/>
<tab id='Stats' name='পরিসংখ্যান'/>
<tab id='Stock' name='স্টক'/>
<tab id='Products' name='পণ্য সমূহ'/>
<tab id='Products' name='Manage Service Products'/>
<tab id='Room_Types' name='Manage Room Types'/>
<tab id='Categories' name='শ্রেণি'/>
<tab id='Monitoring' name='নিয়ন্ত্রণ'/>
<tab id='Attributes_and_Values' name='বিভাগসমূহ এবং মান'/>

View File

@@ -16,4 +16,20 @@
<meta_keywords/>
<meta_description/>
</category>
<category id="Locations" id_shop="1">
<name>Locations</name>
<description/>
<link_rewrite>locations</link_rewrite>
<meta_title/>
<meta_keywords/>
<meta_description/>
</category>
<category id="Services" id_shop="1">
<name>Services</name>
<description/>
<link_rewrite>services</link_rewrite>
<meta_title/>
<meta_keywords/>
<meta_description/>
</category>
</entity_category>

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