// Products

This commit is contained in:
Kevin Granger
2013-07-12 17:27:25 +02:00
parent 160857bdc3
commit c12ce3dd29
6 changed files with 428 additions and 277 deletions
@@ -36,14 +36,14 @@
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}", "{$attrname|addslashes}"
{foreach from=$attributeJs key=idgrp item=group}
attrs[{$idgrp}] = new Array(0
, '---'
{foreach from=$group key=idattr item=attrname}
, "{$idattr}", "{$attrname|addslashes}"
{/foreach}
);
{/foreach}
);
{/foreach}
</script>
<legend>{l s='Add or modify combinations for this product.'}</legend>
@@ -53,8 +53,8 @@
{if $combination_exists}
<div class="alert alert-info" style="display:block">
<p>{l s='Some combinations already exist. If you want to generate new combinations, the quantities for the existing combinations will be lost.'}</p>
<p>{l s='You can add a combination by clicking the link "Add new combination" on the toolbar.'}</p>
{l s='Some combinations already exist. If you want to generate new combinations, the quantities for the existing combinations will be lost.'}<br/>
{l s='You can add a combination by clicking the link "Add new combination" on the toolbar.'}
</div>
{/if}
{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes}
@@ -63,8 +63,9 @@
{/if}
<div id="add_new_combination" style="display: none;">
<div id="add_new_combination" class="panel" style="display: none;">
<div class="panel-heading">Panel heading</div>
<div class="row">
<label class="control-label col-lg-3">{l s='Attribute:'}</label>
@@ -81,27 +82,34 @@
<div class="row">
<label class="control-label col-lg-3">{l s='Value:'}</label>
<div class="col-lg-5">
<select name="attribute" id="attribute">
<option value="0">---</option>
</select>
<div class="col-lg-9">
<div class="row">
<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="row">
<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>
<script type="text/javascript">
$(document).ready(function(){
populate_attrs();
});
</script>
<div class="row">
<label class="control-label col-lg-3"></label>
<div class="col-lg-5">
<input type="button" value="{l s='Add'}" class="button" onclick="add_attr();"/>
<input type="button" value="{l s='Delete'}" class="button" onclick="del_attr()"/>
<select id="product_att_list" name="attribute_combination_list[]" multiple="multiple" ></select>
</div>
</div>
<hr/>
<div class="row">
@@ -120,7 +128,7 @@
<label class="control-label col-lg-3">
{l s='EAN13:'}
</label>
<div class="col-lg-5">
<div class="col-lg-3">
<input maxlength="13" type="text" id="attribute_ean13" name="attribute_ean13" value="" />
</div>
</div>
@@ -129,7 +137,7 @@
<label class="control-label col-lg-3">
{l s='UPC:'}
</label>
<div class="col-lg-5">
<div class="col-lg-3">
<input maxlength="12" type="text" id="attribute_upc" name="attribute_upc" value="" />
</div>
</div>
@@ -144,7 +152,7 @@
{l s='Wholesale price:'}
</span>
</label>
<div class="input-group col-lg-5">
<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}
@@ -154,160 +162,223 @@
<span style="display:none;" id="attribute_wholesale_price_full">({l s='Overrides wholesale price on "Information" tab'})</span>
</div>
<div class="row">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_price_impact" type="attribute_price_impact"}
<label class="control-label col-lg-3">
{l s='Impact on price:'}
</label>
<div class="col-lg-5">
<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='Reduction'}</option>
</select>
<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='Reduction'}</option>
</select>
</div>
<div id="span_impact" class="col-lg-8">
<div class="row">
<label class="control-label col-lg-1">
{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>
<label class="control-label col-lg-1">
{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='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 id="span_impact" class="row">
&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;{if $currency->format % 2 != 0}{$currency->sign} {/if}
<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();"/>{if $currency->format % 2 == 0} {$currency->sign}{/if}
{if $country_display_tax_label}
{l s='(tax excl.)'}
<span {if $tax_exclude_option}style="display:none"{/if}> {l s='or'}
{if $currency->format % 2 != 0}{$currency->sign} {/if}
<input type="text" size="6" name="attribute_priceTI" id="attribute_priceTI" value="0.00" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); calcImpactPriceTE();"/>
{if $currency->format % 2 == 0} {$currency->sign}{/if} {l s='(tax incl.)'}
</span> {l s='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}
{/if}
</div>
<div class="row">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_weight_impact" type="attribute_weight_impact"}
<label class="control-label col-lg-3">
{l s='Impact on weight:'}
</label>
<div class="col-lg-5">
<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 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">
{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>
<span id="span_weight_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;
<input type="text" name="attribute_weight" id="attribute_weight" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
{$ps_weight_unit}
</span>
</div>
</div>
<div id="tr_unit_impact" class="row">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_unit_impact" type="attribute_unit_impact"}
<label class="control-label col-lg-3">{l s='Impact on unit price :'}</label>
<div class="col-lg-5">
<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>
<span id="span_weight_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;&nbsp;&nbsp;
{if $currency->format % 2 != 0} {$currency->sign} {/if}
<input type="text" size="6" name="attribute_unity" id="attribute_unity" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />{if $currency->format % 2 == 0} {$currency->sign}{/if} / <span id="unity_third">{$field_value_unity}</span>
</span>
<div class="col-lg-6">
<div class="row">
<label class="control-label col-lg-1">
{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="row">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_ecotax" type="default"}
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='overrides Eco-tax in the "Information" tab'}">
{l s='Eco-tax (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="row">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_minimal_quantity" type="default"}
<label class="control-label col-lg-3">
<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="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>
{if $ps_use_ecotax}
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_ecotax" type="default"}
<label>{l s='Eco-tax (tax excl.):'}</label>
</td>
<td style="padding-bottom:5px;">{if $currency->format % 2 != 0}{$currency->sign}{/if}
<input type="text" size="3" name="attribute_ecotax" id="attribute_ecotax" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
{if $currency->format % 2 == 0} {$currency->sign}{/if}
({l s='overrides Eco-tax in the "Information" tab'})
</td>
</tr>
{/if}
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" class="col-left">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_minimal_quantity" type="default"}
<label>{l s='Minimum quantity:'}</label>
</td>
<td style="padding-bottom:5px;">
<input size="3" maxlength="6" name="attribute_minimal_quantity" id="attribute_minimal_quantity" type="text" value="{$minimal_quantity}" />
<p>{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" class="col-left">
{include file="controllers/products/multishop/checkbox.tpl" field="available_date_attribute" type="default"}
<label>{l s='Available date:'}</label>
</td>
<td style="padding-bottom:5px;">
<input class="datepicker" id="available_date_attribute" name="available_date_attribute" value="{$available_date}" style="text-align: center;" type="text" />
<p>{l s='The available date when this product is out of stock.'}</p>
<script type="text/javascript">
$(document).ready(function(){
$(".datepicker").datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
});
</script>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
<tr>
<td style="width:150px"><label>{l s='Image:'}</label></td>
<td style="padding-bottom:5px;">
<ul id="id_image_attr">
{foreach from=$images key=k item=image}
<li style="float: left; width: {$imageWidth}px;">
<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}" style="float: none;">
<img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-small_default.jpg" alt="{$image.legend|escape:'htmlall':'UTF-8'}" title="{$image.legend|escape:'htmlall':'UTF-8'}" />
</label>
</li>
{/foreach}
</ul>
<img id="pic" alt="" title="" style="display: none; width: 100px; height: 100px; float: left; border: 1px dashed #BBB; margin-left: 20px;" />
</td>
</tr>
<tr>
<td style="width:150px">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_default" type="attribute_default"}
<label>{l s='Default:'}</label><br /><br />
</td>
<td style="padding-bottom:5px;">
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" />
&nbsp;<label for="attribute_default" style="float:none;">{l s='Make this combination the default combination for this product'}</label><br /><br />
</td>
</tr>
<tr>
<td style="width:150px">&nbsp;</td>
<td style="padding-bottom:5px;">
<span id="ResetSpan" style="float:left;margin-left:8px;display:none;">
<input type="reset" name="ResetBtn" id="ResetBtn" onclick="getE('id_product_attribute').value = 0;" class="button" value="{l s='Cancel modification'}" />
</span>
<span class="clear"></span>
</td>
</tr>
</table>
<div class="separation"></div>
<div class="row">
{include file="controllers/products/multishop/checkbox.tpl" field="available_date_attribute" type="default"}
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='The available date when this product is out of stock.'}">
{l s='Available date:'}
</span>
</label>
<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>
<script type="text/javascript">
$(document).ready(function(){
$(".datepicker").datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
});
</script>
</div>
{$list}
<hr/>
<div class="row">
<label class="control-label col-lg-3">{l s='Image:'}</label>
<div class="col-lg-9">
<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 src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-small_default.jpg" alt="{$image.legend|escape:'htmlall':'UTF-8'}" title="{$image.legend|escape:'htmlall':'UTF-8'}" />
</label>
</li>
{/foreach}
</ul>
</div>
</div>
<div class="row">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_default" type="attribute_default"}
<label class="control-label col-lg-3">{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="getE('id_product_attribute').value = 0;" class="btn btn-default">
<i class="icon-undo"></i> {l s='Cancel modification'}
</button>
</span>
</div>
</div>
{$list}
{/if}
@@ -25,38 +25,46 @@
{if isset($id_product) && isset($product)}
<input type="hidden" name="submitted_tabs[]" value="Images" />
<h4 class="tab" >2. {l s='Images'} (<span id="countImage">{$countImages}</span>)</h4>
<h4>{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}</h4> <div class="separation"></div><br />
<legend class="tab" >
{l s='Images'}
<span class="badge" id="countImage">{$countImages}</span>
</legend>
<table cellpadding="5" style="width:100%">
<tr>
<td class="col-left"><label class="file_upload_label">{l s='File:'}</label></td>
<td style="padding-bottom:5px;">
<div id="file-uploader">
<noscript>
<p>{l s='Please enable JavaScript to use file uploader:'}</p>
</noscript>
</div>
<div id="progressBarImage" class="progressBarImage"></div>
<div id="showCounter" style="display:none;"><span id="imageUpload">0</span><span id="imageTotal">0</span></div>
<p class="preference_description" style="clear: both;">
{l s='Format:'} JPG, GIF, PNG. {l s='Filesize:'} {$max_image_size|string_format:"%.2f"} {l s='MB max.'}
</p>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<input type="hidden" name="resizer" value="auto" />
{if Tools::getValue('id_image')}<input type="hidden" name="id_image" value="{Tools::getValue('id_image')|intval}" />{/if}
</td>
</tr>
<tr><td colspan="2" style="padding-bottom:10px;"><div class="separation"></div></td></tr>
<tr>
<td colspan="2">
<table cellspacing="0" cellpadding="0" class="table tableDnD" id="imageTable">
<div class="row">
<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 image'}{else}{l s='Add a new image to this product'}{/if}
</span>
</label>
<div class="col-lg-5">
{l s='File:'}
<div id="file-uploader">
<noscript>
<p>{l s='Please enable JavaScript to use file uploader:'}</p>
</noscript>
</div>
<div id="progressBarImage" class="progressBarImage"></div>
<div id="showCounter" style="display:none;">
<span id="imageUpload">0</span><span id="imageTotal">0</span>
</div>
<input type="hidden" name="resizer" value="auto" />
{if Tools::getValue('id_image')}
<input type="hidden" name="id_image" value="{Tools::getValue('id_image')|intval}" />
{/if}
</div>
</div>
<table class="table tableDnD" id="imageTable">
<thead>
<tr class="nodrag nodrop">
<th style="width: 100px;">{l s='Image'}</th>
<th>{l s='Image'}</th>
<th>{l s='Position'}</th>
{if $shops}
{foreach from=$shops item=shop}
@@ -70,9 +78,8 @@
<tbody id="imageList">
</tbody>
</table>
</td>
</tr>
</table>
<table id="lineType" style="display:none;">
<tr id="image_id">
@@ -95,8 +102,8 @@
<img class="covered" src="../img/admin/blank.gif" alt="e" /></a>
</td>
<td class="center">
<a href="#" class="delete_product_image" >
<img src="../img/admin/delete.gif" alt="{l s='Delete this image'}" title="{l s='Delete this image'}" />
<a href="#" class="btn btn-default delete_product_image" >
<i class="icon-trash"></i> {l s='Delete this image'}
</a>
</td>
</tr>
@@ -26,19 +26,20 @@
<input type="hidden" name="supplier_loaded" value="1">
{if isset($product->id)}
<input type="hidden" name="submitted_tabs[]" value="Suppliers" />
<h4>{l s='Suppliers of the current product'}</h4>
<div class="separation"></div>
<div class="alert alert-info" style="display:block; position:'auto';">
<p>{l s='This interface allows you to specify the suppliers of the current product and eventually its combinations.'}</p>
<p>{l s='It is also possible to specify supplier references according to previously associated suppliers.'}</p>
<legend>{l s='Suppliers of the current product'}</legend>
<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 />
<p>{l s='When using the advanced stock management tool (see Preferences/Products), the values you define (prices, references) will be used in supply orders.'}</p>
{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>
<p>{l s='Please choose the suppliers associated with this product. Please select a default supplier, as well.'}</p>
<label>{l s='Please choose the suppliers associated with this product. Please select a default supplier, as well.'}</label>
<a class="button bt-icon confirm_leave" href="{$link->getAdminLink('AdminSuppliers')|escape:'htmlall':'UTF-8'}&addsupplier">
<img src="../img/admin/add.gif" alt="{l s='Create a new supplier'}" title="{l s='Create a new supplier'}" /><span>{l s='Create a new supplier'}</span>
</a>
<table cellpadding="5" style="width:100%">
<table class="table">
<tbody>
<tr>
<td valign="top" style="text-align:left;vertical-align:top;">