{*
* 2007-2013 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-2013 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('AdminProducts', true)|addslashes}';
var ecotax_tax_excl = parseFloat({$ecotax_tax_excl});
$(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="clearfix">';
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:'')+'<br/>';
html += '<a href="mailto:'+this.email+'">'+this.email+'</a><br />';
html += '<a onclick="Customer.select('+this.id_customer+', \''+this.firstname+' '+this.lastname+'\'); return false;" href="#" class="button">{l s='Choose'}</a></li>';
});
html += '</ul>';
}
else
html = '<div class="warn">{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>
{* END CUSTOMER AUTO-COMPLETE / TO REFACTO *}
<input type=hidden name=submitted_tabs[] value=Prices>
<h4>{l s='Product price'}</h4>
<div class=separation></div>
<div class="alert alert-info">
<span class="glyphicon glyphicon-info-sign"></span> {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"}
<table class="table table-hover">
<tr>
<td class=col-lg-2>
{include file="controllers/products/multishop/checkbox.tpl" field="wholesale_price" type="default"}
<label for=wholesale_price>{l s='Pre-tax wholesale price:'}</label>
</td>
<td>
<div class=col-lg-2>
<div class=input-group>
{if $currency->prefix}<span class=input-group-addon>{$currency->prefix}</span>{/if}
<input size=11 maxlength=14 name=wholesale_price id=wholesale_price type=text class=form-control value="{{toolsConvertPrice price=$product->wholesale_price}|string_format:'%.2f'}" onchange="this.value = this.value.replace(/,/g, '.');">
{if $currency->suffix}<span class=input-group-addon>{$currency->suffix}</span>{/if}
</div>
</div>
<div class=col-lg-6>
<small class=text-primary>{l s='Wholesale price'}</small>
</div>
</td>
</tr>
<tr>
<td>
{include file="controllers/products/multishop/checkbox.tpl" field="price" type="price"}
<label for=priceTE>{l s='Pre-tax retail price:'}</label>
</td>
<td>
<div class=col-lg-2>
<div class=input-group>
{if $currency->prefix}<span class=input-group-addon>{$currency->prefix}</span>{/if}
<input size=11 maxlength=14 id=priceTE name=price_displayed type=text class=form-control value="{{toolsConvertPrice price=$product->price}|string_format:'%.2f'}" onchange="noComma('priceTE'); $('#priceTEReal').val(this.value);" onkeyup="$('#priceType').val('TE'); $('#priceTEReal').val(this.value.replace(/,/g, '.')); if (isArrowKey(event)) return; calcPriceTI();">
<input type=hidden id=priceTEReal name=price value="{toolsConvertPrice price=$product->price}" />
{if $currency->suffix}<span class=input-group-addon>{$currency->suffix}</span>{/if}
</div>
</div>
<div class=col-lg-6>
<small class=text-primary>{l s='The pre-tax retail price to sell this product'}</small>
</div>
</td>
</tr>
<tr>
<td>
{include file="controllers/products/multishop/checkbox.tpl" field="id_tax_rules_group" type="default"}
<label for=id_tax_rules_group>{l s='Tax rule:'}</label>
</td>
<td>
<script>
noTax = {if $tax_exclude_taxe_option}true{else}false{/if};
taxesArray = new Array ();
taxesArray[0] = 0;
{foreach $tax_rules_groups as $tax_rules_group}
{if isset($taxesRatesByGroup[$tax_rules_group['id_tax_rules_group']])}
taxesArray[{$tax_rules_group.id_tax_rules_group}] = {$taxesRatesByGroup[$tax_rules_group['id_tax_rules_group']]};
{else}
taxesArray[{$tax_rules_group.id_tax_rules_group}] = 0;
{/if}
{/foreach}
ecotaxTaxRate = {$ecotaxTaxRate / 100};
</script>
<span {if $tax_exclude_taxe_option}style=display:none{/if} >
<div class=col-lg-2>
<div class=input-group>
<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>
{if $tax_exclude_taxe_option}
<small class=text-danger>
{l s='Taxes are currently disabled'}</span>
(<strong><a href="{$link->getAdminLink('AdminTaxes')|escape:'htmlall':'UTF-8'}">{l s='Tax options'}</a></strong>)
</span>
<input type=hidden value="{$product->getIdTaxRulesGroup()}" name=id_tax_rules_group />
{/if}
</div>
</div>
<div class=col-lg-6>
<a class="btn btn-primary confirm_leave" href="{$link->getAdminLink('AdminTaxRulesGroup')|escape:'htmlall':'UTF-8'}&addtax_rules_group&id_product={$product->id}">
<span class="glyphicon glyphicon-plus-sign"></span> {l s='Create'}
</a>
</div>
</span>
</td>
</tr>
<tr {if !$ps_use_ecotax} style=display:none{/if}>
<td>
{include file="controllers/products/multishop/checkbox.tpl" field="ecotax" type="default"}
<label for=ecotax>{l s='Eco-tax (tax incl.):'}</label>
</td>
<td>
<div class=col-lg-2>
<div class=input-group>
{if $currency->prefix}<span class=input-group-addon>{$currency->prefix}</span>{/if}
<input size=11 maxlength=14 id=ecotax name=ecotax type=text class=form-control value="{$product->ecotax|string_format:'%.2f'}" 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;">
{if $currency->suffix}<span class=input-group-addon>{$currency->suffix}</span>{/if}
</div>
</div>
<div class=col-lg-6>
<small class=text-primary>({l s='already included in price'})</small>
</div>
</td>
</tr>
<tr {if !$country_display_tax_label || $tax_exclude_taxe_option}style=display:none{/if} >
<td>
<label for=priceTI>{l s='Retail price with tax:'}</label>
</td>
<td>
<div class=col-lg-2>
<div class=input-group>
{if $currency->prefix}<span class=input-group-addon>{$currency->prefix}</span>{/if}
<input size=11 maxlength=14 id=priceTI type=text class=form-control onchange="noComma('priceTI');" onkeyup="$('#priceType').val('TI');if (isArrowKey(event)) return; calcPriceTE();">
<input id=priceType name=priceType type=hidden value=TE />
{if $currency->suffix}<span class=input-group-addon>{$currency->suffix}</span>{/if}
</div>
</div>
</td>
</tr>
<tr id=tr_unit_price>
<td>
{include file="controllers/products/multishop/checkbox.tpl" field="unit_price" type="unit_price"}
<label for=unit_price>{l s='Unit price:'}</label>
</td>
<td>
<div class=col-lg-2>
<div class=input-group>
{if $currency->prefix}<span class=input-group-addon>{$currency->prefix}</span>{/if}
<input size=11 maxlength=14 id=unit_price name=unit_price type=text value="{$unit_price|string_format:'%.2f'}" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); unitPriceWithTax('unit');">
{if $currency->suffix}<span class=input-group-addon>{$currency->suffix}</span>{/if}
</div>
</div>
<div class="col-lg-1 text-center">
<strong class=text-primary>{l s='per'}</strong>
</div>
<div class=col-lg-1>
<input size=6 maxlength=10 id=unity name=unity type=text value="{$product->unity|htmlentitiesUTF8}" onkeyup="if (isArrowKey(event)) return ;unitySecond();" onchange="unitySecond();">
</div>
<div class=col-lg-4>
{if $ps_tax && $country_display_tax_label}
<span class=text-primary>{l s='or'} {$currency->prefix} 0.00{$currency->suffix} {l s='per'} {$product->unity} {l s='with tax'}</span><br>
{/if}
<small class=text-primary><em>{l s='e.g. per lb.'}</em></small>
</div>
</td>
</tr>
<tr>
<td>
{include file="controllers/products/multishop/checkbox.tpl" field="on_sale" type="default"}
<label> </label>
</td>
<td>
<div class=col-lg-8>
<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.'}
</div>
</td>
</tr>
<tr>
<td>
<label>{l s='Final retail price:'}</label>
</td>
<td>
<div class="col-lg-8 text-success">
<strong>
{$currency->prefix}<span id=finalPrice>0.00</span>{$currency->suffix}<span {if $ps_tax}style=display:none{/if}> ({l s='tax incl.'})</span>
</strong>
<strong {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}
</strong>
</div>
</td>
</tr>
</table>
{if isset($specificPriceModificationForm)}
<h4>{l s='Specific prices'}</h4>
<div class=separation></div>
<div class="alert alert-info">
<span class="glyphicon glyphicon-info-sign"></span> {l s='You can set specific prices for clients belonging to different groups, different countries, etc...'}
</div>
<a class="btn btn-primary" href=# id=show_specific_price>{l s='Add a new specific price'} <span class="glyphicon glyphicon-chevron-down"></span></a>
<a class="btn btn-primary" href=# id=hide_specific_price style=display:none>{l s='Cancel new specific price'} <span class="glyphicon glyphicon-chevron-up"></span></a>
<br/><br/>
<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 style=display:none>
<script type="text/javascript">
$(document).ready(function(){
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',
currentText:'{l s='Now'}',
closeText:'{l s='Done'}',
ampm:false,
amNames:['AM', 'A'],
pmNames:['PM', 'P'],
timeFormat:'hh:mm:ss tt',
timeSuffix:'',
timeOnlyTitle:'{l s='Choose Time'}',
timeText:'{l s='Time'}',
hourText:'{l s='Hour'}',
minuteText:'{l s='Minute'}',
});
});
</script>
<table class="table table-hover">
<tr>
<td class=col-lg-2>
<label>{l s='For:'}</label>
</td>
<td>
{if !$multi_shop}
<input type=hidden name=sp_id_shop value=0>
{else}
<div class=col-lg-2>
<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-2>
<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-2>
<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-2>
<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>
</td>
</tr>
<tr>
<td>
<label>{l s='Customer:'}</label>
</td>
<td>
<div class=col-lg-2>
<input type=hidden name=sp_id_customer id=id_customer value=0>
<input type=text name=customer value="{l s='All customers'}" id=customer autocomplete=off>
</div>
<div class=col-lg-5>
<img src=../img/admin/field-loader.gif id=customerLoader style=display:none>
<div id=customers></div>
</div>
</td>
</tr>
{if $combinations|@count != 0}
<tr>
<td>
<label>{l s='Combination:'}</label>
</td>
<td>
<div class=col-lg-2>
<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>
</td>
</tr>
{/if}
<tr>
<td>
<label>{l s='Available from:'}</label>
</td>
<td>
<div class=col-lg-2>
<input class=datepicker type=text name=sp_from id=sp_from>
</div>
<div class="col-lg-1 text-center">
<strong class=text-primary>{l s='to'}</strong>
</div>
<div class=col-lg-2>
<input class=datepicker type=text name=sp_to id=sp_to>
</div>
</td>
</tr>
<tr>
<td>
<label>{l s='Starting at'}</label>
</td>
<td>
<div class=col-lg-2>
<div class=input-group>
<input type=text name=sp_from_quantity value=1 class=form-control size=3>
<span class=input-group-addon>{l s='unit'}</span>
</div>
</div>
</td>
</tr>
<tr>
<td>
<label>{l s='Product price'}
{if $country_display_tax_label}
{l s='(tax excl.):'}
{/if}
</label>
</td>
<td>
<div class=col-lg-2>
<div class=input-group>
{if $currency->prefix}<span id=spm_currency_sign_pre_0 class=input-group-addon>{$currency->prefix}</span>{/if}
<input type=text disabled=disabled name=sp_price id=sp_price class=form-control value="{$product->price|string_format:'%.2f'}" size=11>
{if $currency->suffix}<span id=spm_currency_sign_post_0 class=input-group-addon>{$currency->suffix}</span>{/if}
</div>
</div>
<div class=col-lg-6>
<div class=input-group>
<input id=leave_bprice type=checkbox value=1 checked=checked name=leave_bprice> {l s='Leave base price:'}
</div>
</div>
</td>
</tr>
<tr>
<td>
<label>{l s='Apply a discount of:'}</label>
</td>
<td>
<div class=col-lg-2>
<input type=text name=sp_reduction value=0.00 size=11>
</div>
<div class=col-lg-2>
<select name=sp_reduction_type>
<option selected=selected>-</option>
<option value=amount>{l s='Amount'}</option>
<option value=percentage>{l s='Percentage'}</option>
</select>
</div>
<div class=col-lg-4>
<small class=text-primary>{l s='The discount is applied after the tax'}</small>
</div>
</td>
</tr>
</table>
</div>
<table class="table table-hover" id=specific_prices_list>
<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>
<th>{l s='Fixed price'}</th>
<th>{l s='Impact'}</th>
<th>{l s='Period'}</th>
<th>{l s='From (quantity)'}</th>
<th>{l s='Action'}</th>
</tr>
</thead>
<tbody>
{$specificPriceModificationForm}
<script type="text/javascript">
$(document).ready(function() {
calcPriceTI();
unitPriceWithTax('unit');
});
</script>
{/if}