// Fix bugs in AdminProductsController

This commit is contained in:
lLefevre
2011-12-09 13:37:08 +00:00
parent 8774d945d4
commit 540858527b
18 changed files with 2068 additions and 1813 deletions
+7 -8
View File
@@ -42,7 +42,7 @@
{if count($errors)} {* @todo what is ??? AND $this->_includeContainer *}
<div class="error">
<span style="float:right"><a id="hideError" href=""><img alt="X" src="../img/admin/close.png" /></a></span><img src="../img/admin/error2.png" />
<span style="float:right"><a id="hideError" href=""><img alt="X" src="../img/admin/close.png" /></a></span>
{if count($errors) == 1}
{$errors[0]}
{else}
@@ -78,17 +78,16 @@
<span style="float:right">
<a id="hideWarn" href=""><img alt="X" src="../img/admin/close.png" /></a>
</span>
<img src="../img/admin/warn2.png" />
{if count($warnings) > 1}
{l s='There are'} {count($warnings)} {l s='warnings'}
<span style="margin-left:20px;" id="labelSeeMore">
<a id="linkSeeMore" href="#" style="text-decoration:underline">{l s='Click here to see more'}</a>
<a id="linkHide" href="#" style="text-decoration:underline;display:none">{l s='Hide warning'}</a>
</span>
{else}
{l s='There is'} {count($warnings)} {l s='warning'}
{l s='There is'} {count($warnings)} {l s='warning'} :
{/if}
<span style="margin-left:20px;" id="labelSeeMore">
<a id="linkSeeMore" href="#" style="text-decoration:underline">{l s='Click here to see more'}</a>
<a id="linkHide" href="#" style="text-decoration:underline;display:none">{l s='Hide warning'}</a>
</span>
<ul style="display:none;" id="seeMore">
<ul style="display:{if count($warnings) > 1}none{else}block{/if};" id="seeMore">
{foreach $warnings as $warning}
<li>{$warning}</li>
{/foreach}
@@ -23,27 +23,32 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<h4>{l s='Accounting'}</h4>
<div class="separation"></div>
{if !empty($error)}
<div class="hint" style="display:block">{$error}</div>
{else}
<fieldset>
<legend>{l s='Account number'}</legend>
<div class="hint" style="display:block">
{l s='Configure the account number of the product for each zone, if a field is empty, it will use the default one of the shop set in the Accounting Management tab'}
</div>
<br />
{foreach from=$productAccountNumberList['zones'] key=id_zone item=currentZone}
<label>{$currentZone['name']}</label>
<div class="margin-form">
<input type="text" name="zone_{$id_zone}" value="{$currentZone['account_number']}" />
</div>
{/foreach}
</form>
<div style="text-align:left; font-size:11px;">
<i>{l s='Theses fields are used for the accounting export'}</i>
</div>
<div class="separation"></div>
</fieldset>
{if isset($product->id)}
<h4>{l s='Accounting'}</h4>
<div class="separation"></div>
{if !empty($error)}
<div class="hint" style="display:block">{$error}</div>
{else}
<fieldset>
<legend>{l s='Account number'}</legend>
<div class="hint" style="display:block">
{l s='Configure the account number of the product for each zone, if a field is empty, it will use the default one of the shop set in the Accounting Management tab'}
</div>
<br />
{foreach from=$productAccountNumberList['zones'] key=id_zone item=currentZone}
<label>{$currentZone['name']}</label>
<div class="margin-form">
<input type="text" name="zone_{$id_zone}" value="{$currentZone['account_number']}" />
</div>
{/foreach}
</form>
<div style="text-align:left; font-size:11px;">
<i>{l s='Theses fields are used for the accounting export'}</i>
</div>
<div class="separation"></div>
</fieldset>
{/if}
{/if}
@@ -23,7 +23,9 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if $obj->id}<input type="hidden" name="id_{$table}" value="{$obj->id}" />{/if}
{if isset($obj->id)}
<h4>{l s='Attachment'}</h4>
<div class="separation"></div>
<fieldset>
@@ -56,38 +58,40 @@
</div>
<div class="small"><sup>*</sup> {l s='Required field'}</div>
</fieldset>
<div class="clear">&nbsp;</div>
<table>
<tr>
<td>
<p>{l s='Attachments for this product:'}</p>
<select multiple id="selectAttachment1" name="attachments[]" style="width:300px;height:160px;">
{foreach $attach1 as $attach}
<option value="{$attach.id_attachment}">{$attach.name}</option>
{/foreach}
</select><br /><br />
<a href="#" id="removeAttachment" style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px">
{l s='Remove'} &gt;&gt;
</a>
</td>
<td style="padding-left:20px;">
<p>{l s='Available attachments:'}</p>
<select multiple id="selectAttachment2" style="width:300px;height:160px;">
{foreach $attach2 as $attach}
<option value="{$attach.id_attachment}">{$attach.name}</option>
{/foreach}
</select><br /><br />
<a href="#" id="addAttachment" style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px">
&lt;&lt; {l s='Add'}
</a>
</div>
</td>
</tr>
</table>
<div class="clear">&nbsp;</div>
<input type="submit" name="submitAttachments" id="submitAttachments" value="{l s='Update attachments'}" class="button" />
<div class="clear">&nbsp;</div>
<table>
<tr>
<td>
<p>{l s='Attachments for this product:'}</p>
<select multiple id="selectAttachment1" name="attachments[]" style="width:300px;height:160px;">
{foreach $attach1 as $attach}
<option value="{$attach.id_attachment}">{$attach.name}</option>
{/foreach}
</select><br /><br />
<a href="#" id="removeAttachment" style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px">
{l s='Remove'} &gt;&gt;
</a>
</td>
<td style="padding-left:20px;">
<p>{l s='Available attachments:'}</p>
<select multiple id="selectAttachment2" style="width:300px;height:160px;">
{foreach $attach2 as $attach}
<option value="{$attach.id_attachment}">{$attach.name}</option>
{/foreach}
</select><br /><br />
<a href="#" id="addAttachment" style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px">
&lt;&lt; {l s='Add'}
</a>
</div>
</td>
</tr>
</table>
<div class="clear">&nbsp;</div>
<input type="submit" name="submitAttachments" id="submitAttachments" value="{l s='Update attachments'}" class="button" />
<script type="text/javascript">
displayFlags(languages, id_language, allowEmployeeFormLang);
</script>
<script type="text/javascript">
displayFlags(languages, id_language, allowEmployeeFormLang);
</script>
{/if}
@@ -24,26 +24,15 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<script type="text/javascript">
$(document).ready(function(){
$('#id_mvt_reason').change(function(){
{if isset($product->id)}
<script type="text/javascript">
$(document).ready(function(){
$('#id_mvt_reason').change(function(){
updateMvtStatus($(this).val());
});
updateMvtStatus($(this).val());
});
updateMvtStatus($(this).val());
if ( $("input[name=is_virtual_file]:checked").val() == 1)
{
$("#virtual_good_attributes").show();
$("#is_virtual_file_product").show();
}
else
{
$("#virtual_good_attributes").hide();
$("#is_virtual_file_product").hide();
}
$("input[name=is_virtual_file]").live("change", function() {
if($(this).val() == "1")
if ( $("input[name=is_virtual_file]:checked").val() == 1)
{
$("#virtual_good_attributes").show();
$("#is_virtual_file_product").show();
@@ -53,283 +42,296 @@
$("#virtual_good_attributes").hide();
$("#is_virtual_file_product").hide();
}
$("input[name=is_virtual_file]").live("change", function() {
if($(this).val() == "1")
{
$("#virtual_good_attributes").show();
$("#is_virtual_file_product").show();
}
else
{
$("#virtual_good_attributes").hide();
$("#is_virtual_file_product").hide();
}
});
});
});
</script>
<script type="text/javascript">
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}"
</script>
<script type="text/javascript">
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}
);
{/foreach}
);
{/foreach}
</script>
<h4>{l s='Add or modify combinations for this product'}</h4>
<div class="separation"></div> {l s='or go to'}
&nbsp;<a class="button bt-icon" href="index.php?tab=AdminAttributeGenerator&id_product={$product->id}&attributegenerator&token={$token_generator}" onclick="return confirm('{l s='Are you sure you want to delete entered product information?'}');"><img src="../img/admin/appearance.gif" alt="combinations_generator" class="middle" title="{l s='Product combinations generator'}" /><span>{l s='Product combinations generator'}</span></a>
<div class="separation"></div>
<div id="add_new_combination" style="display: none;">
<table cellpadding="5" style="width:100%">
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
{l s='Group:'}
</td>
<td style="padding-bottom:5px;">
<select name="attribute_group" id="attribute_group" style="width: 200px;" 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|htmlentitiesUTF8}&nbsp;&nbsp;</option>
{/foreach}
{/if}
</select>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
{l s='Attribute:'}
</td>
<td style="padding-bottom:5px;">
<select name="attribute" id="attribute" style="width: 200px;">
<option value="0">---</option>
</select>
<script type="text/javascript">
$(document).ready(function(){
populate_attrs();
});
</script>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
<input style="width: 140px; margin-bottom: 10px;" type="button" value="{l s='Add'}" class="button" onclick="add_attr();"/><br />
<input style="width: 140px;" type="button" value="{l s='Delete'}" class="button" onclick="del_attr()"/></td>
<td align="left">
<select id="product_att_list" name="attribute_combinaison_list[]" multiple="multiple" size="4" style="width: 320px;"></select>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Reference:'}</td>
<td style="padding-bottom:5px;">
<input size="55" type="text" id="attribute_reference" name="attribute_reference" value="" style="width: 130px; margin-right: 44px;" />
{l s='EAN13:'}<input size="55" maxlength="13" type="text" id="attribute_ean13" name="attribute_ean13" value="" style="width: 110px; margin-left: 10px; margin-right: 44px;" />
{l s='UPC:'}<input size="55" maxlength="12" type="text" id="attribute_upc" name="attribute_upc" value="" style="width: 110px; margin-left: 10px; margin-right: 44px;" />
<span class="hint" name="help_box">{l s='Special characters allowed:'} .-_#<span class="hint-pointer">&nbsp;</span></span>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
</table>
<table cellpadding="5" id="virtual_good_attributes" style="width:100%;display:none;">
<tr>
<td colspan="2">
<div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #E0D0B1">
<p>{l s='Your server\'s maximum upload file size is'}:&nbsp;{$upload_max_filesize}</p>
<label id="virtual_product_file_attribute_label" for="virtual_product_file_attribute" class="t">{l s='Upload a file'}</label>
<p><input id="virtual_product_file_attribute" name="virtual_product_file_attribute" onchange="uploadFile2();" maxlength="'.$this->maxFileSize.'" type="file"></p>
<div id="upload-confirmation2">
<p id="gethtmlink" style="display: none;">{l s='This is the link'} :&nbsp;{$product->productDownload->getHtmlLink(false, true)}
<a id="make_downloadable_product_attribute" onclick="return confirm('{l s='Delete this file' slashes=1 js=1}')" href="index.php?tab=AdminProducts&id_product={$product->productDownload->id_product}&id_category={$id_category}&token={$token}&deleteVirtualProductAttribute=true" class="red">{l s='Delete this file'}</a>
</p>
</div>
<a id="delete_downloadable_product_attribute" style="display:none;" onclick="return confirm('{l s='Delete this file' slashes=1 js=1}')" href="index.php?tab=AdminProducts&id_product={$product->id}&id_category={$id_category}&token={$token}&deleteVirtualProductAttribute=true" class="red">{l s='Delete this file'}</a>
{if $up_filename}
<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="{$up_filename}" />
{/if}
<p class="block">
<label for="virtual_product_name" class="t">{l s='Filename'}</label>
<input id="virtual_product_name_attribute" name="virtual_product_name_attribute" style="width:200px" value="" type="text">
<span class="hint" name="help_box" style="display:none;">{l s='The full filename with its extension (e.g., Book.pdf)'}</span>
</p>
</div>
<div id="virtual_good_more_attribute" style="padding:5px;width:40%;float:left;margin-left:10px">
<p class="block">
<label for="virtual_product_nb_downloable" class="t">{l s='Number of downloads'}</label>
<input type="text" id="virtual_product_nb_downloable_attribute" name="virtual_product_nb_downloable_attribute" value="" class="" size="6" />
<span class="hint" name="help_box" style="display:none">{l s='Number of authorized downloads per customer'}</span>
</p>
<p class="block">
<label for="virtual_product_expiration_date_attribute" class="t">{l s='Expiration date'}</label>
<input type="text" id="virtual_product_expiration_date_attribute" name="virtual_product_expiration_date_attribute" value="" size="11" maxlength="10" autocomplete="off" /> {l s='Format: YYYY-MM-DD'}
<span class="hint" name="help_box" style="display:none">{l s='No expiration date if you leave this blank'}</span>
</p>
<p class="block">
<label for="virtual_product_nb_days" class="t">{l s='Number of days'}</label>
<input type="text" id="virtual_product_nb_days_attribute" name="virtual_product_nb_days_attribute" value="" class="" size="4" /><sup> *</sup>
<span class="hint" name="help_box" style="display:none">{l s='How many days this file can be accessed by customers'} - <em>({l s='set to zero for unlimited access'} ) </em></span>
</p>
<p class="block">
<label for="virtual_product_is_shareable_attribute" class="t">{l s='is shareable'}</label>
<input type="checkbox" id="virtual_product_is_shareable_attribute" name="virtual_product_is_shareable" value="1" />
<span class="hint" name="help_box" style="display:none">{l s='Specify if the file can be shared'}</span>
</p>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
</table>
<table>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">
{l s='Wholesale price:'}
</td>
<td style="padding-bottom:5px;">
{if $currency->format % 2 != 0}{$currency->sign}{/if}
<input type="text" size="6" name="attribute_wholesale_price" id="attribute_wholesale_price" 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 Wholesale price on Information tab'})
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on price:'}</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_price_impact" id="attribute_price_impact" style="width: 140px;" 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>
<span id="span_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;{if $currency->format % 2 != 0}{$currency->sign} {/if}
<input type="text" size="6" name="attribute_price" id="attribute_price" value="0.00" onKeyUp="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}
</span>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on weight:'}</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_weight_impact" id="attribute_weight_impact" style="width: 140px;" 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>
<span id="span_weight_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;
<input type="text" size="6" name="attribute_weight" id="attribute_weight" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
{$ps_weight_unit}
</span>
</td>
</tr>
<tr id="tr_unit_impact">
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on unit price :'}</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_unit_impact" id="attribute_unit_impact" style="width: 140px;" 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>
<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>
</td>
</tr>
{if $ps_use_ecotax}
</script>
<h4>{l s='Add or modify combinations for this product'}</h4>
<div class="separation"></div> {l s='or go to'}
&nbsp;<a class="button bt-icon" href="index.php?tab=AdminAttributeGenerator&id_product={$product->id}&attributegenerator&token={$token_generator}" onclick="return confirm('{l s='Are you sure you want to delete entered product information?'}');"><img src="../img/admin/appearance.gif" alt="combinations_generator" class="middle" title="{l s='Product combinations generator'}" /><span>{l s='Product combinations generator'}</span></a>
<div class="separation"></div>
<div id="add_new_combination" style="display: none;">
<table cellpadding="5" style="width:100%">
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">
{l s='Eco-tax:'}
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
{l s='Group:'}
</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 on Information tab'})
<td style="padding-bottom:5px;">
<select name="attribute_group" id="attribute_group" style="width: 200px;" 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|htmlentitiesUTF8}&nbsp;&nbsp;</option>
{/foreach}
{/if}
</select>
</td>
</tr>
{/if}
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" class="col-left">
<label>{l s='Minimum quantity:'}</label>
</td>
<td style="padding-bottom:5px;">
<input size="3" maxlength="6" name="minimal_quantity" id="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" style="width:150px">
<label>{l s='Available date:'}</label>
</td>
<td style="padding-bottom:5px;">
<input class="datepicker" id="available_date" name="available_date" 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">
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
{l s='Attribute:'}
</td>
<td style="padding-bottom:5px;">
<select name="attribute" id="attribute" style="width: 200px;">
<option value="0">---</option>
</select>
<script type="text/javascript">
$(document).ready(function(){
$(".datepicker").datepicker({
prevText: '',
nextText: ''
});
populate_attrs();
});
</script>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
<tr>
<td style="width:150px">{l s='Image:'}</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.jpg" alt="{$image.legend|htmlentitiesUTF8}" title="{$image.legend|htmlentitiesUTF8}" />
</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">{l s='Default:'}<br /><br /></td>
<td style="padding-bottom:5px;">
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" />
&nbsp;{l s='Make this the default combination for this product'}<br /><br />
</td>
</tr>
<tr>
<td style="width:150px">&nbsp;</td>
<td style="padding-bottom:5px;">
<span style="float: left;">
<input type="submit" name="submitProductAttribute" id="submitProductAttribute" value="{l s='Add this combination'}" class="button" onclick="attr_selectall(); this.form.action += '&addproduct&tabs=3';" add="{l s='Add this combination'}" update="{l s='Update this combination'}" />
</span>
<span id="ResetSpan" style="float: left; margin-left: 8px; display: none;">
<input type="reset" name="ResetBtn" id="ResetBtn" onclick="init_elems(); getE('submitProductAttribute').value ='{l s='Add this attributes group'}';getE('id_product_attribute').value = 0; $('#ResetSpan').slideToggle();" class="button" value="{l s='Cancel modification'}" />
</span>
<span class="clear"></span>
</td>
</tr>
</table>
</div>
{$list}
</script>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
<input style="width: 140px; margin-bottom: 10px;" type="button" value="{l s='Add'}" class="button" onclick="add_attr();"/><br />
<input style="width: 140px;" type="button" value="{l s='Delete'}" class="button" onclick="del_attr()"/></td>
<td align="left">
<select id="product_att_list" name="attribute_combinaison_list[]" multiple="multiple" size="4" style="width: 320px;"></select>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Reference:'}</td>
<td style="padding-bottom:5px;">
<input size="55" type="text" id="attribute_reference" name="attribute_reference" value="" style="width: 130px; margin-right: 44px;" />
{l s='EAN13:'}<input size="55" maxlength="13" type="text" id="attribute_ean13" name="attribute_ean13" value="" style="width: 110px; margin-left: 10px; margin-right: 44px;" />
{l s='UPC:'}<input size="55" maxlength="12" type="text" id="attribute_upc" name="attribute_upc" value="" style="width: 110px; margin-left: 10px; margin-right: 44px;" />
<span class="hint" name="help_box">{l s='Special characters allowed:'} .-_#<span class="hint-pointer">&nbsp;</span></span>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
</table>
<table cellpadding="5" id="virtual_good_attributes" style="width:100%;display:none;">
<tr>
<td colspan="2">
<div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #E0D0B1">
<p>{l s='Your server\'s maximum upload file size is'}:&nbsp;{$upload_max_filesize}</p>
<label id="virtual_product_file_attribute_label" for="virtual_product_file_attribute" class="t">{l s='Upload a file'}</label>
<p><input id="virtual_product_file_attribute" name="virtual_product_file_attribute" onchange="uploadFile2();" maxlength="'.$this->maxFileSize.'" type="file"></p>
<div id="upload-confirmation2">
<p id="gethtmlink" style="display: none;">{l s='This is the link'} :&nbsp;{$product->productDownload->getHtmlLink(false, true)}
<a id="make_downloadable_product_attribute" onclick="return confirm('{l s='Delete this file' slashes=1 js=1}')" href="index.php?tab=AdminProducts&id_product={$product->productDownload->id_product}&id_category={$id_category}&token={$token}&deleteVirtualProductAttribute=true" class="red">{l s='Delete this file'}</a>
</p>
</div>
<a id="delete_downloadable_product_attribute" style="display:none;" onclick="return confirm('{l s='Delete this file' slashes=1 js=1}')" href="index.php?tab=AdminProducts&id_product={$product->id}&id_category={$id_category}&token={$token}&deleteVirtualProductAttribute=true" class="red">{l s='Delete this file'}</a>
{if $up_filename}
<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="{$up_filename}" />
{/if}
<p class="block">
<label for="virtual_product_name" class="t">{l s='Filename'}</label>
<input id="virtual_product_name_attribute" name="virtual_product_name_attribute" style="width:200px" value="" type="text">
<span class="hint" name="help_box" style="display:none;">{l s='The full filename with its extension (e.g., Book.pdf)'}</span>
</p>
</div>
<div id="virtual_good_more_attribute" style="padding:5px;width:40%;float:left;margin-left:10px">
<p class="block">
<label for="virtual_product_nb_downloable" class="t">{l s='Number of downloads'}</label>
<input type="text" id="virtual_product_nb_downloable_attribute" name="virtual_product_nb_downloable_attribute" value="" class="" size="6" />
<span class="hint" name="help_box" style="display:none">{l s='Number of authorized downloads per customer'}</span>
</p>
<p class="block">
<label for="virtual_product_expiration_date_attribute" class="t">{l s='Expiration date'}</label>
<input type="text" id="virtual_product_expiration_date_attribute" name="virtual_product_expiration_date_attribute" value="" size="11" maxlength="10" autocomplete="off" /> {l s='Format: YYYY-MM-DD'}
<span class="hint" name="help_box" style="display:none">{l s='No expiration date if you leave this blank'}</span>
</p>
<p class="block">
<label for="virtual_product_nb_days" class="t">{l s='Number of days'}</label>
<input type="text" id="virtual_product_nb_days_attribute" name="virtual_product_nb_days_attribute" value="" class="" size="4" /><sup> *</sup>
<span class="hint" name="help_box" style="display:none">{l s='How many days this file can be accessed by customers'} - <em>({l s='set to zero for unlimited access'} ) </em></span>
</p>
<p class="block">
<label for="virtual_product_is_shareable_attribute" class="t">{l s='is shareable'}</label>
<input type="checkbox" id="virtual_product_is_shareable_attribute" name="virtual_product_is_shareable" value="1" />
<span class="hint" name="help_box" style="display:none">{l s='Specify if the file can be shared'}</span>
</p>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
</table>
<table>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">
{l s='Wholesale price:'}
</td>
<td style="padding-bottom:5px;">
{if $currency->format % 2 != 0}{$currency->sign}{/if}
<input type="text" size="6" name="attribute_wholesale_price" id="attribute_wholesale_price" 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 Wholesale price on Information tab'})
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on price:'}</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_price_impact" id="attribute_price_impact" style="width: 140px;" 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>
<span id="span_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;{if $currency->format % 2 != 0}{$currency->sign} {/if}
<input type="text" size="6" name="attribute_price" id="attribute_price" value="0.00" onKeyUp="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}
</span>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on weight:'}</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_weight_impact" id="attribute_weight_impact" style="width: 140px;" 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>
<span id="span_weight_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;
<input type="text" size="6" name="attribute_weight" id="attribute_weight" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
{$ps_weight_unit}
</span>
</td>
</tr>
<tr id="tr_unit_impact">
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on unit price :'}</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_unit_impact" id="attribute_unit_impact" style="width: 140px;" 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>
<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>
</td>
</tr>
{if $ps_use_ecotax}
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">
{l s='Eco-tax:'}
</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 on 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">
<label>{l s='Minimum quantity:'}</label>
</td>
<td style="padding-bottom:5px;">
<input size="3" maxlength="6" name="minimal_quantity" id="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" style="width:150px">
<label>{l s='Available date:'}</label>
</td>
<td style="padding-bottom:5px;">
<input class="datepicker" id="available_date" name="available_date" 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: ''
});
});
</script>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
<tr>
<td style="width:150px">{l s='Image:'}</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.jpg" alt="{$image.legend|htmlentitiesUTF8}" title="{$image.legend|htmlentitiesUTF8}" />
</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">{l s='Default:'}<br /><br /></td>
<td style="padding-bottom:5px;">
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" />
&nbsp;{l s='Make this the default combination for this product'}<br /><br />
</td>
</tr>
<tr>
<td style="width:150px">&nbsp;</td>
<td style="padding-bottom:5px;">
<span style="float: left;">
<input type="submit" name="submitProductAttribute" id="submitProductAttribute" value="{l s='Add this combination'}" class="button" onclick="attr_selectall(); this.form.action += '&addproduct&tabs=3';" add="{l s='Add this combination'}" update="{l s='Update this combination'}" />
</span>
<span id="ResetSpan" style="float: left; margin-left: 8px; display: none;">
<input type="reset" name="ResetBtn" id="ResetBtn" onclick="init_elems(); getE('submitProductAttribute').value ='{l s='Add this attributes group'}';getE('id_product_attribute').value = 0; $('#ResetSpan').slideToggle();" class="button" value="{l s='Cancel modification'}" />
</span>
<span class="clear"></span>
</td>
</tr>
</table>
</div>
{$list}
{/if}
@@ -23,56 +23,58 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<h4>{l s='Add or modify customizable properties'}</h4>
<div class="separation"></div><br />
<table cellpadding="5" style="width:100%">
<tr>
<td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">{l s='File fields:'}</td>
<td style="padding-bottom:5px;">
<input type="text" name="uploadable_files" id="uploadable_files" size="4" value="{$uploadable_files}" />
<p class="preference_description">{l s='Number of upload file fields displayed'}</p>
</td>
</tr>
<tr>
<td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">{l s='Text fields:'}</td>
<td style="padding-bottom:5px;">
<input type="text" name="text_fields" id="text_fields" size="4" value="{$text_fields}" />
<p class="preference_description">{l s='Number of text fields displayed'}</p>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<input type="submit" name="submitCustomizationConfiguration" value="{l s='Update settings'}" class="button" onclick="this.form.action += '&addproduct&tabs=5';" />
</td>
</tr>
{if $has_file_labels}
{if isset($obj->id)}
<h4>{l s='Add or modify customizable properties'}</h4>
<div class="separation"></div><br />
<table cellpadding="5" style="width:100%">
<tr>
<td colspan="2"><div class="separation"></div></td>
</tr>
<tr>
<td style="width:150px" valign="top">{l s='Files fields:'}</td>
<td>
{$display_file_labels}
<td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">{l s='File fields:'}</td>
<td style="padding-bottom:5px;">
<input type="text" name="uploadable_files" id="uploadable_files" size="4" value="{$uploadable_files}" />
<p class="preference_description">{l s='Number of upload file fields displayed'}</p>
</td>
</tr>
{/if}
{if $has_text_labels}
<tr>
<td colspan="2"><div class="separation"></div></td>
</tr>
<tr>
<td style="width:150px" valign="top">{l s='Text fields:'}</td>
<td>
{$display_text_labels}
<td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">{l s='Text fields:'}</td>
<td style="padding-bottom:5px;">
<input type="text" name="text_fields" id="text_fields" size="4" value="{$text_fields}" />
<p class="preference_description">{l s='Number of text fields displayed'}</p>
</td>
</tr>
{/if}
<tr>
<td colspan="2" style="text-align:center;">
{if $has_file_labels || $has_text_labels}
<input type="submit" name="submitProductCustomization" id="submitProductCustomization" value="{l s='Save labels'}" class="button" onclick="this.form.action += '&addproduct&tabs=5';" style="margin-top: 9px" />
{/if}
</td>
</tr>
</table>
<tr>
<td colspan="2" style="text-align:center;">
<input type="submit" name="submitCustomizationConfiguration" value="{l s='Update settings'}" class="button" onclick="this.form.action += '&addproduct&tabs=5';" />
</td>
</tr>
{if $has_file_labels}
<tr>
<td colspan="2"><div class="separation"></div></td>
</tr>
<tr>
<td style="width:150px" valign="top">{l s='Files fields:'}</td>
<td>
{$display_file_labels}
</td>
</tr>
{/if}
{if $has_text_labels}
<tr>
<td colspan="2"><div class="separation"></div></td>
</tr>
<tr>
<td style="width:150px" valign="top">{l s='Text fields:'}</td>
<td>
{$display_text_labels}
</td>
</tr>
{/if}
<tr>
<td colspan="2" style="text-align:center;">
{if $has_file_labels || $has_text_labels}
<input type="submit" name="submitProductCustomization" id="submitProductCustomization" value="{l s='Save labels'}" class="button" onclick="this.form.action += '&addproduct&tabs=5';" style="margin-top: 9px" />
{/if}
</td>
</tr>
</table>
{/if}
+92 -62
View File
@@ -1,66 +1,96 @@
<h4>{l s='Assign features to this product:'}</h4>
<div class="separation"></div>
<ul>
<li>{l s='You can specify a value for each relevant feature regarding this product, empty fields will not be displayed.'}</li>
<li>{l s='You can either set a specific value, or select among existing pre-defined values you added previously.'}</li>
</ul>
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision$
* @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)}
<h4>{l s='Assign features to this product:'}</h4>
<div class="separation"></div>
<ul>
<li>{l s='You can specify a value for each relevant feature regarding this product, empty fields will not be displayed.'}</li>
<li>{l s='You can either set a specific value, or select among existing pre-defined values you added previously.'}</li>
</ul>
</td>
</tr>
</table>
<br />
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:900px;">
<tr>
<th>{l s='Feature'}</td>
<th style="width:30%">{l s='Pre-defined value'}</td>
<th style="width:40%"><u>{l s='or'}</u> {l s='Customized value'}</td>
</tr>
</table>
{foreach from=$available_features item=available_feature}
<table cellpadding="5" style="width: 900px; margin-top: 10px">
<tr>
<td>{$available_feature.name}</td>
<td style="width: 30%">
{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">---&nbsp;</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}&nbsp;
</option>
{/foreach}
</select>
{else}
<input type="hidden" name="feature_{$available_feature.id_feature}_value" value="0" />
<span style="font-size: 10px; color: #666;">{l s='N/A'} -
<a href="{$link->getAdminLink('AdminFeatures')}&amp;addfeature_value&id_feature={$available_feature.id_feature}"
style="color: #666; text-decoration: underline;">{l s='Add pre-defined values first'}</a>
</span>
{/if}
</td>
<td style="width:40%" class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if $language.id_lang != $default_form_language}display:none;{/if}float: left;">
<textarea class="custom_{$available_feature.id_feature}_" 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|htmlentitiesUTF8|default:""}</textarea>
</div>
{/foreach}
</td>
</tr>
</table>
<br />
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:900px;">
<tr>
<th>{l s='Feature'}</td>
<th style="width:30%">{l s='Pre-defined value'}</td>
<th style="width:40%"><u>{l s='or'}</u> {l s='Customized value'}</td>
</tr>
</table>
{foreach from=$available_features item=available_feature}
<table cellpadding="5" style="width: 900px; margin-top: 10px">
<tr>
<td>{$available_feature.name}</td>
<td style="width: 30%">
{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">---&nbsp;</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}&nbsp;
</option>
{/foreach}
</select>
{else}
<input type="hidden" name="feature_{$available_feature.id_feature}_value" value="0" />
<span style="font-size: 10px; color: #666;">{l s='N/A'} -
<a href="{$link->getAdminLink('AdminFeatures')}&amp;addfeature_value&id_feature={$available_feature.id_feature}"
style="color: #666; text-decoration: underline;">{l s='Add pre-defined values first'}</a>
</span>
{/if}
</td>
<td style="width:40%" class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if $language.id_lang != $default_form_language}display:none;{/if}float: left;">
<textarea class="custom_{$available_feature.id_feature}_" 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|htmlentitiesUTF8|default:""}</textarea>
</div>
{foreachelse}
<tr><td colspan="3" style="text-align:center;">{l s='No features defined'}</td></tr>
{/foreach}
</td>
</tr>
</table>
<div class="separation"></div>
<div style="text-align:center;">
<a href="{$link->getAdminLink('AdminFeatures')}&amp;addfeature" onclick="return confirm('{l s='You will lose all modifications not saved, you may want to save modifications first?' js=1}');">
<img src="../img/admin/add.gif" alt="new_features" title="{l s='Add a new feature'}" />&nbsp;{l s='Add a new feature'}
</a>
</div>
<script type="text/javascript">
displayFlags(languages, id_language, allowEmployeeFormLang);
</script>
{foreachelse}
<tr><td colspan="3" style="text-align:center;">{l s='No features defined'}</td></tr>
{/foreach}
</table>
<div class="separation"></div>
<div style="text-align:center;">
<a href="{$link->getAdminLink('AdminFeatures')}&amp;addfeature" onclick="return confirm('{l s='You will lose all modifications not saved, you may want to save modifications first?' js=1}');">
<img src="../img/admin/add.gif" alt="new_features" title="{l s='Add a new feature'}" />&nbsp;{l s='Add a new feature'}
</a>
</div>
<script type="text/javascript">
displayFlags(languages, id_language, allowEmployeeFormLang);
</script>
{/if}
+225 -260
View File
@@ -27,279 +27,244 @@
{extends file="helper/form/form.tpl"}
{block name="defaultForm"}
<div>
<div class="productTabs">
<ul class="tab">
{foreach $product_tabs key=numStep item=tab}
<li class="tab-row">
<a class="tab-page {if $tab.selected}selected{/if}" id="link-{$tab.id}" href="{$tab.href}&amp;updateproduct">{$tab.name}</a>{*todo href when nojs*}
</li>
{/foreach}
</ul>
<div>
<div class="productTabs">
<ul class="tab">
{foreach $product_tabs key=numStep item=tab}
<li class="tab-row">
<a class="tab-page {if $tab.selected}selected{/if}" id="link-{$tab.id}" href="{$tab.href}&amp;updateproduct">{$tab.name}</a>{*todo href when nojs*}
</li>
{/foreach}
</ul>
</div>
</div>
</div>
<script type="text/javascript">
function showSaveButtons()
{
$('#desc-product-save').show();
$('#desc-product-cancel').show();
$('#desc-product-duplicate').show();
$('#desc-product-delete').show();
$('#desc-product-save-and-stay').show();
}
function hideSaveButtons()
{
$('#desc-product-save').hide();
$('#desc-product-cancel').hide();
$('#desc-product-duplicate').hide();
$('#desc-product-delete').hide();
$('#desc-product-save-and-stay').hide();
}
var toload = new Array();
var pos_select = {$pos_select};
var tabs_toolbar_save_buttons = [];
{foreach $tabs_toolbar_save_buttons key=key item=value}
{if $value == true}
tabs_toolbar_save_buttons.push('{$key}');
{/if}
{/foreach}
$(document).ready(function(){
$('#desc-product-newCombination').hide();
{* submenu binding *}
$(".tab-page").click(function(e){
e.preventDefault();
// currentId is the current producttab id
currentId = $(".productTabs a.selected").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);
$("#product_form_submit_btn").attr('name', 'submit'+btn_name);
// Show/hide save buttons
if (jQuery.inArray(btn_name, tabs_toolbar_save_buttons) != -1)
showSaveButtons();
else
hideSaveButtons();
if ($(this).attr("id") != $(".productTabs a.selected").attr('id'))
{
$(".tab-page").removeClass('selected');
$("#product-tab-content-"+currentId).hide();
}
else
{
if (confirm(' {l s='Do you really want to reload the current tab (all modifications will be lost)'}'))
$("#product-tab-content-"+currentId).html();
else
return false;
}
$("#product-tab-content-wait").show();
if ($("#product-tab-content-"+id).hasClass('not-loaded') || $(this).hasClass('selected'))
{
myurl = $(this).attr("href")+"&ajax=1";
$.ajax({
url : myurl,
async : true,
success :function(data)
<script type="text/javascript">
var toload = new Array();
var pos_select = {$pos_select};
$(document).ready(function(){
$('#desc-product-newCombination').hide();
{* submenu binding *}
$(".tab-page").click(function(e){
e.preventDefault();
// currentId is the current product tab id
currentId = $(".productTabs a.selected").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);
$("#product_form_submit_btn").attr('name', 'submit'+btn_name);
if ($(this).attr("id") != $(".productTabs a.selected").attr('id'))
{
$(".tab-page").removeClass('selected');
$("#product-tab-content-"+currentId).hide();
}
else
{
if (confirm(' {l s='Do you really want to reload the current tab (all modifications will be lost)'}'))
$("#product-tab-content-"+currentId).html();
else
return false;
}
$("#product-tab-content-wait").show();
if ($("#product-tab-content-"+id).hasClass('not-loaded') || $(this).hasClass('selected'))
{
myurl = $(this).attr("href")+"&ajax=1";
$.ajax({
url : myurl,
async : true,
success :function(data)
{
$("#product-tab-content-"+id).html(data);
$("#product-tab-content-"+id).removeClass('not-loaded');
$("#product-tab-content-"+id).show();
$("#link-"+id).addClass('selected');
}
});
}
else
{
$("#product-tab-content-"+id).html(data);
$("#product-tab-content-"+id).removeClass('not-loaded');
$("#product-tab-content-"+id).show();
$("#link-"+id).addClass('selected');
}
});
}
else
{
$("#product-tab-content-"+id).show();
$("#link-"+id).addClass('selected');
}
$("#product-tab-content-wait").hide();
var languages = new Array();
if (btn_name == "Combinations")
{
$('#desc-product-new').hide();
$('#desc-product-newCombination').show();
populate_attrs();
}
else if (btn_name == 'Attachments')
{
$("#addAttachment").live('click', function() {
return !$("#selectAttachment2 option:selected").remove().appendTo("#selectAttachment1");
});
$("#removeAttachment").live('click', function() {
return !$("#selectAttachment1 option:selected").remove().appendTo("#selectAttachment2");
});
$("#product").submit(function() {
$("#selectAttachment1 option").each(function(i) {
$(this).attr("selected", "selected");
});
});
}
else
$('#desc-product-newCombination').hide();
});
{if $show_product_tab_content}
$("div.productTabs a[id$=-{$show_product_tab_content}]").click();
{/if}
});
</script>
{***********************************************}
{********** TO CHECK !!!!!!!!!!!!!!! ***********}
<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>
<script type="text/javascript">
//<![CDATA[
function toggleVirtualProduct(elt)
{
$("#is_virtual_file_product").hide();
$("#virtual_good_attributes").hide();
if (elt.checked)
{
$('#virtual_good').show('slow');
$('#virtual_good_more').show('slow');
getE('out_of_stock_1').checked = 'checked';
getE('out_of_stock_2').disabled = 'disabled';
getE('out_of_stock_3').disabled = 'disabled';
getE('label_out_of_stock_2').setAttribute('for', '');
getE('label_out_of_stock_3').setAttribute('for', '');
}
else
{
$('#virtual_good').hide('slow');
$('#virtual_good_more').hide('slow');
getE('out_of_stock_2').disabled = false;
getE('out_of_stock_3').disabled = false;
getE('label_out_of_stock_2').setAttribute('for', 'out_of_stock_2');
getE('label_out_of_stock_3').setAttribute('for', 'out_of_stock_3');
}
}
function uploadFile()
{
$.ajaxFileUpload (
{
url:'./uploadProductFile.php',
secureuri:false,
fileElementId:'virtual_product_file',
dataType: 'xml',
success: function (data, status)
$("#product-tab-content-wait").hide();
var languages = new Array();
if (btn_name == "Combinations")
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename")
if(result == "error")
$("#upload-confirmation").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product').show();
$('#virtual_product_name').attr('value', fileName);
$('#upload-confirmation').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
}
$('#desc-product-new').hide();
$('#desc-product-newCombination').show();
populate_attrs();
}
else if (btn_name == 'Attachments')
{
$("#addAttachment").live('click', function() {
return !$("#selectAttachment2 option:selected").remove().appendTo("#selectAttachment1");
});
$("#removeAttachment").live('click', function() {
return !$("#selectAttachment1 option:selected").remove().appendTo("#selectAttachment2");
});
$("#product").submit(function() {
$("#selectAttachment1 option").each(function(i) {
$(this).attr("selected", "selected");
});
});
}
else
$('#desc-product-newCombination').hide();
});
{if $show_product_tab_content}
$("div.productTabs a[id$=-{$show_product_tab_content}]").click();
{/if}
});
</script>
{***********************************************}
{********** TO CHECK !!!!!!!!!!!!!!! ***********}
<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>
<script type="text/javascript">
//<![CDATA[
function toggleVirtualProduct(elt)
{
$("#is_virtual_file_product").hide();
$("#virtual_good_attributes").hide();
if (elt.checked)
{
$('#virtual_good').show('slow');
$('#virtual_good_more').show('slow');
getE('out_of_stock_1').checked = 'checked';
getE('out_of_stock_2').disabled = 'disabled';
getE('out_of_stock_3').disabled = 'disabled';
getE('label_out_of_stock_2').setAttribute('for', '');
getE('label_out_of_stock_3').setAttribute('for', '');
}
);
}
function uploadFile2()
{
var link = '';
else
{
$('#virtual_good').hide('slow');
$('#virtual_good_more').hide('slow');
getE('out_of_stock_2').disabled = false;
getE('out_of_stock_3').disabled = false;
getE('label_out_of_stock_2').setAttribute('for', 'out_of_stock_2');
getE('label_out_of_stock_3').setAttribute('for', 'out_of_stock_3');
}
}
function uploadFile()
{
$.ajaxFileUpload (
{
url:'./uploadProductFileAttribute.php',
secureuri:false,
fileElementId:'virtual_product_file_attribute',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename");
if(result == "error")
$("#upload-confirmation2").html('<p>error: ' + msg + '</p>');
else
url:'./uploadProductFile.php',
secureuri:false,
fileElementId:'virtual_product_file',
dataType: 'xml',
success: function (data, status)
{
$('#virtual_product_file_attribute').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product_attribute').show();
$('#upload-confirmation2').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="' + msg + '" />');
$('#virtual_product_name_attribute').attr('value', fileName);
link = $("#delete_downloadable_product_attribute").attr('href');
$("#delete_downloadable_product_attribute").attr('href', link+"&file="+msg);
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename")
if(result == "error")
$("#upload-confirmation").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product').show();
$('#virtual_product_name').attr('value', fileName);
$('#upload-confirmation').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
}
}
}
}
);
}
//]]>
</script>
<form id="product_form" action="{$form_action}" method="post" enctype="multipart/form-data" name="product">
<input type="hidden" name="id_product" value="{$id_product}" />
<input type="hidden" name="tabs" id="tabs" value="0" />
<div class="tab-pane" id="tabPane1">
{if !$product->active}
<div class="warn draft" >
<p>
<span style="float: left">
{l s='Your product will be saved as draft'}</span>
<span style="float:right"><a href="#" class="button" style="display: block" onclick="submitAddProductAndPreview()" >{l s='Save and preview'}</a></span>
<input type="hidden" name="fakeSubmitAddProductAndPreview" id="fakeSubmitAddProductAndPreview" />
<br />
</p>
</div>
{/if}
{* all input are here *}
<div id="product-tab-content-wait" style="display:none" >{l s='loading ...'}</div>
{if !$newproduct}
{foreach $product_tabs key=numStep item=tab}
<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}
);
}
function uploadFile2()
{
var link = '';
$.ajaxFileUpload (
{
url:'./uploadProductFileAttribute.php',
secureuri:false,
fileElementId:'virtual_product_file_attribute',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename");
if(result == "error")
$("#upload-confirmation2").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file_attribute').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product_attribute').show();
$('#upload-confirmation2').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="' + msg + '" />');
$('#virtual_product_name_attribute').attr('value', fileName);
link = $("#delete_downloadable_product_attribute").attr('href');
$("#delete_downloadable_product_attribute").attr('href', link+"&file="+msg);
}
}
}
);
}
//]]>
</script>
<form id="product_form" action="{$form_action}" method="post" enctype="multipart/form-data" name="product">
<input type="hidden" name="id_product" value="{$id_product}" />
<input type="hidden" name="tabs" id="tabs" value="0" />
<div class="tab-pane" id="tabPane1">
{if !$product->active}
<div class="warn draft" >
<p>
<span style="float: left">
{l s='Your product will be saved as draft'}</span>
<span style="float:right"><a href="#" class="button" style="display: block" onclick="submitAddProductAndPreview()" >{l s='Save and preview'}</a></span>
<input type="hidden" name="fakeSubmitAddProductAndPreview" id="fakeSubmitAddProductAndPreview" />
<br />
</p>
</div>
{/if}
{* all input are here *}
<div id="product-tab-content-wait" style="display:none" >{l s='loading ...'}</div>
{foreach $product_tabs key=numStep item=tab}
<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>
{/foreach}
</div>
{/foreach}
{else}
<div id="product-tab-content-1" class="product-tab-content">{$custom_form}</div>
{/if}
</div>
<input type="hidden" name="id_product_attribute" id="id_product_attribute" value="0" />
<input id="product_form_submit_btn" type="submit" value="{l s='Save'}" name="submitAddproduct" class="button" />
</form>
</div>
<br/>
<input type="hidden" name="id_product_attribute" id="id_product_attribute" value="0" />
<input id="product_form_submit_btn" type="submit" value="{l s='Save'}" name="submitAddproduct" class="button" />
</form>
<br/>
{/block}
{*a href="{$link->getAdminLink('AdminCatalog')}"><img src="../img/admin/arrow2.gif" />{l s='Back to list'}</a><br/>
*}
+262 -233
View File
@@ -1,7 +1,34 @@
<div class="tab-page" id="step2">
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision$
* @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)}
<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 />
<table cellpadding="5" style="width:100%">
<table cellpadding="5" style="width:100%">
<tr>
<td class="col-left"><label>{l s='File:'}</label></td>
<td style="padding-bottom:5px;">
@@ -46,253 +73,255 @@
</td>
</tr>
</table>
</div>
<table id="lineType" style="display:none;">
<tr id="image_id">
<td style="padding: 4px;">
<a href="image_path.jpg" target="_blank">
<img src="{$smarty.const._THEME_PROD_DIR_}en-default-small.jpg" alt="image_id" title="image_id" />
</a>
</td>
<td id="td_image_id" class="pointer dragHandle center positionImage">
image_position
</td>
{if $shops}
{foreach from=$shops item=shop}
<td class="center">
<input type="checkbox" class="image_shop" name="id_image" id="{$shop.id_shop}image_id" value="{$shop.id_shop}" />
</td>
{/foreach}
{/if}
<td class="center cover"><a href="#">
<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>
</td>
</tr>
</table>
<script type="text/javascript">
var upbutton = '{l s='Upload a file'}';
var token = '{$token}';
var come_from = '{$table}';
var id_tmp = 0;
{literal}
//Ready Function
$(document).ready(function(){
{/literal}
{foreach from=$images item=image}
assoc = {literal}"{"{/literal};
<table id="lineType" style="display:none;">
<tr id="image_id">
<td style="padding: 4px;">
<a href="image_path.jpg" target="_blank">
<img src="{$smarty.const._THEME_PROD_DIR_}en-default-small.jpg" alt="image_id" title="image_id" />
</a>
</td>
<td id="td_image_id" class="pointer dragHandle center positionImage">
image_position
</td>
{if $shops}
{foreach from=$shops item=shop}
assoc += '"{$shop.id_shop}" : {if $image->isAssociatedToShop($shop.id_shop)}1{else}0{/if},';
<td class="center">
<input type="checkbox" class="image_shop" name="id_image" id="{$shop.id_shop}image_id" value="{$shop.id_shop}" />
</td>
{/foreach}
{/if}
if (assoc != {literal}"{"{/literal})
{
assoc = assoc.slice(0, -1);
assoc += {literal}"}"{/literal};
}
else
assoc = false;
imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}enabled{else}forbbiden{/if}", assoc);
{/foreach}
<td class="center cover"><a href="#">
<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>
</td>
</tr>
</table>
<script type="text/javascript">
var upbutton = '{l s='Upload a file'}';
var token = '{$token}';
var come_from = '{$table}';
var id_tmp = 0;
{literal}
$("#imageTable").tableDnD(
{
onDrop: function(table, row) {
current = $(row).attr("id");
stop = false;
image_up = "{";
$("#imageList").find("tr").each(function(i) {
$("#td_" + $(this).attr("id")).html(i + 1);
if ($(this).attr("id") == current)
{
image_up += '"' + $(this).attr("id") + '" : ' + (i + 1) + ',';
stop = true;
//Ready Function
$(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};
}
else
assoc = false;
imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}enabled{else}forbbiden{/if}", assoc);
{/foreach}
{literal}
$("#imageTable").tableDnD(
{
onDrop: function(table, row) {
current = $(row).attr("id");
stop = false;
image_up = "{";
$("#imageList").find("tr").each(function(i) {
$("#td_" + $(this).attr("id")).html(i + 1);
if ($(this).attr("id") == current)
{
image_up += '"' + $(this).attr("id") + '" : ' + (i + 1) + ',';
stop = true;
}
if (!stop || (i + 1) == 2)
image_up += '"' + $(this).attr("id") + '" : ' + (i + 1) + ',';
});
image_up = image_up.slice(0, -1);
image_up += "}";
updateImagePositon(image_up);
}
if (!stop || (i + 1) == 2)
image_up += '"' + $(this).attr("id") + '" : ' + (i + 1) + ',';
});
image_up = image_up.slice(0, -1);
image_up += "}";
updateImagePositon(image_up);
}
});
var filecheck = 1;
var uploader = new qq.FileUploader(
{
element: document.getElementById("file-uploader"),
action: "ajax-tab.php",
debug: false,
params: {
id_product : {/literal}{$id_product}{literal},
id_category : {/literal}{$id_category_default}{literal},
token : "{/literal}{$token}{literal}",
tab : "AdminProducts",
action : 'addImage',
ajax: 1,
},
onComplete: function(id, fileName, responseJSON)
var filecheck = 1;
var uploader = new qq.FileUploader(
{
var percent = ((filecheck * 100) / nbfile);
$("#progressBarImage").progressbar({value: percent});
if (percent != 100)
element: document.getElementById("file-uploader"),
action: "ajax-tab.php",
debug: false,
params: {
id_product : {/literal}{$id_product}{literal},
id_category : {/literal}{$id_category_default}{literal},
token : "{/literal}{$token}{literal}",
tab : "AdminProducts",
action : 'addImage',
ajax: 1,
},
onComplete: function(id, fileName, responseJSON)
{
$("#imageUpload").html(parseInt(filecheck));
$("#imageTotal").html(" / " + parseInt(nbfile) + " {/literal}{l s='Images'}{literal}");
$("#progressBarImage").show();
$("#showCounter").show();
}
else
var percent = ((filecheck * 100) / nbfile);
$("#progressBarImage").progressbar({value: percent});
if (percent != 100)
{
$("#imageUpload").html(parseInt(filecheck));
$("#imageTotal").html(" / " + parseInt(nbfile) + " {/literal}{l s='Images'}{literal}");
$("#progressBarImage").show();
$("#showCounter").show();
}
else
{
$("#progressBarImage").progressbar({value: 0});
$("#progressBarImage").hide();
$("#showCounter").hide();
nbfile = 0;
filecheck = 0;
}
if (responseJSON.status == 'ok')
{
cover = "forbbiden";
if (responseJSON.cover == "1")
cover = "enabled";
imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, false)
$("#imageTable tr:last").after(responseJSON.html);
$("#countImage").html(parseInt($("#countImage").html()) + 1);
$("#img" + id).remove();
$("#imageTable").tableDnDUpdate();
}
else
{
$("#img" + id).addClass("red");
$("#img" + id + " .errorImg").html(responseJSON.error);
$("#img" + id + " .errorImg").show();
}
filecheck++;
},
onSubmit: function(id, filename)
{
$("#progressBarImage").progressbar({value: 0});
$("#progressBarImage").hide();
$("#showCounter").hide();
nbfile = 0;
filecheck = 0;
$("#imageTable").show();
$("#listImage").append("<li id='img"+id+"'><div class=\"float\" >" + filename + "</div></div><a style=\"margin-left:10px\"href=\"javascript:delQueue(" + id +");\"><img src=\"../img/admin/disabled.gif\" alt=\"\" border=\"0\"></a><p class=\"errorImg\"></p></li>");
}
if (responseJSON.status == 'ok')
{
cover = "forbbiden";
if (responseJSON.cover == "1")
cover = "enabled";
imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, false)
$("#imageTable tr:last").after(responseJSON.html);
$("#countImage").html(parseInt($("#countImage").html()) + 1);
$("#img" + id).remove();
$("#imageTable").tableDnDUpdate();
}
else
{
$("#img" + id).addClass("red");
$("#img" + id + " .errorImg").html(responseJSON.error);
$("#img" + id + " .errorImg").show();
}
filecheck++;
},
onSubmit: function(id, filename)
});
$('.delete_product_image').die().live('click', function(e)
{
$("#imageTable").show();
$("#listImage").append("<li id='img"+id+"'><div class=\"float\" >" + filename + "</div></div><a style=\"margin-left:10px\"href=\"javascript:delQueue(" + id +");\"><img src=\"../img/admin/disabled.gif\" alt=\"\" border=\"0\"></a><p class=\"errorImg\"></p></li>");
}
});
$('.delete_product_image').die().live('click', function(e)
{
e.preventDefault();
id = $(this).parent().parent().attr('id');
if (confirm("{/literal}{l s='Are you sure?'}{literal}"))
$.ajax(
e.preventDefault();
id = $(this).parent().parent().attr('id');
if (confirm("{/literal}{l s='Are you sure?'}{literal}"))
$.ajax(
{
url : "ajax-tab.php",
data : {"action":"deleteProductImage",
"id_image":id,
"id_product" : {/literal}{$id_product}{literal},
"id_category" : {/literal}{$id_category_default}{literal},
"token" : "{/literal}{$token}{literal}",
"tab" : "AdminProducts",
"ajax" : 1 },
success : function (data)
{
data = jQuery.parseJSON(data);
if (data)
{
cover = 0;
if(data.status == 'ok')
{
if ($("#" + id).find(".covered").attr("src") == "../img/admin/enabled.gif")
cover = 1;
$("#" + id).remove();
}
if (cover)
$("#imageTable tr").eq(1).find(".covered").attr("src", "../img/admin/enabled.gif");
$("#countImage").html(parseInt($("#countImage").html()) - 1);
refreshImagePositions($("#imageTable"));
}
}
});
});
$('.covered').die().live('click', function(e)
{
url : "ajax-tab.php",
data : {"action":"deleteProductImage",
e.preventDefault();
id = $(this).parent().parent().parent().attr('id');
$("#imageList .cover img").each( function(i){
$(this).attr("src", $(this).attr("src").replace("enabled", "forbbiden"));
});
$(this).attr("src", $(this).attr("src").replace("forbbiden", "enabled"));
doAdminAjax({
"action":"UpdateCover",
"id_image":id,
"id_product" : {/literal}{$id_product}{literal},
"id_category" : {/literal}{$id_category_default}{literal},
"token" : "{/literal}{$token}{literal}",
"controller" : "AdminProducts",
"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_shop": id_shop,
"active":active,
"token" : "{/literal}{$token}{literal}",
"tab" : "AdminProducts",
"ajax" : 1 },
success : function (data)
{
data = jQuery.parseJSON(data);
if (data)
{
cover = 0;
if(data.status == 'ok')
{
if ($("#" + id).find(".covered").attr("src") == "../img/admin/enabled.gif")
cover = 1;
$("#" + id).remove();
}
if (cover)
$("#imageTable tr").eq(1).find(".covered").attr("src", "../img/admin/enabled.gif");
$("#countImage").html(parseInt($("#countImage").html()) - 1);
refreshImagePositions($("#imageTable"));
}
}
});
});
$('.covered').die().live('click', function(e)
{
e.preventDefault();
id = $(this).parent().parent().parent().attr('id');
$("#imageList .cover img").each( function(i){
$(this).attr("src", $(this).attr("src").replace("enabled", "forbbiden"));
});
$(this).attr("src", $(this).attr("src").replace("forbbiden", "enabled"));
doAdminAjax({
"action":"UpdateCover",
"id_image":id,
"id_product" : {/literal}{$id_product}{literal},
"token" : "{/literal}{$token}{literal}",
"controller" : "AdminProducts",
"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_shop": id_shop,
"active":active,
"token" : "{/literal}{$token}{literal}",
"tab" : "AdminProducts",
"ajax" : 1
});
});
//function
function updateImagePositon(json)
{
doAdminAjax(
{
"action":"updateImagePosition",
"json":json,
"token" : "{/literal}{$token}{literal}",
"tab" : "AdminProducts",
"ajax" : 1
});
}
function delQueue(id)
{
$("#img" + id).fadeOut("slow");
$("#img" + id).remove();
}
function imageLine(id, path, position, cover, shops)
{
line = $("#lineType").html();
line = line.replace(/image_id/g, id);
line = line.replace(/en-default/g, path);
line = line.replace(/image_position/g, position);
line = line.replace(/blank/g, cover);
line = line.replace("<tbody>", "");
line = line.replace("</tbody>", "");
if (shops != false)
{
tmp = jQuery.parseJSON(shops);
$.each(tmp, function(key, value){
if (value == 1)
line = line.replace('id="' + key + '' + id + '"','id="' + key + '' + id + '" checked=checked');
"ajax" : 1
});
});
//function
function updateImagePositon(json)
{
doAdminAjax(
{
"action":"updateImagePosition",
"json":json,
"token" : "{/literal}{$token}{literal}",
"tab" : "AdminProducts",
"ajax" : 1
});
}
$("#imageList").append(line);
}
});
{/literal}
</script>
function delQueue(id)
{
$("#img" + id).fadeOut("slow");
$("#img" + id).remove();
}
function imageLine(id, path, position, cover, shops)
{
line = $("#lineType").html();
line = line.replace(/image_id/g, id);
line = line.replace(/en-default/g, path);
line = line.replace(/image_position/g, position);
line = line.replace(/blank/g, cover);
line = line.replace("<tbody>", "");
line = line.replace("</tbody>", "");
if (shops != false)
{
tmp = jQuery.parseJSON(shops);
$.each(tmp, function(key, value){
if (value == 1)
line = line.replace('id="' + key + '' + id + '"','id="' + key + '' + id + '" checked=checked');
});
}
$("#imageList").append(line);
}
});
{/literal}
</script>
{/if}
@@ -1,3 +1,29 @@
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div id="step1">
<h4 class="tab">1. {l s='Info.'}</h4>
<h4>{l s='Product global information'}</h4>
@@ -1,3 +1,29 @@
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display:none;{/if}float: left;">
+244 -206
View File
@@ -1,66 +1,85 @@
<script type="text/javascript" src="{$smarty.const._PS_JS_DIR_}price.js"></script>
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="block_specific_prices_modifications">
<h4>{l s='Product price'}</h4>
<div class="separation"></div>
<script type="text/javascript">
var product_prices = new Array();
{foreach from=$combinations item='combination'}
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;
<h4>{l s='Product price'}</h4>
<div class="separation"></div>
<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}
{/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}
</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;">
@@ -68,157 +87,174 @@ var product_prices = new Array();
<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>&nbsp;</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" />&nbsp;<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}
<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>&nbsp;</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" />&nbsp;<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>&nbsp;</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;">
<input type="hidden" name="sp_id_shop" value="0" />
<label>{l s='For:'}</label>
<div class="margin-form">
<select name="sp_id_shop">
<option value="0">{l s='All shops'}</option>
{foreach from=$shops item=shop}
<option value="{$shop['id_shop']}">{$shop['name']|htmlentitiesUTF8}</option>
{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>&nbsp;</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>
</table>
<div class="separation"></div>
{if isset($specificPriceModificationForm)}
<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/>
<script type="text/javascript">
var product_prices = new Array();
{foreach from=$combinations item='combination'}
product_prices['{$combination.id_product_attribute}'] = '{$combination.price}';
{/foreach}
</select>
&gt;
<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>
&gt;
<select name="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>
&gt;
<select name="sp_id_group">
<option value="0">{l s='All groups'}</option>
{foreach from=$groups item=group}
<option value="'.(int)($group['id_group']).'">'.{$group['name']}</option>
{/foreach}
</select>
</div>
{if $combinations|@count != 0}
<label>{l s='Combination:'}</label>
<div class="margin-form">
<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>
</script>
<div id="add_specific_price" style="display: none;">
<input type="hidden" name="sp_id_shop" value="0" />
<label>{l s='For:'}</label>
<div class="margin-form">
<select name="sp_id_shop">
<option value="0">{l s='All shops'}</option>
{foreach from=$shops item=shop}
<option value="{$shop['id_shop']}">{$shop['name']|htmlentitiesUTF8}</option>
{/foreach}
</select>
</div>
{/if}
<label>{l s='Available from:'}</label>
<div class="margin-form">
<input class="datepicker" type="text" name="sp_from" value="" style="text-align: center" id="sp_from" /><span style="font-weight:bold; color:#000000; font-size:12px"> {l s='to'}</span>
<input class="datepicker" type="text" name="sp_to" value="" style="text-align: center" id="sp_to" />
</div>
<label>{l s='Starting at'}</label>
<div class="margin-form">
<input type="text" name="sp_from_quantity" value="1" size="3" /> <span style="font-weight:bold; color:#000000; font-size:12px">{l s='unit'}</span>
</div>
<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()]);
</select>
&gt;
<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>
&gt;
<select name="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>
&gt;
<select name="sp_id_group">
<option value="0">{l s='All groups'}</option>
{foreach from=$groups item=group}
<option value="'.(int)($group['id_group']).'">'.{$group['name']}</option>
{/foreach}
</select>
</div>
{if $combinations|@count != 0}
<label>{l s='Combination:'}</label>
<div class="margin-form">
<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>
{/if}
<label>{l s='Available from:'}</label>
<div class="margin-form">
<input class="datepicker" type="text" name="sp_from" value="" style="text-align: center" id="sp_from" /><span style="font-weight:bold; color:#000000; font-size:12px"> {l s='to'}</span>
<input class="datepicker" type="text" name="sp_to" value="" style="text-align: center" id="sp_to" />
</div>
<label>{l s='Starting at'}</label>
<div class="margin-form">
<input type="text" name="sp_from_quantity" value="1" size="3" /> <span style="font-weight:bold; color:#000000; font-size:12px">{l s='unit'}</span>
</div>
<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()]);
});
$('.datepicker').datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
});
$('.datepicker').datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
});
</script>
</script>
<label>{l s='Product price'}
{if $country_display_tax_label}
{l s='(tax excl.):'}
{/if}
</label>
<div class="margin-form">
<span id="spm_currency_sign_pre_0" style="font-weight:bold; color:#000000; font-size:12px">{$currency->prefix}</span>
<input type="text" name="sp_price" value="0" size="11" />
<span id="spm_currency_sign_post_0" style="font-weight:bold; color:#000000; font-size:12px">{$currency->suffix}</span>
<span>({l s='Current:'} </span><span id="sp_current_ht_price">{displayWtPrice p=$product->price}</span> )</span>
<div class="hint" style="display:block;">
{l s='You can set this value at 0 in order to apply the default price'}
</div>
</div>
<label>{l s='Apply a discount of:'}</label>
<div class="margin-form">
<input type="text" name="sp_reduction" value="0.00" size="11" />
<select name="sp_reduction_type">
<option selected="selected">---</option>
<option value="amount">{l s='Amount'}</option>
<option value="percentage">{l s='Percentage'}</option>
</select>
{l s='(if set to "amount", the tax is included)'}
</div>
<div class="margin-form">
<input type="submit" name="submitPriceAddition" value="{l s='Add'}" class="button" />
</div>
{l s='(tax excl.):'}
{/if}
</label>
<div class="margin-form">
<span id="spm_currency_sign_pre_0" style="font-weight:bold; color:#000000; font-size:12px">
{$currency->prefix}
</span>
<input type="text" name="sp_price" value="0" size="11" />
<span id="spm_currency_sign_post_0" style="font-weight:bold; color:#000000; font-size:12px">
{$currency->suffix}
</span>
<span>
(
{l s='Current:'}
<span id="sp_current_ht_price">{displayWtPrice p=$product->price}</span>
)
</span>
<div class="hint" style="display:block;">
{l s='You can set this value at 0 in order to apply the default price'}
</div>
</div>
<label>{l s='Apply a discount of:'}</label>
<div class="margin-form">
<input type="text" name="sp_reduction" value="0.00" size="11" />
<select name="sp_reduction_type">
<option selected="selected">---</option>
<option value="amount">{l s='Amount'}</option>
<option value="percentage">{l s='Percentage'}</option>
</select>
{l s='(if set to "amount", the tax is included)'}
</div>
<div class="margin-form">
<input type="submit" name="submitPriceAddition" value="{l s='Add'}" class="button" />
</div>
</div>
<table style="text-align: center;width:100%" class="table" cellpadding="0" cellspacing="0">
<thead>
<tr>
@@ -241,4 +277,6 @@ var product_prices = new Array();
<script type="text/javascript">
calcPriceTI();
unitPriceWithTax('unit');
</script>
</script>
{/if}
+135 -105
View File
@@ -1,4 +1,32 @@
<h4>{l s='Available quantities for sale'}</h4>
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 11069 $
* @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)}
<h4>{l s='Available quantities for sale'}</h4>
<div class="separation"></div>
<div class="hint" style="display:block; position:'auto';">
<p>{l s='This interface allows you to manage the available quantities for sale of the current product and its combinations on the current shop.'}</p>
@@ -100,118 +128,120 @@
</div>
{/if}
<script type="text/javascript">
var showAjaxError = function(msg)
{
$('#available_quantity_ajax_error_msg').html(msg);
$('#available_quantity_ajax_error_msg').show();
$('#available_quantity_ajax_msg').hide();
$('#available_quantity_ajax_success_msg').hide();
};
var showAjaxSuccess = function(msg)
{
$('#available_quantity_ajax_success_msg').html(msg);
$('#available_quantity_ajax_error_msg').hide();
$('#available_quantity_ajax_msg').hide();
$('#available_quantity_ajax_success_msg').show();
};
var showAjaxMsg = function(msg)
{
$('#available_quantity_ajax_msg').html(msg);
$('#available_quantity_ajax_error_msg').hide();
$('#available_quantity_ajax_msg').show();
$('#available_quantity_ajax_success_msg').hide();
};
var ajaxCall = function(data)
{
data.ajaxProductQuantity = 1;
data.id_product = '{$product->id}';
data.token = "{$token}";
data.ajax = 1;
data.controller = "AdminProducts";
data.action = "productQuantity";
showAjaxMsg('{l s='Saving data...'}');
$.ajax({
type: "POST",
url: "ajax-tab.php",
data: data,
dataType: 'json',
async : true,
success: function(msg)
{
if (msg.error)
<script type="text/javascript">
var showAjaxError = function(msg)
{
$('#available_quantity_ajax_error_msg').html(msg);
$('#available_quantity_ajax_error_msg').show();
$('#available_quantity_ajax_msg').hide();
$('#available_quantity_ajax_success_msg').hide();
};
var showAjaxSuccess = function(msg)
{
$('#available_quantity_ajax_success_msg').html(msg);
$('#available_quantity_ajax_error_msg').hide();
$('#available_quantity_ajax_msg').hide();
$('#available_quantity_ajax_success_msg').show();
};
var showAjaxMsg = function(msg)
{
$('#available_quantity_ajax_msg').html(msg);
$('#available_quantity_ajax_error_msg').hide();
$('#available_quantity_ajax_msg').show();
$('#available_quantity_ajax_success_msg').hide();
};
var ajaxCall = function(data)
{
data.ajaxProductQuantity = 1;
data.id_product = '{$product->id}';
data.token = "{$token}";
data.ajax = 1;
data.controller = "AdminProducts";
data.action = "productQuantity";
showAjaxMsg('{l s='Saving data...'}');
$.ajax({
type: "POST",
url: "ajax-tab.php",
data: data,
dataType: 'json',
async : true,
success: function(msg)
{
if (msg.error)
{
showAjaxError('{l s='Error durring saving data'}');
return;
}
showAjaxSuccess('{l s='Data saved'}');
},
error: function(msg)
{
showAjaxError('{l s='Error durring saving data'}');
return;
}
showAjaxSuccess('{l s='Data saved'}');
},
error: function(msg)
});
};
var refreshQtyAvaibilityForm = function()
{
if ($('#depends_on_stock_0').attr('checked'))
{
showAjaxError('{l s='Error durring saving data'}');
$('.available_quantity').find('input').show();
$('.available_quantity').find('span').hide();
}
else
{
$('.available_quantity').find('input').hide();
$('.available_quantity').find('span').show();
}
};
$('.depends_on_stock').click(function(e)
{
refreshQtyAvaibilityForm();
ajaxCall( { actionQty: 'depends_on_stock', value: $(this).val() } );
if($(this).val() == 0)
$('.available_quantity input').trigger('change');
});
// bind enter key event on search field
$('.available_quantity').find('input').bind('keypress', function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { //Enter keycode
e.stopPropagation();//Stop event propagation
return false;
}
});
};
var refreshQtyAvaibilityForm = function()
{
if ($('#depends_on_stock_0').attr('checked'))
$('.available_quantity').find('input').blur(function(e)
{
$('.available_quantity').find('input').show();
$('.available_quantity').find('span').hide();
}
else
ajaxCall( { actionQty: 'set_qty', id_product_attribute: $(this).parent().attr('id').split('_')[1], value: $(this).val() } );
});
$('.available_quantity').find('input').click(function(e)
{
$('.available_quantity').find('input').hide();
$('.available_quantity').find('span').show();
}
};
$('.depends_on_stock').click(function(e)
{
refreshQtyAvaibilityForm();
ajaxCall( { actionQty: 'depends_on_stock', value: $(this).val() } );
if($(this).val() == 0)
$('.available_quantity input').trigger('change');
});
// bind enter key event on search field
$('.available_quantity').find('input').bind('keypress', function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { //Enter keycode
e.stopPropagation();//Stop event propagation
return false;
}
});
$('.available_quantity').find('input').blur(function(e)
{
ajaxCall( { actionQty: 'set_qty', id_product_attribute: $(this).parent().attr('id').split('_')[1], value: $(this).val() } );
});
$('.available_quantity').find('input').click(function(e)
{
if(typeof(this.intervalId) != 'undefined')
window.clearInterval(this.intervalId);
this.intervalId = window.setInterval(function(it, initialValue)
{
if(initialValue != $(it).val())
if(typeof(this.intervalId) != 'undefined')
window.clearInterval(this.intervalId);
this.intervalId = window.setInterval(function(it, initialValue)
{
window.clearInterval(it.intervalId);
$(it).trigger('change');
$(it).trigger('click');
}
}, 500, this, $(this).val())
});
$('.out_of_stock').click(function(e)
{
if(initialValue != $(it).val())
{
window.clearInterval(it.intervalId);
$(it).trigger('change');
$(it).trigger('click');
}
}, 500, this, $(this).val())
});
$('.out_of_stock').click(function(e)
{
refreshQtyAvaibilityForm();
ajaxCall( { actionQty: 'out_of_stock', value: $(this).val() } );
});
refreshQtyAvaibilityForm();
ajaxCall( { actionQty: 'out_of_stock', value: $(this).val() } );
});
</script>
refreshQtyAvaibilityForm();
</script>
{/if}
+178 -148
View File
@@ -1,165 +1,195 @@
<h4>{l s='Suppliers of the current product'}</h4>
<div class="separation"></div>
<div class="hint" 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 for each product/product combinations the supplier reference according to previously associated suppliers.'}</p>
</div>
<p>{l s='Please choose the suppliers associated to this product, and the default one.'}</p>
{assign var=confirm value="Are you sure you want to delete entered product information?"}
<a class="button bt-icon" href="{$link->getAdminLink('AdminSuppliers')}&addsupplier" onclick="return confirm(' {$confirm} ')">
<img src="../img/admin/add.gif" alt="{l s='Create new supplier'}" title="{l s='Create new supplier'}" /><span>{l s='Create new supplier'}</span>
</a>
<table cellpadding="5" style="width:100%">
<tbody>
<tr>
<td valign="top" style="text-align:left;vertical-align:top;">
<table class="table" cellpadding="0" cellspacing="0" style="width:50%;">
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 11069 $
* @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)}
<h4>{l s='Suppliers of the current product'}</h4>
<div class="separation"></div>
<div class="hint" 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 for each product/product combinations the supplier reference according to previously associated suppliers.'}</p>
</div>
<p>{l s='Please choose the suppliers associated to this product, and the default one.'}</p>
{assign var=confirm value="Are you sure you want to delete entered product information?"}
<a class="button bt-icon" href="{$link->getAdminLink('AdminSuppliers')}&addsupplier" onclick="return confirm(' {$confirm} ')">
<img src="../img/admin/add.gif" alt="{l s='Create new supplier'}" title="{l s='Create new supplier'}" /><span>{l s='Create new supplier'}</span>
</a>
<table cellpadding="5" style="width:100%">
<tbody>
<tr>
<td valign="top" style="text-align:left;vertical-align:top;">
<table class="table" cellpadding="0" cellspacing="0" style="width:50%;">
<thead>
<tr>
<th>{l s='Selected'}</th>
<th>{l s='Supplier Name'}</th>
<th>{l s='Default'}</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>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h4>{l s='Product reference(s)'}</h4>
<div class="separation"></div>
<p>{l s='You can specify product reference(s) for each supplier associated.'}</p>
<div id="suppliers_accordion" style="margin-top:10px; display:block;">
{foreach from=$associated_suppliers item=supplier}
<h3 style="margin-bottom:0;"><a href="#">{$supplier->name}</a></h3>
<div style="display:block;">
<table cellpadding="10" cellspacing="0" class="table">
<thead>
<tr>
<th>{l s='Selected'}</th>
<th>{l s='Supplier Name'}</th>
<th>{l s='Default'}</th>
<th>{l s='Product name'}</th>
<th width="150">{l s='Supplier reference'}</th>
<th width="150">{l s='Unit price tax excluded'}</th>
<th width="150">{l s='Unit price currency'}</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>
{foreach $attributes AS $index => $attribute}
{assign var=reference value=''}
{assign var=price_te value=''}
{assign var=id_currency value=''}
{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)}
{assign var=id_currency value=$asc->id_currency}
{/if}
{/foreach}
<tr {if $index is odd}class="alt_row"{/if}>
<td>{$product_designation[$attribute['id_product_attribute']]}</td>
<td>
<input type="text" size="10" value="{$reference}" name="supplier_reference_{$attribute['id_product']}_{$attribute['id_product_attribute']}_{$supplier->id_supplier}" />
</td>
<td>
<input type="text" size="10" value="{$price_te}" 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>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h4>{l s='Product reference(s)'}</h4>
<div class="separation"></div>
<p>{l s='You can specify product reference(s) for each supplier associated.'}</p>
<div id="suppliers_accordion" style="margin-top:10px; display:block;">
{foreach from=$associated_suppliers item=supplier}
<h3 style="margin-bottom:0;"><a href="#">{$supplier->name}</a></h3>
<div style="display:block;">
<table cellpadding="10" cellspacing="0" class="table">
<thead>
<tr>
<th>{l s='Product name'}</th>
<th width="150">{l s='Supplier reference'}</th>
<th width="150">{l s='Unit price tax excluded'}</th>
<th width="150">{l s='Unit price currency'}</th>
</tr>
</thead>
<tbody>
{foreach $attributes AS $index => $attribute}
{assign var=reference value=''}
{assign var=price_te value=''}
{assign var=id_currency value=''}
{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)}
{assign var=id_currency value=$asc->id_currency}
{/if}
{/foreach}
<tr {if $index is odd}class="alt_row"{/if}>
<td>{$product_designation[$attribute['id_product_attribute']]}</td>
<td>
<input type="text" size="10" value="{$reference}" name="supplier_reference_{$attribute['id_product']}_{$attribute['id_product_attribute']}_{$supplier->id_supplier}" />
</td>
<td>
<input type="text" size="10" value="{$price_te}" 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>
{/foreach}
</div>
<script type="text/javascript">
$(function() {
var default_is_ok = false;
var manageDefaultSupplier = function() {
var availables_radio_buttons = [];
var radio_buttons = $('input[name="default_supplier"]');
for (i=0; i<radio_buttons.length; i++)
{
var item = $(radio_buttons[i]);
if (item.is(':disabled'))
</div>
{/foreach}
</div>
<script type="text/javascript">
$(function() {
var default_is_ok = false;
var manageDefaultSupplier = function() {
var availables_radio_buttons = [];
var radio_buttons = $('input[name="default_supplier"]');
for (i=0; i<radio_buttons.length; i++)
{
if (item.is(':checked'))
var item = $(radio_buttons[i]);
if (item.is(':disabled'))
{
item.attr("checked", "");
default_is_ok = false;
if (item.is(':checked'))
{
item.attr("checked", "");
default_is_ok = false;
}
}
else
{
availables_radio_buttons.push(item);
}
}
if (default_is_ok == false)
{
for (i=0; i<availables_radio_buttons.length; i++)
{
var item = $(availables_radio_buttons[i]);
if (item.is(':disabled') == false)
{
item.attr("checked", "checked");
default_is_ok = true;
}
break;
}
}
};
$('.supplierCheckBox').click(function() {
var check = $(this);
var checkbox = $('#default_supplier_'+check.val());
if (this.checked)
{
//enable default radio button associated
checkbox.attr("disabled","");
}
else
{
availables_radio_buttons.push(item);
//enable default radio button associated
checkbox.attr("disabled","disabled");
}
}
if (default_is_ok == false)
{
for (i=0; i<availables_radio_buttons.length; i++)
{
var item = $(availables_radio_buttons[i]);
if (item.is(':disabled') == false)
{
item.attr("checked", "checked");
default_is_ok = true;
}
break;
}
}
};
$('.supplierCheckBox').click(function() {
var check = $(this);
var checkbox = $('#default_supplier_'+check.val());
if (this.checked)
{
//enable default radio button associated
checkbox.attr("disabled","");
}
else
{
//enable default radio button associated
checkbox.attr("disabled","disabled");
}
//manage default supplier check
manageDefaultSupplier();
//manage default supplier check
manageDefaultSupplier();
});
setTimeout(function() {
$('#suppliers_accordion').accordion();
}, 500);
});
setTimeout(function() {
$('#suppliers_accordion').accordion();
}, 500);
});
</script>
</script>
{/if}
@@ -1,3 +1,29 @@
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display:none;{/if}float: left;">
+111 -81
View File
@@ -1,88 +1,118 @@
<h4>{l s='Product location in warehouses'}</h4>
<div class="separation"></div>
<div class="hint" style="display:block; position:'auto';">
<p>{l s='This interface allows you to specify in which warehouses the product is stocked.'}</p>
<p>{l s='It is also possible to specify for each product/product combinations its location in each warehouse.'}</p>
</div>
<p>{l s='Please choose the warehouses associated to this product, and the default one.'}</p>
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 11069 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{assign var=confirm value="Are you sure you want to delete entered product information?"}
{if isset($product->id)}
<a class="button bt-icon" href="{$link->getAdminLink('AdminWarehouses')}&addwarehouse" onclick="return confirm(' {$confirm} ')">
<img src="../img/admin/add.gif" alt="{l s='Create new warehouse'}" title="{l s='Create new warehouse'}" /><span>{l s='Create new warehouse'}</span>
</a>
<div id="warehouse_accordion" style="margin-top:10px; display:block;">
{foreach from=$warehouses item=warehouse}
<h3 style="margin-bottom:0;"><a href="#">{$warehouse['name']}</a></h3>
<div style="display:block;">
<table cellpadding="10" cellspacing="0" class="table">
<tr>
<th width="100">{l s='In the warehouse?'}</th>
<th>{l s='product name'}</th>
<th width="150">{l s='location in the warehouse (optionnal)'}</th>
</tr>
{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><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}"
size="20" />
</td>
<h4>{l s='Product location in warehouses'}</h4>
<div class="separation"></div>
<div class="hint" style="display:block; position:'auto';">
<p>{l s='This interface allows you to specify in which warehouses the product is stocked.'}</p>
<p>{l s='It is also possible to specify for each product/product combinations its location in each warehouse.'}</p>
</div>
<p>{l s='Please choose the warehouses associated to this product, and the default one.'}</p>
{assign var=confirm value="Are you sure you want to delete entered product information?"}
<a class="button bt-icon" href="{$link->getAdminLink('AdminWarehouses')}&addwarehouse" onclick="return confirm(' {$confirm} ')">
<img src="../img/admin/add.gif" alt="{l s='Create new warehouse'}" title="{l s='Create new warehouse'}" /><span>{l s='Create new warehouse'}</span>
</a>
<div id="warehouse_accordion" style="margin-top:10px; display:block;">
{foreach from=$warehouses item=warehouse}
<h3 style="margin-bottom:0;"><a href="#">{$warehouse['name']}</a></h3>
<div style="display:block;">
<table cellpadding="10" cellspacing="0" class="table">
<tr>
<th width="100">{l s='In the warehouse?'}</th>
<th>{l s='product name'}</th>
<th width="150">{l s='location in the warehouse (optionnal)'}</th>
</tr>
{/foreach}
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td><input type="checkbox" id="check_all_suppliers" value="check_warehouse_{$warehouse['id_warehouse']}" /></td>
<td colspan="2"><i>{l s='Mark all products available in the current warehouse.'}</i></td>
</tr>
</table>
</div>
{/foreach}
</div>
<p>&nbsp;</p>
<script type="text/javascript">
$(function() {
$('#check_all_suppliers').click(function() {
var check = $(this);
//get all checkboxes of current warehouse
var checkboxes = $('input[name*="'+check.val()+'"]');
for (i=0; i<checkboxes.length; i++)
{
var item = $(checkboxes[i]);
if (item.is(':checked'))
{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><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}"
size="20" />
</td>
</tr>
{/foreach}
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td><input type="checkbox" id="check_all_suppliers" value="check_warehouse_{$warehouse['id_warehouse']}" /></td>
<td colspan="2"><i>{l s='Mark all products available in the current warehouse.'}</i></td>
</tr>
</table>
</div>
{/foreach}
</div>
<p>&nbsp;</p>
<script type="text/javascript">
$(function() {
$('#check_all_suppliers').click(function() {
var check = $(this);
//get all checkboxes of current warehouse
var checkboxes = $('input[name*="'+check.val()+'"]');
for (i=0; i<checkboxes.length; i++)
{
item.attr("checked", "");
var item = $(checkboxes[i]);
if (item.is(':checked'))
{
item.attr("checked", "");
}
else
{
item.attr("checked", "checked");
}
}
else
{
item.attr("checked", "checked");
}
}
});
setTimeout(function() {
$('#warehouse_accordion').accordion();
}, 500);
});
</script>
setTimeout(function() {
$('#warehouse_accordion').accordion();
}, 500);
});
</script>
{/if}
+9 -8
View File
@@ -33,16 +33,17 @@
<div>{$btn.desc}</div>
</a>
</li>
{if isset($ps_help_context) && $ps_help_context}
<li class="help-context" style="display:none">
<a id="desc-{$table}-help" class="toolbar_btn" href="#" title="{l s='Help'}">
<span class="process-icon-help"></span>
<div>{l s='Help'}</div>
</a>
</li>
{/if}
{/foreach}
{if isset($ps_help_context) && $ps_help_context}
<li class="help-context" style="display:none">
<a id="desc-{$table}-help" class="toolbar_btn" href="#" title="{l s='Help'}">
<span class="process-icon-help"></span>
<div>{l s='Help'}</div>
</a>
</li>
{/if}
</ul>
<script language="javascript">
$(function() {
//get reference on save link
+20 -13
View File
@@ -361,16 +361,21 @@ class SearchCore
{
// Adjust the limit to get only "whole" products, in every languages (and at least one)
$limit = max(1, round($limit / $total_languages) * $total_languages);
return Db::getInstance()->executeS('
SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc,
pl.description_short, pl.description, cl.name cname, m.name mname
FROM '._DB_PREFIX_.'product p
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON p.id_product = pl.id_product
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default AND pl.id_lang = cl.id_lang)
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON m.id_manufacturer = p.id_manufacturer
WHERE p.indexed = 0
'.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
LIMIT '.(int)$limit);
SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc,
pl.description_short, pl.description, cl.name cname, m.name mname
FROM '._DB_PREFIX_.'product p
LEFT JOIN '._DB_PREFIX_.'product_lang pl
ON p.id_product = pl.id_product
LEFT JOIN '._DB_PREFIX_.'category_lang cl
ON (cl.id_category = p.id_category_default AND pl.id_lang = cl.id_lang)
LEFT JOIN '._DB_PREFIX_.'manufacturer m
ON m.id_manufacturer = p.id_manufacturer
WHERE p.indexed = 0
'.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
LIMIT '.(int)$limit
);
}
public static function indexation($full = false, $id_product = false)
@@ -390,9 +395,10 @@ class SearchCore
{
// Do it even if you already know the product id in order to be sure that it exists
$products = $db->executeS('
SELECT id_product
FROM '._DB_PREFIX_.'product
WHERE '.($id_product ? 'id_product = '.(int)$id_product : 'indexed = 0'));
SELECT id_product
FROM '._DB_PREFIX_.'product
WHERE '.($id_product ? 'id_product = '.(int)$id_product : 'indexed = 0')
);
$ids = array();
if ($products)
@@ -440,7 +446,8 @@ class SearchCore
// Products are processed 50 by 50 in order to avoid overloading MySQL
$count = count($products);
while ($products = Search::getProductsToIndex($total_languages, $id_product, 50) && $count > 0)
$products = Search::getProductsToIndex($total_languages, $id_product, 50);
while ($products && $count > 0)
{
// Now each non-indexed product is processed one by one, langage by langage
foreach ($products as $product)
+298 -293
View File
@@ -38,8 +38,8 @@ class AdminProductsControllerCore extends AdminController
protected $available_tabs = array(
'Informations',
'Images',
'Prices',
'Images',
'Combinations',
'Features',
'Customization',
@@ -52,20 +52,6 @@ class AdminProductsControllerCore extends AdminController
protected $available_tabs_lang = array ();
protected $tabs_toolbar_save_buttons = array(
'Informations' => true,
'Images' => false,
'Prices' => false,
'Combinations' => false,
'Features' => true,
'Customization' => false,
'Attachments' => true,
'Quantities' => false,
'Suppliers' => true,
'Warehouses' => true,
'Accounting' => true
);
public function __construct()
{
$this->table = 'product';
@@ -97,8 +83,8 @@ class AdminProductsControllerCore extends AdminController
// @since 1.5 : translations for tabs
$this->available_tabs_lang = array (
'Informations' => $this->l('Informations'),
'Images' => $this->l('Images'),
'Prices' => $this->l('Prices'),
'Images' => $this->l('Images'),
'Combinations' => $this->l('Combinations'),
'Features' => $this->l('Features'),
'Customization' => $this->l('Customization'),
@@ -1146,7 +1132,7 @@ class AdminProductsControllerCore extends AdminController
public function addProductImage($product, $method = 'auto')
{
/* Updating an existing product image */
if ($id_image = ((int)(Tools::getValue('id_image'))))
if ($id_image = (int)Tools::getValue('id_image'))
{
$image = new Image($id_image);
if (!Validate::isLoadedObject($image))
@@ -1170,7 +1156,7 @@ class AdminProductsControllerCore extends AdminController
return false;
@unlink(_PS_TMP_IMG_DIR_.'/product_'.$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'/product_mini_'.$product->id.'.jpg');
return ((isset($id_image) && is_int($id_image) && $id_image) ? $id_image : true);
return ((isset($id_image) && is_int($id_image) && $id_image) ? $id_image : false);
}
/**
* Copy a product image
@@ -1381,31 +1367,30 @@ class AdminProductsControllerCore extends AdminController
{
Hook::exec('addProduct', array('product' => $object));
Search::indexation(false, $object->id);
// Save and preview
if (Tools::isSubmit('submitAddProductAndPreview'))
}
// Save and preview
if (Tools::isSubmit('submitAddProductAndPreview'))
{
$preview_url = ($this->context->link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', $this->context->language->id), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $this->context->language->id)));
if (!$object->active)
{
$preview_url = ($this->context->link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', $this->context->language->id), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $this->context->language->id)));
if (!$object->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
$token = Tools::encrypt('PreviewProduct'.$object->id);
$preview_url .= '&adtoken='.$token.'&ad='.$admin_dir;
}
$this->redirect_after = $preview_url;
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
$token = Tools::encrypt('PreviewProduct'.$object->id);
$preview_url .= '&adtoken='.$token.'&ad='.$admin_dir;
}
if (Tools::getValue('resizer') == 'man' && isset($id_image) && is_int($id_image) && $id_image)
$this->redirect_after = self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&id_image='.$id_image.'&imageresize&toconf=3&submitAddAndStay='.(Tools::isSubmit('submitAdd'.$this->table.'AndStay') ? 'on' : 'off').'&token='.($token ? $token : $this->token);
// Save and stay on same form
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
$this->redirect_after = self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=3&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token);
else
// Default behavior (save and back)
$this->redirect_after = self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=3&token='.($token ? $token : $this->token);
$this->redirect_after = $preview_url;
}
if (Tools::getValue('resizer') == 'man' && isset($id_image) && is_int($id_image) && $id_image)
$this->redirect_after = self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&id_image='.$id_image.'&imageresize&toconf=3&submitAddAndStay='.(Tools::isSubmit('submitAdd'.$this->table.'AndStay') ? 'on' : 'off').'&token='.($token ? $token : $this->token);
// Save and stay on same form
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
$this->redirect_after = self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=3&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token);
else
// Default behavior (save and back)
$this->redirect_after = self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=3&token='.($token ? $token : $this->token);
}
else
$object->delete();
@@ -1681,37 +1666,31 @@ class AdminProductsControllerCore extends AdminController
$action = $this->action;
if (empty($action) || !method_exists($this, 'initForm'.$action))
$action = 'Informations';
if (Tools::getValue('id_product'))
// i is used as product_tab id
$i = 0;
$advanced_stock_management_active = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
$stock_management_active = Configuration::get('PS_STOCK_MANAGEMENT');
foreach ($this->available_tabs as $product_tab)
{
// i is used as product_tab id
$i = 0;
$advanced_stock_management_active = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
$stock_management_active = Configuration::get('PS_STOCK_MANAGEMENT');
// if it's the quantities tab and stock management is disabled, continue
if ($stock_management_active == 0 && $product_tab == 'Quantities')
continue;
foreach ($this->available_tabs as $product_tab)
{
// if it's the quantities tab and stock management is disabled, continue
if ($stock_management_active == 0 && $product_tab == 'Quantities')
continue;
// if it's the warehouses tab and advanced stock management is disabled, continue
if ($advanced_stock_management_active == 0 && $product_tab == 'Warehouses')
continue;
// if it's the warehouses tab and advanced stock management is disabled, continue
if ($advanced_stock_management_active == 0 && $product_tab == 'Warehouses')
continue;
$product_tabs[$product_tab] = array(
'id' => ++$i.'-'.$product_tab,
'selected' => (strtolower($product_tab) == strtolower($action)),
'name' => $this->available_tabs_lang[$product_tab],
'href' => $this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.Tools::getValue('id_product').'&amp;action='.$product_tab,
);
}
$this->tpl_form_vars['newproduct'] = 0;
$product_tabs[$product_tab] = array(
'id' => ++$i.'-'.$product_tab,
'selected' => (strtolower($product_tab) == strtolower($action)),
'name' => $this->available_tabs_lang[$product_tab],
'href' => $this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.Tools::getValue('id_product').'&amp;action='.$product_tab,
);
}
else
$this->tpl_form_vars['newproduct'] = 1;
$this->tpl_form_vars['product_tabs'] = $product_tabs;
$this->tpl_form_vars['tabs_toolbar_save_buttons'] = $this->tabs_toolbar_save_buttons;
}
$languages = Language::getLanguages(false);
@@ -1851,39 +1830,53 @@ class AdminProductsControllerCore extends AdminController
public function initToolbar()
{
if ($this->display == 'edit' || $this->display == 'add')
{
if ($product = $this->loadObject(true))
{
if ($this->tabAccess['delete'] && $this->display != 'add')
$this->toolbar_btn['delete'] = array(
'short' => 'Delete',
'href' => $this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id.'&amp;deleteproduct',
'desc' => $this->l('Delete this product'),
'confirm' => 1);
if ((bool)$product->id)
{
// adding button for delete this product
if ($this->tabAccess['delete'] && $this->display != 'add')
$this->toolbar_btn['delete'] = array(
'short' => 'Delete',
'href' => $this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id.'&amp;deleteproduct',
'desc' => $this->l('Delete this product'),
'confirm' => 1);
if ($this->tabAccess['add'] && $this->display != 'add')
$this->toolbar_btn['duplicate'] = array(
'short' => 'Duplicate',
'href' => '#todo'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id,
'desc' => $this->l('Duplicate'),
'confirm' => 1
// adding button for duplicate this product
if ($this->tabAccess['add'] && $this->display != 'add')
$this->toolbar_btn['duplicate'] = array(
'short' => 'Duplicate',
'href' => '#todo'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id,
'desc' => $this->l('Duplicate'),
'confirm' => 1
);
// adding button for preview this product
if ($url_preview = $this->getPreviewUrl($product))
$this->toolbar_btn['preview'] = array(
'short' => 'Preview',
'href' => $url_preview,
'desc' => $this->l('prevdesc'),
'target' => true,
'class' => 'previewUrl'
);
// adding button for preview this product statistics
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php') && $this->display != 'add')
$this->toolbar_btn['stats'] = array(
'short' => 'Statistics',
'href' => $this->context->link->getAdminLink('AdminStats').'&amp;module=statsproduct&amp;id_product='.$product->id,
'desc' => $this->l('View product sales'),
);
// @TODO navigation
if ($url_preview = $this->getPreviewUrl($product))
$this->toolbar_btn['preview'] = array(
'short' => 'Preview',
'href' => $url_preview,
'desc' => $this->l('prevdesc'),
'target' => true,
'class' => 'previewUrl'
// adding button for adding a new combination in Combinaition tab
$this->toolbar_btn['newCombination'] = array(
'short' => 'Add a new combination',
'desc' => $this->l('Add a new combination'),
'class' => 'toolbar-new'
);
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php') && $this->display != 'add')
$this->toolbar_btn['stats'] = array(
'short' => 'Statistics',
'href' => $this->context->link->getAdminLink('AdminStats').'&amp;module=statsproduct&amp;id_product='.$product->id,
'desc' => $this->l('View product sales'),
);
}
$this->toolbar_btn['cancel'] = array(
'short' => 'Close',
@@ -1892,21 +1885,6 @@ class AdminProductsControllerCore extends AdminController
'confirm' => 1
);
if ($this->tabAccess['add'] && !($this->display == 'add' || $this->display == 'edit'))
{
$this->toolbar_btn['new'] = array(
'short' => 'Create',
'href' => '#todo'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id,
'desc' => $this->l('Create'),
);
}
$this->toolbar_btn['newCombination'] = array(
'short' => 'Add a new combination',
'desc' => $this->l('Add a new combination'),
'class' => 'toolbar-new'
);
if ($this->tabAccess['edit'])
{
$this->toolbar_btn['save'] = array(
@@ -1921,8 +1899,9 @@ class AdminProductsControllerCore extends AdminController
'desc' => $this->l('Save and stay'),
);
}
}
}
parent::initToolbar();
$this->context->smarty->assign('toolbar_fix', 1);
$this->context->smarty->assign('show_toolbar', 1);
@@ -2301,67 +2280,59 @@ class AdminProductsControllerCore extends AdminController
*/
public function initFormAccounting($obj)
{
$error = '';
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
$detail = array();
$data = $this->context->smarty->createData();
if (count($this->context->shop->getListOfID()) > 1)
$error = $this->l('Please select the shop you want to configure');
else
if ($obj->id)
{
$zones = Zone::getZones();
$id_shop = $this->context->shop->getID();
// Set default zone value to the shop and sort it
foreach($zones as $zone)
$error = '';
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
$detail = array();
if (count($this->context->shop->getListOfID()) > 1)
$error = $this->l('Please select the shop you want to configure');
else
{
$detail['zones'][$zone['id_zone']]['name'] = $zone['name'];
$detail['zones'][$zone['id_zone']]['account_number'] = '';
$zones = Zone::getZones();
$id_shop = $this->context->shop->getID();
// Set default zone value to the shop and sort it
foreach($zones as $zone)
{
$detail['zones'][$zone['id_zone']]['name'] = $zone['name'];
$detail['zones'][$zone['id_zone']]['account_number'] = '';
}
$zoneAccountNumberList = Accounting::getProductAccountNumberZoneShop($obj->id, $id_shop);
// Set Account number to the id_zone for an id_shop if exist
foreach($zoneAccountNumberList as $zone)
$detail['zones'][$zone['id_zone']]['account_number'] = $zone['account_number'];
}
$zoneAccountNumberList = Accounting::getProductAccountNumberZoneShop($obj->id, $id_shop);
// Set Account number to the id_zone for an id_shop if exist
foreach($zoneAccountNumberList as $zone)
$detail['zones'][$zone['id_zone']]['account_number'] = $zone['account_number'];
$data->assign(array(
'productAccountNumberList' => $detail,
'shopName' => $this->context->shop->name,
'error' => $error,
'product' => $obj
));
}
else
$this->displayWarning($this->l('You must save this product before manage accounting.'));
$this->context->smarty->assign(array(
'productAccountNumberList' => $detail,
'shopName' => $this->context->shop->name,
'error' => $error,
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->fetch('products/accounting.tpl');
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
public function initFormPrices($obj, $languages, $default_language)
{
$data = $this->context->smarty->createData();
if ($this->object->id)
$product = $obj;
if ($obj->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);
$currencies = Currency::getCurrencies();
$currency =
$attributes = $this->object->getAttributesGroups((int)$this->context->language->id);
$attributes = $obj->getAttributesGroups((int)$this->context->language->id);
$combinations = array();
foreach($attributes as $attribute)
{
@@ -2370,7 +2341,7 @@ class AdminProductsControllerCore extends AdminController
$combinations[$attribute['id_product_attribute']]['attributes'] = '';
$combinations[$attribute['id_product_attribute']]['attributes'] .= $attribute['attribute_name'].' - ';
$combinations[$attribute['id_product_attribute']]['price'] = Tools::displayPrice(Tools::convertPrice(Product::getPriceStatic((int)$this->object->id, false, $attribute['id_product_attribute']), $this->context->currency), $this->context->currency);
$combinations[$attribute['id_product_attribute']]['price'] = Tools::displayPrice(Tools::convertPrice(Product::getPriceStatic((int)$obj->id, false, $attribute['id_product_attribute']), $this->context->currency), $this->context->currency);
}
foreach ($combinations as &$combination)
$combination['attributes'] = rtrim($combination['attributes'], ' - ');
@@ -2381,16 +2352,35 @@ class AdminProductsControllerCore extends AdminController
'countries' => $countries,
'groups' => $groups,
'combinations' => $combinations,
'product' => $this->object
'product' => $product
));
$data->assign('country_display_tax_label', $this->context->country->display_tax_label);
$data->assign('specificPriceModificationForm', $this->_displaySpecificPriceModificationForm($this->context->currency, $shops, $currencies, $countries, $groups));
}
else
$data->assign('content', '<b>'.$this->l('You must save this product before adding specific prices').'.</b>');
$this->displayWarning($this->l('You must save this product before adding specific prices'));
$data->assign('currency', $this->context->currency);
// 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'));
$data->assign('country_display_tax_label', $this->context->country->display_tax_label);
$data->assign(array(
'currency', $this->context->currency,
'product' => $product
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
@@ -2408,8 +2398,8 @@ class AdminProductsControllerCore extends AdminController
$content = '';
if (!($obj = $this->loadObject()))
return;
$specificPrices = SpecificPrice::getByProductId((int)($obj->id));
$specificPricePriorities = SpecificPrice::getPriority((int)($obj->id));
$specificPrices = SpecificPrice::getByProductId((int)$obj->id);
$specificPricePriorities = SpecificPrice::getPriority((int)$obj->id);
$taxRate = $obj->getTaxesRate(Address::initialize());
@@ -2614,22 +2604,27 @@ class AdminProductsControllerCore extends AdminController
{
$data = $this->context->smarty->createData();
$labels = $obj->getCustomizationFields();
if ((bool)$obj->id)
{
$labels = $obj->getCustomizationFields();
$has_file_labels = (int)$this->getFieldValue($obj, 'uploadable_files');
$has_text_labels = (int)$this->getFieldValue($obj, 'text_fields');
$has_file_labels = (int)$this->getFieldValue($obj, 'uploadable_files');
$has_text_labels = (int)$this->getFieldValue($obj, 'text_fields');
$data->assign(array(
'obj' => $obj,
'table' => $this->table,
'languages' => $languages,
'has_file_labels' => $has_file_labels,
'display_file_labels' => $this->_displayLabelFields($obj, $labels, $languages, $default_language, Product::CUSTOMIZE_FILE),
'has_text_labels' => $has_text_labels,
'display_text_labels' => $this->_displayLabelFields($obj, $labels, $languages, $default_language, Product::CUSTOMIZE_TEXTFIELD),
'uploadable_files' => (int)($this->getFieldValue($obj, 'uploadable_files') ? (int)$this->getFieldValue($obj, 'uploadable_files') : '0'),
'text_fields' => (int)($this->getFieldValue($obj, 'text_fields') ? (int)$this->getFieldValue($obj, 'text_fields') : '0'),
));
$data->assign(array(
'obj' => $obj,
'table' => $this->table,
'languages' => $languages,
'has_file_labels' => $has_file_labels,
'display_file_labels' => $this->_displayLabelFields($obj, $labels, $languages, $default_language, Product::CUSTOMIZE_FILE),
'has_text_labels' => $has_text_labels,
'display_text_labels' => $this->_displayLabelFields($obj, $labels, $languages, $default_language, Product::CUSTOMIZE_TEXTFIELD),
'uploadable_files' => (int)($this->getFieldValue($obj, 'uploadable_files') ? (int)$this->getFieldValue($obj, 'uploadable_files') : '0'),
'text_fields' => (int)($this->getFieldValue($obj, 'text_fields') ? (int)$this->getFieldValue($obj, 'text_fields') : '0'),
));
}
else
$this->displayWarning($this->l('You must save this product before adding customization.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
@@ -2638,29 +2633,29 @@ class AdminProductsControllerCore extends AdminController
{
$data = $this->context->smarty->createData();
if (!($obj = $this->loadObject(true)))
return;
$languages = Language::getLanguages(false);
$attachment_name = array();
$attachment_description = array();
foreach ($languages as $language)
if ((bool)$obj->id)
{
$attachment_name[$language['id_lang']] = $this->getFieldValue($obj, 'attachment_name', (int)$language['id_lang']);
$attachment_description[$language['id_lang']] = $this->getFieldValue($obj, 'attachment_description', (int)$language['id_lang']);
}
$attachment_name = array();
$attachment_description = array();
foreach ($languages as $language)
{
$attachment_name[$language['id_lang']] = $this->getFieldValue($obj, 'attachment_name', (int)$language['id_lang']);
$attachment_description[$language['id_lang']] = $this->getFieldValue($obj, 'attachment_description', (int)$language['id_lang']);
}
$data->assign(array(
'obj' => $obj,
'table' => $this->table,
'languages' => $languages,
'attach1' => Attachment::getAttachments($this->context->language->id, $obj->id, true),
'attach2' => Attachment::getAttachments($this->context->language->id, $obj->id, false),
'default_form_language' => $default_language,
'attachment_name' => $attachment_name,
'attachment_description' => $attachment_description
));
$data->assign(array(
'obj' => $obj,
'table' => $this->table,
'languages' => $languages,
'attach1' => Attachment::getAttachments($this->context->language->id, $obj->id, true),
'attach2' => Attachment::getAttachments($this->context->language->id, $obj->id, false),
'default_form_language' => $default_language,
'attachment_name' => $attachment_name,
'attachment_description' => $attachment_description
));
}
else
$this->displayWarning($this->l('You must save this product before adding attachements.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
@@ -2901,36 +2896,40 @@ class AdminProductsControllerCore extends AdminController
{
$data = $this->context->smarty->createData();
$data->assign('product', $this->loadObject());
if (!Tools::getValue('id_product'))
return; // TEMPO
if ((bool)$obj->id)
{
$data->assign('product', $this->loadObject());
$shops = false;
if (Shop::isFeatureActive())
$shops = Shop::getShops();
$shops = false;
if (Shop::isFeatureActive())
$shops = Shop::getShops();
$data->assign('shops', $shops);
$data->assign('shops', $shops);
$count_images = Db::getInstance()->getValue('
SELECT COUNT(id_product)
FROM '._DB_PREFIX_.'image
WHERE id_product = '.(int)$obj->id
);
$data->assign('countImages', $count_images);
$count_images = Db::getInstance()->getValue('
SELECT COUNT(id_product)
FROM '._DB_PREFIX_.'image
WHERE id_product = '.(int)$obj->id
);
$data->assign('countImages', $count_images);
$images = Image::getImages($this->context->language->id, $obj->id);
$data->assign('id_product', (int)Tools::getValue('id_product'));
$data->assign('id_category_default', (int)$this->_category->id);
foreach ($images as $k => $image)
$images[$k] = new Image($image['id_image']);
$data->assign('images', $images);
$images = Image::getImages($this->context->language->id, $obj->id);
$data->assign('id_product', (int)Tools::getValue('id_product'));
$data->assign('id_category_default', (int)$this->_category->id);
foreach ($images as $k => $image)
$images[$k] = new Image($image['id_image']);
$data->assign('images', $images);
$data->assign('token', $this->token);
$data->assign('table', $this->table);
$data->assign('max_image_size', $this->max_image_size);
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute')));
$data->assign('currency', $this->context->currency);
$data->assign('token', $this->token);
$data->assign('table', $this->table);
$data->assign('max_image_size', $this->max_image_size);
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute')));
$data->assign('currency', $this->context->currency);
}
else
$this->displayWarning($this->l('You must save this product before adding images.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
@@ -2947,64 +2946,67 @@ class AdminProductsControllerCore extends AdminController
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
return;
}
$data = $this->context->smarty->createData();
$attribute_js = array();
$attributes = Attribute::getAttributes($this->context->language->id, true);
foreach ($attributes as $k => $attribute)
$attribute_js[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
$currency = $this->context->currency;
$data->assign('attributeJs', $attribute_js);
$data->assign('attributes_groups', AttributeGroup::getAttributesGroups($this->context->language->id));
$default_country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
$product->productDownload = new ProductDownload();
$id_product_download = (int)$product->productDownload->getIdFromIdProduct($this->getFieldValue($product, 'id'));
if (!empty($id_product_download))
$product->productDownload = new ProductDownload($id_product_download);
// $data->assign('productDownload', $product_download);
$data->assign('currency', $currency);
$images = Image::getImages($this->context->language->id, $product->id);
if ($product->id)
if ((bool)$product->id)
{
$data->assign('tax_exclude_option', Tax::excludeTaxeOption());
$data->assign('ps_weight_unit', Configuration::get('PS_WEIGHT_UNIT'));
$data->assign('ps_use_ecotax', Configuration::get('PS_USE_ECOTAX'));
$data->assign('field_value_unity', $this->getFieldValue($product, 'unity'));
$data->assign('reasons', $reasons = StockMvtReason::getStockMvtReasons($this->context->language->id));
$data->assign('ps_stock_mvt_reason_default', $ps_stock_mvt_reason_default = Configuration::get('PS_STOCK_MVT_REASON_DEFAULT'));
$data->assign('minimal_quantity', $this->getFieldValue($product, 'minimal_quantity') ? $this->getFieldValue($product, 'minimal_quantity') : 1);
$data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $language['id_lang']))) : '0000-00-00');
// date picker include
$i = 0;
$data->assign('imageType', ImageType::getByNameNType('small', 'products'));
$data->assign('imageWidth', (isset($imageType['width']) ? (int)($imageType['width']) : 64) + 25);
foreach ($images as $k => $image)
$attribute_js = array();
$attributes = Attribute::getAttributes($this->context->language->id, true);
foreach ($attributes as $k => $attribute)
$attribute_js[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
$currency = $this->context->currency;
$data->assign('attributeJs', $attribute_js);
$data->assign('attributes_groups', AttributeGroup::getAttributesGroups($this->context->language->id));
$default_country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
$product->productDownload = new ProductDownload();
$id_product_download = (int)$product->productDownload->getIdFromIdProduct($this->getFieldValue($product, 'id'));
if (!empty($id_product_download))
$product->productDownload = new ProductDownload($id_product_download);
// $data->assign('productDownload', $product_download);
$data->assign('currency', $currency);
$images = Image::getImages($this->context->language->id, $product->id);
if ($product->id)
{
$images[$k]['obj'] = new Image($image['id_image']);
++$i;
$data->assign('tax_exclude_option', Tax::excludeTaxeOption());
$data->assign('ps_weight_unit', Configuration::get('PS_WEIGHT_UNIT'));
$data->assign('ps_use_ecotax', Configuration::get('PS_USE_ECOTAX'));
$data->assign('field_value_unity', $this->getFieldValue($product, 'unity'));
$data->assign('reasons', $reasons = StockMvtReason::getStockMvtReasons($this->context->language->id));
$data->assign('ps_stock_mvt_reason_default', $ps_stock_mvt_reason_default = Configuration::get('PS_STOCK_MVT_REASON_DEFAULT'));
$data->assign('minimal_quantity', $this->getFieldValue($product, 'minimal_quantity') ? $this->getFieldValue($product, 'minimal_quantity') : 1);
$data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $language['id_lang']))) : '0000-00-00');
$i = 0;
$data->assign('imageType', ImageType::getByNameNType('small', 'products'));
$data->assign('imageWidth', (isset($imageType['width']) ? (int)($imageType['width']) : 64) + 25);
foreach ($images as $k => $image)
{
$images[$k]['obj'] = new Image($image['id_image']);
++$i;
}
$data->assign('images', $images);
}
$data->assign('images', $images);
else
$content .= '<b>'.$this->l('You must save this product before adding combinations').'.</b>';
// @todo
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute')));
$data->assign($this->tpl_form_vars);
$data->assign(array(
'list' => $this->renderListAttributes($id_product_download, $product, $currency),
'product' => $product,
'id_category' => $product->id_category_default,
'token_generator' => Tools::getAdminTokenLite('AdminAttributeGenerator')
));
}
else
$content .= '<b>'.$this->l('You must save this product before adding combinations').'.</b>';
$this->displayWarning($this->l('You must save this product before adding combinations.'));
// @todo
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute')));
$data->assign($this->tpl_form_vars);
$data->assign(array(
'list' => $this->renderListAttributes($id_product_download, $product, $currency),
'product' => $product,
'id_category' => $product->id_category_default,
'token_generator' => Tools::getAdminTokenLite('AdminAttributeGenerator')
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
@@ -3157,7 +3159,7 @@ class AdminProductsControllerCore extends AdminController
{
$data = $this->context->smarty->createData();
if ($this->object->id)
if ($obj->id)
{
// Get all id_product_attribute
$attributes = $obj->getAttributesResume($this->context->language->id);
@@ -3210,14 +3212,14 @@ class AdminProductsControllerCore extends AdminController
'available_quantity' => $available_quantity,
'stock_management_active' => Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'),
'product_designation' => $product_designation,
'product' => $this->object,
'product' => $obj,
'show_quantities' => $show_quantities,
'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'),
'token' => $this->token
));
}
else
$data->assign('content', '<b>'.$this->l('You must save this product before manage quantities').'.</b>');
$this->displayWarning($this->l('You must save this product before manage quantities.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
@@ -3226,13 +3228,13 @@ class AdminProductsControllerCore extends AdminController
{
$data = $this->context->smarty->createData();
if ($this->object->id)
if ($obj->id)
{
// Get all id_product_attribute
$attributes = $obj->getAttributesResume($this->context->language->id);
if (empty($attributes))
$attributes[] = array(
'id_product' => $this->object->id,
'id_product' => $obj->id,
'id_product_attribute' => 0,
'attribute_designation' => ''
);
@@ -3249,10 +3251,10 @@ class AdminProductsControllerCore extends AdminController
$suppliers = Supplier::getSuppliers();
// Get already associated suppliers
$associated_suppliers = ProductSupplier::getSupplierCollection($this->object->id);
$associated_suppliers = ProductSupplier::getSupplierCollection($obj->id);
// Get already associated suppliers and force to retreive product declinaisons
$product_supplier_collection = ProductSupplier::getSupplierCollection($this->object->id, false);
$product_supplier_collection = ProductSupplier::getSupplierCollection($obj->id, false);
$default_supplier = 0;
@@ -3267,7 +3269,7 @@ class AdminProductsControllerCore extends AdminController
$associated_supplier->name = $supplier['name'];
$supplier['is_selected'] = true;
if ($this->object->id_supplier == $supplier['id_supplier'])
if ($obj->id_supplier == $supplier['id_supplier'])
{
$supplier['is_default'] = true;
$default_supplier = $supplier['id_supplier'];
@@ -3283,13 +3285,13 @@ class AdminProductsControllerCore extends AdminController
'associated_suppliers_collection' => $product_supplier_collection,
'product_designation' => $product_designation,
'currencies' => Currency::getCurrencies(),
'product' => $this->object,
'product' => $obj,
'link' => $this->context->link,
'token' => $this->token
));
}
else
$data->assign('content', '<b>'.$this->l('You must save this product before manage suppliers').'.</b>');
$this->displayWarning($this->l('You must save this product before manage suppliers'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
@@ -3298,7 +3300,7 @@ class AdminProductsControllerCore extends AdminController
{
$data = $this->context->smarty->createData();
if ($this->object->id)
if ($obj->id)
{
// Get all id_product_attribute
$attributes = $obj->getAttributesResume($this->context->language->id);
@@ -3320,20 +3322,20 @@ class AdminProductsControllerCore extends AdminController
$warehouses = Warehouse::getWarehouses(true);
// Get already associated warehouses
$associated_warehouses_collection = WarehouseProductLocation::getCollection($this->object->id);
$associated_warehouses_collection = WarehouseProductLocation::getCollection($obj->id);
$data->assign(array(
'attributes' => $attributes,
'warehouses' => $warehouses,
'associated_warehouses' => $associated_warehouses_collection,
'product_designation' => $product_designation,
'product' => $this->object,
'product' => $obj,
'link' => $this->context->link,
'token' => $this->token
));
}
else
$data->assign('content', '<b>'.$this->l('You must save this product before manage warehouses').'.</b>');
$this->displayWarning($this->l('You must save this product before manage warehouses'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
@@ -3357,7 +3359,7 @@ class AdminProductsControllerCore extends AdminController
$features[$k]['val'] = array();
$custom = true;
foreach ($this->object->getFeatures() as $tab_products)
foreach ($obj->getFeatures() as $tab_products)
if ($tab_products['id_feature'] == $tab_features['id_feature'])
$features[$k]['current_item'] = $tab_products['id_feature_value'];
@@ -3370,14 +3372,17 @@ class AdminProductsControllerCore extends AdminController
if ($custom)
$features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item']);
}
$data->assign('available_features', $features);
$data->assign('product', $obj);
$data->assign('link', $this->context->link);
$data->assign('languages', $this->_languages);
$data->assign('default_form_language', $this->default_form_language);
}
else
$this->displayWarning($this->l('You must save this product before adding features.'));
$data->assign('available_features', $features);
$data->assign('product', $obj);
$data->assign('link', $this->context->link);
$data->assign('languages', $this->_languages);
$data->assign('default_form_language', $this->default_form_language);
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}