// Remove prices from information tab and fix price calculation with tax in AdminProducts
This commit is contained in:
@@ -328,121 +328,6 @@ var textFieldLabel = 0;
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="padding-bottom:5px;"><div class="separation"></div></td>
|
||||
</tr>
|
||||
|
||||
{* @todo : prices related has to be moved in price subtab *}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Pre-tax wholesale price:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix}<input size="11" maxlength="14" name="wholesale_price" type="text" value="{$product->wholesale_price}" onchange="this.value = this.value.replace(/,/g, '.');" />{$currency->suffix}
|
||||
<p class="preference_description">{l s='The wholesale price at which you bought this product'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Pre-tax retail price:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix}<input size="11" maxlength="14" id="priceTE" name="price" type="text" value="{$product->price}" onchange="this.value = this.value.replace(/,/g, '.');" onkeyup="if (isArrowKey(event)) return; calcPriceTI();" />{$currency->suffix}<sup> *</sup>
|
||||
<p class="preference_description">{l s='The pre-tax retail price to sell this product'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Tax rule:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<script type="text/javascript">
|
||||
noTax = {if $tax_exclude_taxe_option}true{else}false{/if};
|
||||
taxesArray = new Array ();
|
||||
taxesArray[0] = 0;
|
||||
{foreach from=$tax_rules_groups item=tax_rules_group}
|
||||
{if isset($tax_rules_group['id_tax_rules_group'][$taxesRatesByGroup])}
|
||||
taxesArray[{$tax_rules_group.id_tax_rules_group}] = {$tax_rules_group.id_tax_rules_group[$taxesRatesByGroup]};
|
||||
{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} >
|
||||
<select onChange="javascript:calcPriceTI(); 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->id_tax_rules_group == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >
|
||||
{$tax_rules_group['name']|htmlentitiesUTF8}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<a href="{$link->getAdminLink('AdminTaxRulesGroup')}&addtax_rules_group&id_product={$product->id}" onclick="return confirm('{l s='Are you sure you want to delete entered product information?'}'" >
|
||||
<img src="../img/admin/add.gif" alt="{l s='Create'}" title="{l s='Create'}" /> <b>{l s='Create'}</b>
|
||||
</a>
|
||||
</span>
|
||||
{if $tax_exclude_taxe_option}
|
||||
<span style="margin-left:10px; color:red;">{l s='Taxes are currently disabled'}</span> (<b><a href="{$link->getAdminLink('AdminTaxes')}">{l s='Tax options'}</a></b>)
|
||||
<input type="hidden" value="{$product->id_tax_rules_group}" name="id_tax_rules_group" />
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{if $ps_use_ecotax}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Eco-tax (tax incl.):' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix}<input size="11" maxlength="14" id="ecotax" name="ecotax" type="text" value="{$product->ecotax}" onkeyup="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;" />{$currency->suffix}
|
||||
<span style="margin-left:10px">({l s='already included in price'})</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr {if !$country_display_tax_label || $tax_exclude_taxe_option}style="display:none"{/if} >
|
||||
<td class="col-left"><label>{l s='Retail price with tax:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix}<input size="11" maxlength="14" id="priceTI" type="text" value="" onchange="noComma('priceTI');" onkeyup="if (isArrowKey(event)) return; calcPriceTE();" />{$currency->suffix}
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_unit_price">
|
||||
<td class="col-left"><label>{l s='Unit price without tax:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix} <input size="11" maxlength="14" id="unit_price" name="unit_price" type="text" value="{$product->unit_price}"
|
||||
onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); unitPriceWithTax('unit');"/>{$currency->suffix}
|
||||
{l s='per'} <input size="6" maxlength="10" id="unity" name="unity" type="text" value="{$product->unity|htmlentitiesUTF8}" onkeyup="if (isArrowKey(event)) return ;unitySecond();" onchange="unitySecond();"/>
|
||||
{if $ps_tax && $country_display_tax_label}
|
||||
<span style="margin-left:15px">{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> {l s='with tax'}
|
||||
</span>
|
||||
{/if}
|
||||
<p>{l s='Eg. $15 per Lb'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label> </label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input type="checkbox" name="on_sale" id="on_sale" style="padding-top: 5px;" {if $product->on_sale}checked="checked"{/if} value="1" /> <label for="on_sale" class="t">{l s='Display "on sale" icon on product page and text on product listing'}</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label><b>{l s='Final retail price:'}</b></label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<span {if !$country_display_tax_label}style="display:none"{/if} >
|
||||
{$currency->prefix}<span id="finalPrice" style="font-weight: bold;"></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" style="font-weight: bold;"></span>{$currency->suffix} {if $country_display_tax_label}({l s='tax excl.'}){/if}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label> </label></td>
|
||||
<td>
|
||||
<div class="hint clear" style="display: block;width: 70%;">{l s='You can define many discounts and specific price rules in the Prices tab'}</div>
|
||||
</td>
|
||||
</tr>
|
||||
{* [end] prices *}
|
||||
|
||||
|
||||
<tr><td colspan="2" style="padding-bottom:5px;"><div class="separation"></div></td></tr>
|
||||
{if !$ps_stock_management}
|
||||
<tr>
|
||||
@@ -499,9 +384,6 @@ var textFieldLabel = 0;
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<script type="text/javascript">
|
||||
calcPriceTI();
|
||||
</script>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='When out of stock:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
@@ -512,7 +394,7 @@ var textFieldLabel = 0;
|
||||
<br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" {if $product->out_of_stock == 2}checked="checked"{/if} />
|
||||
<label for="out_of_stock_3" class="t" id="label_out_of_stock_3">{l s='Default:'}
|
||||
<i>{if $ps_order_out_of_stock}{l s='Allow orders'}{else}{l s='Deny orders'}{/if}</i> ({l s='as set in'} <a href="{$link->getAdminLink('AdminPPreferences')}"
|
||||
onclick="return confirm(\'{l s='Are you sure you want to delete entered product information?'}')">{l s='Preferences'}</a>)</label>
|
||||
onclick="return confirm('{l s='Are you sure you want to delete entered product information?'}')">{l s='Preferences'}</a>)</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -795,5 +677,4 @@ var accessories = new Array();
|
||||
|
||||
<script type="text/javascript">
|
||||
toggleVirtualProduct(getE('is_virtual_good'));
|
||||
unitPriceWithTax('unit');
|
||||
</script>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<script type="text/javascript" src="{$smarty.const._PS_JS_DIR_}price.js"></script>
|
||||
<div class="block_specific_prices_modifications">
|
||||
<h4>{l s='Product price'}</h4>
|
||||
<div class="separation"></div>
|
||||
@@ -7,6 +8,118 @@ var product_prices = new Array();
|
||||
product_prices['{$combination.id_product_attribute}'] = '{$combination.price}';
|
||||
{/foreach}
|
||||
</script>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Pre-tax wholesale price:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix}<input size="11" maxlength="14" name="wholesale_price" type="text" value="{$product->wholesale_price}" onchange="this.value = this.value.replace(/,/g, '.');" />{$currency->suffix}
|
||||
<p class="preference_description">{l s='The wholesale price at which you bought this product'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Pre-tax retail price:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix}<input size="11" maxlength="14" id="priceTE" name="price" type="text" value="{$product->price}" onchange="this.value = this.value.replace(/,/g, '.');" onkeyup="if (isArrowKey(event)) return; calcPriceTI();" />{$currency->suffix}<sup> *</sup>
|
||||
<p class="preference_description">{l s='The pre-tax retail price to sell this product'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Tax rule:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<script type="text/javascript">
|
||||
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} >
|
||||
<select onChange="javascript:calcPriceTI(); 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->id_tax_rules_group == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >
|
||||
{$tax_rules_group['name']|htmlentitiesUTF8}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<a href="{$link->getAdminLink('AdminTaxRulesGroup')}&addtax_rules_group&id_product={$product->id}" onclick="return confirm('{l s='Are you sure you want to delete entered product information?'}'" >
|
||||
<img src="../img/admin/add.gif" alt="{l s='Create'}" title="{l s='Create'}" /> <b>{l s='Create'}</b>
|
||||
</a>
|
||||
</span>
|
||||
{if $tax_exclude_taxe_option}
|
||||
<span style="margin-left:10px; color:red;">{l s='Taxes are currently disabled'}</span> (<b><a href="{$link->getAdminLink('AdminTaxes')}">{l s='Tax options'}</a></b>)
|
||||
<input type="hidden" value="{$product->id_tax_rules_group}" name="id_tax_rules_group" />
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{if $ps_use_ecotax}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Eco-tax (tax incl.):' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix}<input size="11" maxlength="14" id="ecotax" name="ecotax" type="text" value="{$product->ecotax}" onkeyup="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;" />{$currency->suffix}
|
||||
<span style="margin-left:10px">({l s='already included in price'})</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr {if !$country_display_tax_label || $tax_exclude_taxe_option}style="display:none"{/if} >
|
||||
<td class="col-left"><label>{l s='Retail price with tax:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix}<input size="11" maxlength="14" id="priceTI" type="text" value="" onchange="noComma('priceTI');" onkeyup="if (isArrowKey(event)) return; calcPriceTE();" />{$currency->suffix}
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_unit_price">
|
||||
<td class="col-left"><label>{l s='Unit price without tax:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{$currency->prefix} <input size="11" maxlength="14" id="unit_price" name="unit_price" type="text" value="{$product->unit_price}"
|
||||
onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); unitPriceWithTax('unit');"/>{$currency->suffix}
|
||||
{l s='per'} <input size="6" maxlength="10" id="unity" name="unity" type="text" value="{$product->unity|htmlentitiesUTF8}" onkeyup="if (isArrowKey(event)) return ;unitySecond();" onchange="unitySecond();"/>
|
||||
{if $ps_tax && $country_display_tax_label}
|
||||
<span style="margin-left:15px">{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> {l s='with tax'}
|
||||
</span>
|
||||
{/if}
|
||||
<p>{l s='Eg. $15 per Lb'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label> </label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input type="checkbox" name="on_sale" id="on_sale" style="padding-top: 5px;" {if $product->on_sale}checked="checked"{/if} value="1" /> <label for="on_sale" class="t">{l s='Display "on sale" icon on product page and text on product listing'}</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label><b>{l s='Final retail price:'}</b></label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<span {if !$country_display_tax_label}style="display:none"{/if} >
|
||||
{$currency->prefix}<span id="finalPrice" style="font-weight: bold;"></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" style="font-weight: bold;"></span>{$currency->suffix} {if $country_display_tax_label}({l s='tax excl.'}){/if}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label> </label></td>
|
||||
<td>
|
||||
<div class="hint clear" style="display: block;width: 70%;">{l s='You can define many discounts and specific price rules in the Prices tab'}</div>
|
||||
</td>
|
||||
</tr>
|
||||
{* [end] prices *}
|
||||
</table>
|
||||
<div class="separation"></div>
|
||||
<h4>{l s='Current specific prices'}</h4>
|
||||
<a class="button bt-icon" href="#" onclick="$('#add_specific_price').slideToggle();return false;"><img src="../img/admin/add.gif" alt="" /><span>{l s='Add a new specific price'}</span></a>
|
||||
<br/>
|
||||
<div id="add_specific_price" style="display: none;">
|
||||
@@ -125,3 +238,7 @@ var product_prices = new Array();
|
||||
<tbody>
|
||||
{$specificPriceModificationForm}
|
||||
|
||||
<script type="text/javascript">
|
||||
calcPriceTI();
|
||||
unitPriceWithTax('unit');
|
||||
</script>
|
||||
@@ -2241,6 +2241,23 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
|
||||
|
||||
if ($this->object->id)
|
||||
{
|
||||
$product = $this->object;
|
||||
// prices part
|
||||
$data->assign('link', $this->context->link);
|
||||
$data->assign('currency', $currency = $this->context->currency);
|
||||
$data->assign('tax_rules_groups', TaxRulesGroup::getTaxRulesGroups(true));
|
||||
$data->assign('taxesRatesByGroup', TaxRulesGroup::getAssociatedTaxRatesByIdCountry($this->context->country->id));
|
||||
$data->assign('ecotaxTaxRate', Tax::getProductEcotaxRate());
|
||||
$data->assign('tax_exclude_taxe_option', Tax::excludeTaxeOption());
|
||||
|
||||
$data->assign('ps_use_ecotax', Configuration::get('PS_USE_ECOTAX'));
|
||||
if ($product->unit_price_ratio != 0)
|
||||
$data->assign('unit_price', Tools::ps_round($product->price)/$product->unit_price_ratio);
|
||||
else
|
||||
$data->assign('unit_price', 0);
|
||||
|
||||
$data->assign('ps_tax', Configuration::get('PS_TAX'));
|
||||
|
||||
$shops = Shop::getShops();
|
||||
$countries = Country::getCountries($this->context->language->id);
|
||||
$groups = Group::getGroups($this->context->language->id);
|
||||
@@ -2724,8 +2741,6 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
|
||||
$product->{'product_download'} = new ProductDownload($id_product_download);
|
||||
|
||||
$this->displayInitInformationAndAttachment();
|
||||
// @todo price.js is used in information .. for now
|
||||
$this->addJs(_PS_JS_DIR_.'price.js');
|
||||
|
||||
// @todo handle is_virtual with the value of the product
|
||||
$exists_file = realpath(_PS_DOWNLOAD_DIR_).'/'.$product->productDownload->filename;
|
||||
@@ -2779,20 +2794,6 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
|
||||
$data->assign('error_product_download', $error);
|
||||
}
|
||||
|
||||
// prices part
|
||||
$data->assign('currency', $currency = $this->context->currency);
|
||||
$data->assign('tax_rules_groups', TaxRulesGroup::getTaxRulesGroups(true));
|
||||
$data->assign('taxesRatesByGroup', TaxRulesGroup::getAssociatedTaxRatesByIdCountry($this->context->country->id));
|
||||
$data->assign('ecotaxTaxRate', Tax::getProductEcotaxRate());
|
||||
$data->assign('tax_exclude_taxe_option', Tax::excludeTaxeOption());
|
||||
|
||||
$data->assign('ps_use_ecotax', Configuration::get('PS_USE_ECOTAX'));
|
||||
if ($product->unit_price_ratio != 0)
|
||||
$data->assign('unit_price', Tools::ps_round($product->price)/$product->unit_price_ratio);
|
||||
else
|
||||
$data->assign('unit_price', 0);
|
||||
|
||||
$data->assign('ps_tax', Configuration::get('PS_TAX'));
|
||||
$data->assign('ps_stock_management', Configuration::get('PS_STOCK_MANAGEMENT'));
|
||||
$data->assign('has_attribute', $has_attribute);
|
||||
// Check if product has combination, to display the available date only for the product or for each combination
|
||||
|
||||
Reference in New Issue
Block a user