// Suppliers : Manage multiple suppliers for a product / product attribute + integration with supply orders
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
updateMvtStatus($(this).val());
|
||||
});
|
||||
updateMvtStatus($(this).val());
|
||||
|
||||
|
||||
if ( $("input[name=is_virtual_file]:checked").val() == 1)
|
||||
{
|
||||
$("#virtual_good_attributes").show();
|
||||
@@ -18,7 +18,7 @@
|
||||
$("#virtual_good_attributes").hide();
|
||||
$("#is_virtual_file_product").hide();
|
||||
}
|
||||
|
||||
|
||||
$("input[name=is_virtual_file]").live("change", function() {
|
||||
if($(this).val() == "1")
|
||||
{
|
||||
@@ -31,7 +31,7 @@
|
||||
$("#is_virtual_file_product").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var attrs = new Array();
|
||||
@@ -39,7 +39,7 @@
|
||||
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}
|
||||
@@ -98,22 +98,17 @@
|
||||
<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;" />
|
||||
{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"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Supplier Reference:'}</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="55" type="text" id="attribute_supplier_reference" name="attribute_supplier_reference" value="" style="width: 130px; margin-right: 44px;" />
|
||||
{l s='Location:'}<input size="55" type="text" id="attribute_location" name="attribute_location" value="" style="width: 101px; margin-left: 10px;" />
|
||||
<span class="hint" name="help_box">{l s='Special characters allowed:'} .-_#<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td colspan="2"><div class="separation"></div></td></tr>
|
||||
<table cellpadding="5" id="virtual_good_attributes" style="width:100%;display:none;">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<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'}: {$upload_max_filesize}</p>
|
||||
<label id="virtual_product_file_attribute_label" for="virtual_product_file_attribute" class="t">{l s='Upload a file'}</label>
|
||||
@@ -122,7 +117,7 @@
|
||||
|
||||
<p id="gethtmlink" style="display: none;">{l s='This is the link'} : {$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>
|
||||
</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>
|
||||
@@ -183,10 +178,10 @@
|
||||
{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"
|
||||
<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'}
|
||||
</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}
|
||||
@@ -222,7 +217,7 @@
|
||||
{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"
|
||||
<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'})
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
});
|
||||
$.ajax({
|
||||
/*$.ajax({
|
||||
url: "ajax-tab.php",
|
||||
cache: false,
|
||||
dataType: "json",
|
||||
@@ -51,7 +51,7 @@
|
||||
$("select#id_supplier").replaceWith("<p id=\"id_supplier\">[TECHNICAL ERROR] ajaxProductSuppliers : "+textStatus+"</p>");
|
||||
}
|
||||
|
||||
});
|
||||
});*/
|
||||
if ($('#available_for_order').is(':checked')){
|
||||
$('#show_price').attr('checked', 'checked');
|
||||
$('#show_price').attr('disabled', 'disabled');
|
||||
@@ -90,7 +90,7 @@
|
||||
<td style="padding-bottom:5px;" class="translatable">
|
||||
{foreach from=$languages item=language}
|
||||
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if} float: left;">
|
||||
<input class="{if !$product->id}copy2friendlyUrl{/if} updateCurrentText" size="43" type="text"
|
||||
<input class="{if !$product->id}copy2friendlyUrl{/if} updateCurrentText" size="43" type="text"
|
||||
id="name_{$language.id_lang}" name="name_{$language.id_lang}"
|
||||
value="{$product->name[$language.id_lang]|htmlentitiesUTF8|default:''}"/><sup> *</sup>
|
||||
<span class="hint" name="help_box">{l s='Invalid characters:'} <>;=#{}<span class="hint-pointer"> </span>
|
||||
@@ -107,13 +107,13 @@
|
||||
<span class="hint" name="help_box">{l s='Special characters allowed:' }.-_#\<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<!--tr>
|
||||
<td class="col-left"><label>{l s='Supplier Reference:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="55" type="text" name="supplier_reference" value="{$product->supplier_reference|htmlentitiesUTF8}" style="width: 130px; margin-right: 44px;" />
|
||||
<span class="hint" name="help_box">{l s='Special characters allowed:' } .-_#\<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tr-->
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='EAN13 or JAN:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
@@ -132,8 +132,6 @@
|
||||
<input size="55" type="text" name="location" value="{$product->location|htmlentitiesUTF8}" style="width: 130px; margin-right: 44px;" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
{* status informations *}
|
||||
<table cellpadding="5" style="width: 40%; float: left; margin-left: 10px;">
|
||||
@@ -141,7 +139,7 @@
|
||||
<td class="col-left"><label>{l s='Status:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input style="float:left;" onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="active" id="active_on" value="1" {if $product->active}checked="checked" {/if} />
|
||||
<label for="active_on" class="t"><img src="../img/admin/enabled.gif" alt="{l s='Enabled'}"
|
||||
<label for="active_on" class="t"><img src="../img/admin/enabled.gif" alt="{l s='Enabled'}"
|
||||
title="{l s='Enabled'}" style="float:left; padding:0px 5px 0px 5px;" />
|
||||
{l s='Enabled'}</label>
|
||||
<br class="clear" />
|
||||
@@ -171,7 +169,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#show_price').attr('disabled', '');
|
||||
$('#show_price').attr('disabled', '');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -210,7 +208,7 @@
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<!--tr>
|
||||
<td class="col-left"><label>{l s='Supplier:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<select name="id_supplier" id="id_supplier">
|
||||
@@ -224,7 +222,7 @@
|
||||
<img src="../img/admin/add.gif" alt="{l s='Create'}" title="{l s='Create'}" /> <b>{l s='Create'}</b>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tr-->
|
||||
</table>
|
||||
<div class="clear"></div>
|
||||
<table cellpadding="5" cellspacing="0" border="0" style="width: 100%;"><tr><td><div class="separation"></div></td></tr></table>
|
||||
@@ -341,7 +339,7 @@ function delPackItem(id)
|
||||
ids = ids.replace(/\,$/,'');
|
||||
return ids;
|
||||
}
|
||||
|
||||
|
||||
$(function() {
|
||||
$('#curPackItemName')
|
||||
.autocomplete('ajax_products_list.php', {
|
||||
@@ -451,7 +449,7 @@ $(document).ready(function(){
|
||||
<table cellpadding="5" style="width: 50%; float: left; margin-right: 20px; border-right: 1px solid #E0D0B1;">
|
||||
<tr><td>
|
||||
<br/>{l s='Does this product has an associated file ?'}<br />
|
||||
<input type="radio" value="1" id="virtual_good_file_1" name="is_virtual_file" {if $product_downloaded}checked="checked"{/if} />{l s='Yes'}
|
||||
<input type="radio" value="1" id="virtual_good_file_1" name="is_virtual_file" {if $product_downloaded}checked="checked"{/if} />{l s='Yes'}
|
||||
<input type="radio" value="0" id="virtual_good_file_2" name="is_virtual_file" {if !$product_downloaded}checked="checked"{/if} />{l s='No'}<br /><br />
|
||||
{if $download_product_file_missing}
|
||||
<p class="alert" id="file_missing">
|
||||
@@ -494,9 +492,9 @@ $(document).ready(function(){
|
||||
<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="{$product->productDownload->filename}" />
|
||||
{l s='This is the link'}: {$product->productDownload->getHtmlLink(false, true)}
|
||||
<a onclick="return confirm('{l s='Delete this file' slashes=1 js=1})')" href="{$currentIndex}&deleteVirtualProduct=true&token={$token}&id_product={$product->id}" class="red">{l s='Delete this file'}</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
|
||||
<p class="block">
|
||||
<label for="virtual_product_name" class="t">{l s='Filename'}</label>
|
||||
<input type="text" id="virtual_product_name" name="virtual_product_name" style="width:200px" value="{$product->productDownload->display_filename|htmlentitiesUTF8}" />
|
||||
@@ -586,7 +584,7 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td colspan="2" style="padding-bottom:5px;"><div class="separation"></div></td>
|
||||
</tr>
|
||||
|
||||
|
||||
{* @todo : prices related has to be moved in price subtab *}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Pre-tax wholesale price:'}</label></td>
|
||||
@@ -619,7 +617,7 @@ $(document).ready(function(){
|
||||
{/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>
|
||||
@@ -658,10 +656,10 @@ $(document).ready(function(){
|
||||
<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}
|
||||
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'}
|
||||
<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>
|
||||
@@ -697,7 +695,7 @@ $(document).ready(function(){
|
||||
</tr>
|
||||
{* [end] prices *}
|
||||
|
||||
|
||||
|
||||
<tr><td colspan="2" style="padding-bottom:5px;"><div class="separation"></div></td></tr>
|
||||
{if !$ps_stock_management}
|
||||
<tr>
|
||||
@@ -716,7 +714,7 @@ $(document).ready(function(){
|
||||
<tr><td colspan="2" style="padding-bottom:5px;"><div class="separation"></div></td></tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Additional shipping cost:'}</label></td>
|
||||
<td style="padding-bottom:5px;">{$currency->prefix}<input type="text" name="additional_shipping_cost"
|
||||
<td style="padding-bottom:5px;">{$currency->prefix}<input type="text" name="additional_shipping_cost"
|
||||
value="{$product->additional_shipping_cost}" />{$currency->suffix}
|
||||
{if $country_display_tax_label}{l s='tax excl.'}{/if}
|
||||
<p>{l s='Carrier tax will be applied.'}</p>
|
||||
@@ -725,9 +723,9 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when in-stock:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_now
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_now
|
||||
input_name='available_now'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
@@ -735,15 +733,15 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when allowed to be back-ordered:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_later
|
||||
input_name='available_later'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
{if $countAttributes}
|
||||
|
||||
|
||||
{* .(($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $language['id_lang']))) : '0000-00-00').'" *}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Available date:'}</label></td>
|
||||
@@ -760,13 +758,13 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='When out of stock:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input type="radio" name="out_of_stock" id="out_of_stock_1" value="0" {if $product->out_of_stock == 0}checked="checked"{/if} />
|
||||
<input type="radio" name="out_of_stock" id="out_of_stock_1" value="0" {if $product->out_of_stock == 0}checked="checked"{/if} />
|
||||
<label for="out_of_stock_1" class="t" id="label_out_of_stock_1">{l s='Deny orders'}</label>
|
||||
<br /><input type="radio" name="out_of_stock" id="out_of_stock_2" value="1" {if $product->out_of_stock == 1}checked="checked"{/if} />
|
||||
<br /><input type="radio" name="out_of_stock" id="out_of_stock_2" value="1" {if $product->out_of_stock == 1}checked="checked"{/if} />
|
||||
<label for="out_of_stock_2" class="t" id="label_out_of_stock_2">{l s='Allow orders'}</label>
|
||||
<br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" {if $product->out_of_stock == 2}checked="checked"{/if} />
|
||||
<label for="out_of_stock_3" class="t" id="label_out_of_stock_3">{l s='Default:'}
|
||||
<i>{if $ps_order_out_of_stock}{l s='Allow orders'}{else}{l s='Deny orders'}{/if}</i> ({l s='as set in'} <a href="{$link->getAdminLink('AdminPPreferences')}"
|
||||
<br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" {if $product->out_of_stock == 2}checked="checked"{/if} />
|
||||
<label for="out_of_stock_3" class="t" id="label_out_of_stock_3">{l s='Default:'}
|
||||
<i>{if $ps_order_out_of_stock}{l s='Allow orders'}{else}{l s='Deny orders'}{/if}</i> ({l s='as set in'} <a href="{$link->getAdminLink('AdminPPreferences')}"
|
||||
onclick="return confirm(\'{l s='Are you sure you want to delete entered product information?'}')">{l s='Preferences'}</a>)</label>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -775,7 +773,7 @@ $(document).ready(function(){
|
||||
<div class="separation"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-left"><label for="id_category_default" class="t">
|
||||
{l s='Default category:'}
|
||||
@@ -805,9 +803,9 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Meta title:'}</label></td>
|
||||
<td>
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_name='meta_title'
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_name='meta_title'
|
||||
input_value=$product->meta_title}
|
||||
<p class="clear">{l s='Product page title; leave blank to use product name'}</p>
|
||||
</td>
|
||||
@@ -815,9 +813,9 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Meta description:'}</label></td>
|
||||
<td>
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_name='meta_description'
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_name='meta_description'
|
||||
input_value=$product->meta_description
|
||||
input_hint='{l s=\'Forbidden characters:\'\} <>;=#{\}'
|
||||
}
|
||||
@@ -827,7 +825,7 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Meta keywords:'}</label></td>
|
||||
<td>
|
||||
{include file="products/input_text_lang.tpl" languages=$languages
|
||||
{include file="products/input_text_lang.tpl" languages=$languages
|
||||
input_value=$product->meta_keywords
|
||||
input_name='meta_keywords'}
|
||||
<p class="clear">{l s='Keywords for HTML header, separated by a comma'}</p>
|
||||
@@ -836,15 +834,15 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Friendly URL:'}</label></td>
|
||||
<td>
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->link_rewrite
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->link_rewrite
|
||||
input_name='link_rewrite'}
|
||||
|
||||
<p class="clear" style="padding:10px 0 0 0">
|
||||
<a style="cursor:pointer" class="button"
|
||||
<a style="cursor:pointer" class="button"
|
||||
onmousedown="updateFriendlyURLByName();">{l s='Generate'}</a> {l s='Friendly-url from product\'s name.'}<br /><br />
|
||||
{l s='Product link will look like this:'}
|
||||
{l s='Product link will look like this:'}
|
||||
{if $ps_ssl_enabled}https://{else}http://{/if}{*$smarty.server.SERVER_NAME*}/<b>id_product</b>-<span id="friendly-url"></span>.html</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -855,8 +853,8 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Short description:'}<br /><br /><i>({l s='appears in the product lists and on the top of the product page'})</i></label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="products/textarea_lang.tpl"
|
||||
languages=$languages
|
||||
{include file="products/textarea_lang.tpl"
|
||||
languages=$languages
|
||||
input_name='description_short'
|
||||
input_value=$product->description_short}
|
||||
|
||||
@@ -865,8 +863,8 @@ $(document).ready(function(){
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Description:'}<br /><br /><i>({l s='appears in the body of the product page'})</i></label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="products/textarea_lang.tpl" languages=$languages
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="products/textarea_lang.tpl" languages=$languages
|
||||
input_name='description'
|
||||
input_value=$product->description
|
||||
}
|
||||
@@ -875,7 +873,7 @@ $(document).ready(function(){
|
||||
</tr>
|
||||
|
||||
{if $images}
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-left"><label></label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
@@ -921,11 +919,11 @@ $(document).ready(function(){
|
||||
<label for="imageTypes_{$key}" class="t">{$type.name} <span>({$type.width}px par {$type.height}px)</span></label>
|
||||
<br />
|
||||
{/foreach}
|
||||
|
||||
|
||||
<p class="clear"></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Image tag to insert:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
@@ -938,7 +936,7 @@ $(document).ready(function(){
|
||||
<p class="clear"></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
changeTagImage();
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
<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"}');
|
||||
}
|
||||
});
|
||||
};
|
||||
var refreshQtyAvaibilityForm = function()
|
||||
{
|
||||
if ($('#depends_on_stock_0').attr('checked'))
|
||||
{
|
||||
$('.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).attr('value') } );
|
||||
if($(this).val() == 0)
|
||||
$('.available_quantity input').trigger('change');
|
||||
});
|
||||
$('.available_quantity').find('input').change(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())
|
||||
{
|
||||
window.clearInterval(it.intervalId);
|
||||
$(it).trigger('change');
|
||||
$(it).trigger('click');
|
||||
}
|
||||
}, 500, this, $(this).val())
|
||||
});
|
||||
$('.out_of_stock').click(function(e)
|
||||
{
|
||||
ajaxCall( { actionQty: 'out_of_stock', value: $(this).val() } );
|
||||
});
|
||||
refreshQtyAvaibilityForm();
|
||||
</script>
|
||||
|
||||
<div class="tab-page" id="step8">
|
||||
<h4 class="tab">8. {l s='Quantities'}</h4>
|
||||
<table cellpadding="5">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b>{l s='Available stock in warehouses'}</b>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="separation"></div>
|
||||
<p>{l s='There is %s quantities available in stock for this product'|sprintf:$total_quantity}</p>
|
||||
<table cellpadding="5" style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" style="text-align:center;vertical-align:top;">
|
||||
<table class="table" cellpadding="0" cellspacing="0" style="width:60%;margin-left:20%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Quantity'}</th>
|
||||
<th>{l s='Designation'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$attributes item=attribute}
|
||||
<tr>
|
||||
<td>{$physical_quantity[$attribute['id_product_attribute']]}</td>
|
||||
<td>{$product_designation[$attribute['id_product_attribute']]}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<table cellpadding="5">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b>{l s='Available quantities for sale'}</b>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="separation"></div>
|
||||
<div class="warn" id="available_quantity_ajax_msg" style="display: none;"></div>
|
||||
<div class="error" id="available_quantity_ajax_error_msg" style="display: none;"></div>
|
||||
<div class="conf" id="available_quantity_ajax_success_msg" style="display: none;"></div>
|
||||
|
||||
<table cellpadding="5" style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" style="vertical-align:top;">
|
||||
<input {if $product->depends_on_stock == 1}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/>
|
||||
<label style="float:none;font-weight:normal" for="depends_on_stock_1">{l s='Available quantities for current product and its combinations are based on stock in the warehouses'}</label>
|
||||
<br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="vertical-align:top;">
|
||||
<input {if $product->depends_on_stock == 0}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/>
|
||||
<label style="float:none;font-weight:normal" for="depends_on_stock_0">{l s='I want to specify available quantities manually, and manage my stock independently'}</label>
|
||||
<br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="text-align:center;vertical-align:top;">
|
||||
<table class="table" cellpadding="0" cellspacing="0" style="width:60%;margin-left:20%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:200px;">{l s='Quantity'}</th>
|
||||
<th>{l s='Designation'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$attributes item=attribute}
|
||||
<tr>
|
||||
<td class="available_quantity" id="qty_{$attribute['id_product_attribute']}">
|
||||
<span>{$available_quantity[$attribute['id_product_attribute']]}</span>
|
||||
<input type="text" value="{$available_quantity[$attribute['id_product_attribute']]}"/>
|
||||
</td>
|
||||
<td>{$product_designation[$attribute['id_product_attribute']]}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="when_out_of_stock">
|
||||
<td>
|
||||
<table style="margin-top: 15px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='When out of stock:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input {if $product->out_of_stock == 0}checked="checked" {/if} id="out_of_stock_1" type="radio" checked="checked" value="0" class="out_of_stock" name="out_of_stock">
|
||||
<label id="label_out_of_stock_1" class="t" for="out_of_stock_1">{l s='Deny orders'}</label>
|
||||
<br>
|
||||
<input {if $product->out_of_stock == 1} 'checked="checked" {/if} id="out_of_stock_2" type="radio" value="1" class="out_of_stock" name="out_of_stock">
|
||||
<label id="label_out_of_stock_2" class="t" for="out_of_stock_2">{l s='Allow orders'}</label>
|
||||
<br>
|
||||
<input {if $product->out_of_stock == 2} 'checked="checked" {/if} id="out_of_stock_3" type="radio" value="2" class="out_of_stock" name="out_of_stock">
|
||||
<label id="label_out_of_stock_3" class="t" for="out_of_stock_3">
|
||||
Default:
|
||||
<i>Deny orders</i>
|
||||
{assign var=confirm value="Are you sure you want to delete entered product information?"}
|
||||
<a onclick="return confirm(' {$confirm} ');"
|
||||
href="index.php?tab=AdminPPreferences&token={$token_preferences}">
|
||||
{l s='as set in Preferences'}
|
||||
</a>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,95 @@
|
||||
<table cellpadding="5">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b>{l s='Suppliers of the current product'}</b>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="separation"></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 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'}" /> <b>{l s='Create new supplier'}</b>
|
||||
</a>
|
||||
<table cellpadding="5" style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" style="text-align:center;vertical-align:top;">
|
||||
<table class="table" cellpadding="0" cellspacing="0" style="width:60%;margin-left:20%;">
|
||||
<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>
|
||||
<div class="margin-form">
|
||||
<input type="submit" class="button" name="submitSuppliers" value="{l s='Update suppliers of this product'}"/>
|
||||
</div>
|
||||
<br />
|
||||
<table cellpadding="5">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b>{l s='Product reference(s)'}</b>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="separation"></div>
|
||||
<p>{l s='You can specify product reference(s) for each supplier associated.'}</p>
|
||||
<table cellpadding="5" style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" style="text-align:center;vertical-align:top;">
|
||||
<table class="table" cellpadding="0" cellspacing="0" style="min-width:80%;margin-left:10%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Product Name'}</th>
|
||||
{foreach from=$associated_suppliers item=supplier}
|
||||
<th>{$supplier->name}</th>
|
||||
{/foreach}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$attributes item=attribute}
|
||||
<tr>
|
||||
<td>{$product_designation[$attribute['id_product_attribute']]}</td>
|
||||
{foreach from=$associated_suppliers item=supplier}
|
||||
{assign var=reference 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}
|
||||
{/if}
|
||||
{/foreach}
|
||||
<td>
|
||||
<input type="text" size="10" value="{$reference}" name="supplier_reference_{$attribute['id_product']}_{$attribute['id_product_attribute']}_{$supplier->id_supplier}" />
|
||||
</td>
|
||||
{/foreach}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="margin-form">
|
||||
<input type="submit" class="button" name="submitSupplierReferences" value="{l s='Update supplier reference(s)'}"/>
|
||||
</div>
|
||||
@@ -1,5 +1,5 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -34,24 +34,24 @@
|
||||
{foreach $products AS $product}
|
||||
<hr />
|
||||
{if !$product->hasAttributes()}
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:990px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:80%;margin-left:10%;">
|
||||
<tr>
|
||||
<th>{$product->name}</th>
|
||||
{if !empty($product->reference)}<th width="150">{l s='Ref:'} {$product->reference}</th>{/if}
|
||||
{if !empty($product->ean13)}<th width="120">{l s='EAN13:'} {$product->ean13}</th>{/if}
|
||||
{if !empty($product->upc)}<th width="120">{l s='UPC:'} {$product->upc}</th>{/if}
|
||||
{if $stock_management}<th class="right" width="50">{l s='Qty:'} {$product->quantity}</th>{/if}
|
||||
{if $stock_management}<th class="right" width="150">{l s='Available Quantity:'} {$product->quantity}</th>{/if}
|
||||
</tr>
|
||||
</table>
|
||||
{else}
|
||||
<h3><a href="?tab=AdminProducts&id_product={$product->id}&updateproduct&token={getAdminToken tab='AdminProducts'}">{$product->name}</a></h3>
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:990px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:80%;margin-left:10%;">
|
||||
<tr>
|
||||
<th>{l s='Attribute name'}</th>
|
||||
<th width="80">{l s='Reference'}</th>
|
||||
<th width="80">{l s='EAN13'}</th>
|
||||
<th width="80">{l s='UPC'}</th>
|
||||
{if $stock_management}<th class="right" width="40">{l s='Quantity'}</th>{/if}
|
||||
{if $stock_management}<th class="right" width="150">{l s='Available Quantity'}</th>{/if}
|
||||
</tr>
|
||||
{foreach $product->combinaison AS $id_product_attribute => $product_attribute}
|
||||
<tr {if $id_product_attribute %2}class="alt_row"{/if} >
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
</fieldset>
|
||||
|
||||
<script language="javascript">
|
||||
<script type="text/javascript">
|
||||
product_infos = null;
|
||||
debug = null;
|
||||
if ($('#product_ids').val() == '')
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
var id = $(this).attr('id');
|
||||
var product_id = id.split('|')[1];
|
||||
|
||||
|
||||
|
||||
//find the position of the product id in product_id array
|
||||
var position = product_ids.indexOf(product_id);
|
||||
@@ -182,11 +182,11 @@
|
||||
{
|
||||
//remove the id from the array
|
||||
product_ids.splice(position, 1);
|
||||
|
||||
|
||||
var input_id = $('input[name~="input_id_'+product_id+'"]');
|
||||
if (input_id.length > 0)
|
||||
product_ids_to_delete.push(product_id);
|
||||
|
||||
|
||||
// update the product_ids hidden field
|
||||
$('#product_ids').val(product_ids.join('|'));
|
||||
$('#product_ids_to_delete').val(product_ids_to_delete.join('|'));
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
<td>{l s='Creation date:'}</td>
|
||||
<td>{$supply_order_creation_date}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{l s='Supplier:'}</td>
|
||||
<td>{$supply_order_supplier_name}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{l s='Last update:'}</td>
|
||||
<td>{$supply_order_last_update}</td>
|
||||
|
||||
+212
-84
@@ -319,7 +319,7 @@ class ProductCore extends ObjectModel
|
||||
self::$_tax_rules_group[$this->id] = $this->id_tax_rules_group;
|
||||
|
||||
$address = null;
|
||||
if (is_object($context->cart) AND $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')} != null)
|
||||
if (is_object($context->cart) && $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')} != null)
|
||||
$address = $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
|
||||
|
||||
$this->tax_rate = $this->getTaxesRate(new Address($address));
|
||||
@@ -479,7 +479,7 @@ class ProductCore extends ObjectModel
|
||||
? '> '.(int)$movedProduct['position'].' AND `position` <= '.(int)$position
|
||||
: '< '.(int)$movedProduct['position'].' AND `position` >= '.(int)$position).'
|
||||
AND `id_category`='.(int)$movedProduct['id_category'])
|
||||
AND Db::getInstance()->execute('
|
||||
&& Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'category_product`
|
||||
SET `position` = '.(int)$position.'
|
||||
WHERE `id_product` = '.(int)$movedProduct['id_product'].'
|
||||
@@ -602,7 +602,7 @@ class ProductCore extends ObjectModel
|
||||
if ($real_quantity > $physical_quantity)
|
||||
return false;
|
||||
|
||||
/**
|
||||
/*
|
||||
* @since 1.5.0
|
||||
* Removes the product from StockAvailable, for the current shop
|
||||
*/
|
||||
@@ -772,7 +772,7 @@ class ProductCore extends ObjectModel
|
||||
public function deleteTags()
|
||||
{
|
||||
return (Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_tag` WHERE `id_product` = '.(int)$this->id)
|
||||
AND Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'tag` WHERE `id_tag` NOT IN (SELECT `id_tag` FROM `'._DB_PREFIX_.'product_tag`)'));
|
||||
&& Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'tag` WHERE `id_tag` NOT IN (SELECT `id_tag` FROM `'._DB_PREFIX_.'product_tag`)'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -831,9 +831,9 @@ class ProductCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay))
|
||||
if (!Validate::isOrderBy($orderBy) || !Validate::isOrderWay($orderWay))
|
||||
die (Tools::displayError());
|
||||
if ($orderBy == 'id_product' OR $orderBy == 'price' OR $orderBy == 'date_add')
|
||||
if ($orderBy == 'id_product' || $orderBy == 'price' || $orderBy == 'date_add')
|
||||
$orderByPrefix = 'p';
|
||||
else if ($orderBy == 'name')
|
||||
$orderByPrefix = 'pl';
|
||||
@@ -897,7 +897,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
||||
WHERE pa.`id_product` = '.(int)($this->id));
|
||||
/* If something's wrong */
|
||||
if (!$result OR empty($result))
|
||||
if (!$result || empty($result))
|
||||
return false;
|
||||
/* Product attributes simulation */
|
||||
$productAttributes = array();
|
||||
@@ -908,8 +908,8 @@ class ProductCore extends ObjectModel
|
||||
if (count($productAttribute) == count($attributesList))
|
||||
{
|
||||
$diff = false;
|
||||
for ($i = 0; $diff == false AND isset($productAttribute[$i]); $i++)
|
||||
if (!in_array($productAttribute[$i], $attributesList) OR $key == $currentProductAttribute)
|
||||
for ($i = 0; $diff == false && isset($productAttribute[$i]); $i++)
|
||||
if (!in_array($productAttribute[$i], $attributesList) || $key == $currentProductAttribute)
|
||||
$diff = true;
|
||||
if (!$diff)
|
||||
return true;
|
||||
@@ -920,22 +920,67 @@ class ProductCore extends ObjectModel
|
||||
/**
|
||||
* addProductAttribute is deprecated
|
||||
*
|
||||
* The quantity params is now ignored
|
||||
* The quantity params now set StockAvailable for the current shop with the specified quantity
|
||||
* The supplier_reference params now set the supplier reference of the default supplier of the product if possible
|
||||
*
|
||||
* @see StockManager if you want to manage real stock
|
||||
* @see StockAvailable if you want to manage available quantities for sale on your shop(s)
|
||||
* @see ProductSupplier for manage supplier reference(s)
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function addProductAttribute($price, $weight, $unit_impact, $ecotax, $quantity, $id_images, $reference, $supplier_reference, $ean13, $default, $location = NULL, $upc = NULL)
|
||||
public function addProductAttribute($price, $weight, $unit_impact, $ecotax, $quantity, $id_images, $reference,
|
||||
$supplier_reference = null, $ean13, $default, $location = null, $upc = null)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
$id_product_attribute = $this->addAttribute($price, $weight, $unit_impact, $ecotax, $id_images, $reference, $supplier_reference, $ean13, $default, $location, $upc);
|
||||
$id_product_attribute = $this->addAttribute(
|
||||
$price, $weight, $unit_impact, $ecotax, $id_images,
|
||||
$reference, $ean13, $default, $location, $upc
|
||||
);
|
||||
|
||||
if (!$id_product_attribute)
|
||||
return false;
|
||||
|
||||
//Try to set available quantitiy if product quantity not depend on stock
|
||||
$depend_on_stock = $this->getDependsOnStock();
|
||||
|
||||
if (!$depend_on_stock)
|
||||
if (!StockAvailable::updateQuantity($this->id, $id_product_attribute, $quantity))
|
||||
{
|
||||
$stock_available = new StockAvailable();
|
||||
$stock_available->id_product = (int)$this->id;
|
||||
$stock_available->id_product_attribute = (int)$id_product_attribute;
|
||||
$stock_available->id_shop = (int)$context->shop->getID();
|
||||
$stock_available->quantity = (int)$quantity;
|
||||
$stock_available->out_of_stock = $this->getOutOfStock();
|
||||
$stock_available->depends_on_stock = 0;
|
||||
$stock_available->save();
|
||||
}
|
||||
|
||||
//Try to set the default supplier reference
|
||||
if ($this->id_supplier > 0 && $supplier_reference != null)
|
||||
{
|
||||
$id_product_supplier = ProductSupplier::getIdByProductAndSupplier($this->id, $id_product_attribute, $this->id_supplier);
|
||||
|
||||
if (empty($id_product_supplier))
|
||||
{
|
||||
//create new record
|
||||
$product_supplier_entity = new ProductSupplier();
|
||||
$product_supplier_entity->id_product = $this->id;
|
||||
$product_supplier_entity->id_product_attribute = $id_product_attribute;
|
||||
$product_supplier_entity->id_supplier = $this->id_supplier;
|
||||
$product_supplier_entity->product_supplier_reference = pSQL($supplier_reference);
|
||||
$product_supplier_entity->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
$product_supplier = new ProductSupplier($id_product_supplier);
|
||||
$product_supplier->product_supplier_reference = pSql($supplier_reference);
|
||||
$product_supplier->update();
|
||||
}
|
||||
}
|
||||
|
||||
return $id_product_attribute;
|
||||
}
|
||||
|
||||
@@ -948,13 +993,12 @@ class ProductCore extends ObjectModel
|
||||
* @param float $ecotax Additional ecotax
|
||||
* @param integer $id_images Image ids
|
||||
* @param string $reference Reference
|
||||
* @param string $supplier_reference Supplier Reference
|
||||
* @param string $location Location
|
||||
* @param string $ean13 Ean-13 barcode
|
||||
* @param boolean $default Is default attribute for product
|
||||
* @return mixed $id_product_attribute or false
|
||||
*/
|
||||
public function addAttribute($price, $weight, $unit_impact, $ecotax, $id_images, $reference, $supplier_reference, $ean13, $default, $location = null, $upc = null)
|
||||
public function addAttribute($price, $weight, $unit_impact, $ecotax, $id_images, $reference, $ean13, $default, $location = null, $upc = null)
|
||||
{
|
||||
if (!$this->id)
|
||||
return;
|
||||
@@ -970,7 +1014,6 @@ class ProductCore extends ObjectModel
|
||||
'weight' => ($weight ? (float)$weight : 0),
|
||||
'unit_price_impact' => ($unit_impact ? (float)$unit_impact : 0),
|
||||
'reference' => pSQL($reference),
|
||||
'supplier_reference' => pSQL($supplier_reference),
|
||||
'location' => pSQL($location),
|
||||
'ean13' => pSQL($ean13),
|
||||
'upc' => pSQL($upc),
|
||||
@@ -984,22 +1027,37 @@ class ProductCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
if (empty($id_images))
|
||||
return (int)($id_product_attribute);
|
||||
return (int)$id_product_attribute;
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'product_attribute_image` (`id_product_attribute`, `id_image`) VALUES ';
|
||||
foreach ($id_images as $id_image)
|
||||
$query .= '('.(int)($id_product_attribute).', '.(int)($id_image).'), ';
|
||||
$query .= '('.(int)$id_product_attribute.', '.(int)$id_image.'), ';
|
||||
$query = trim($query, ', ');
|
||||
if (!Db::getInstance()->execute($query))
|
||||
return false;
|
||||
return (int)($id_product_attribute);
|
||||
return (int)$id_product_attribute;
|
||||
}
|
||||
|
||||
public function addCombinationEntity($wholesale_price, $price, $weight, $unit_impact, $ecotax, $quantity, $id_images, $reference, $supplier_reference, $ean13, $default, $location = NULL, $upc = NULL)
|
||||
/**
|
||||
* @param integer $quantity DEPRECATED
|
||||
* @param string $supplier_reference DEPRECATED
|
||||
*/
|
||||
public function addCombinationEntity($wholesale_price, $price, $weight, $unit_impact, $ecotax, $quantity,
|
||||
$id_images, $reference, $supplier_reference, $ean13, $default, $location = null, $upc = null)
|
||||
{
|
||||
$id_product_attribute = $this->addAttribute($price, $weight, $unit_impact, $ecotax, $id_images, $reference, $supplier_reference, $ean13, $default, $location, $upc);
|
||||
$result = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'product_attribute` SET `wholesale_price` = '.(float)$wholesale_price.' WHERE `id_product_attribute` = '.(int)$id_product_attribute);
|
||||
if (!$id_product_attribute OR !$result)
|
||||
$id_product_attribute = $this->addProductAttribute(
|
||||
$price, $weight, $unit_impact, $ecotax, $quantity, $id_images,
|
||||
$reference, $supplier_reference, $ean13, $default, $location, $upc
|
||||
);
|
||||
|
||||
$result = Db::getInstance()->execute(
|
||||
'UPDATE `'._DB_PREFIX_.'product_attribute`
|
||||
SET `wholesale_price` = '.(float)$wholesale_price.'
|
||||
WHERE `id_product_attribute` = '.(int)$id_product_attribute
|
||||
);
|
||||
|
||||
if (!$id_product_attribute || !$result)
|
||||
return false;
|
||||
|
||||
return $id_product_attribute;
|
||||
}
|
||||
|
||||
@@ -1067,56 +1125,118 @@ class ProductCore extends ObjectModel
|
||||
WHERE `id_product` = '.(int)$this->id.' LIMIT 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a product attribute
|
||||
*
|
||||
* @deprecated since 1.5
|
||||
* @see updateAttribute() to use instead
|
||||
* @see ProductSupplier for manage supplier reference(s)
|
||||
*
|
||||
*/
|
||||
public function updateProductAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax,
|
||||
$id_images, $reference, $supplier_reference = null, $ean13, $default, $location = null, $upc = null, $minimal_quantity, $available_date)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
$return = $this->updateAttribute(
|
||||
$id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax,
|
||||
$id_images, $reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity, $available_date
|
||||
);
|
||||
|
||||
//Try to set the default supplier reference
|
||||
if ($this->id_supplier > 0 && $supplier_reference != null)
|
||||
{
|
||||
$id_product_supplier = ProductSupplier::getIdByProductAndSupplier($this->id, $id_product_attribute, $this->id_supplier);
|
||||
|
||||
if (empty($id_product_supplier))
|
||||
{
|
||||
//create new record
|
||||
$product_supplier_entity = new ProductSupplier();
|
||||
$product_supplier_entity->id_product = $this->id;
|
||||
$product_supplier_entity->id_product_attribute = $id_product_attribute;
|
||||
$product_supplier_entity->id_supplier = $this->id_supplier;
|
||||
$product_supplier_entity->product_supplier_reference = pSQL($supplier_reference);
|
||||
$product_supplier_entity->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
$product_supplier = new ProductSupplier($id_product_supplier);
|
||||
$product_supplier->product_supplier_reference = pSql($supplier_reference);
|
||||
$product_supplier->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a product attribute
|
||||
*
|
||||
* @param integer $id_product_attribute Product attribute id
|
||||
* @param float $wholesale_price Wholesale price
|
||||
* @param float $price Additional price
|
||||
* @param float $weight Additional weight
|
||||
* @param float $unit
|
||||
* @param float $ecotax Additional ecotax
|
||||
* @param integer $quantity Quantity available
|
||||
* @param integer $id_image Image id
|
||||
* @param string $reference Reference
|
||||
* @param string $ean13 Ean-13 barcode
|
||||
* @param int $default Default On
|
||||
* @param string $upc Upc barcode
|
||||
* @param string $minimal_quantity Minimal quantity
|
||||
* @return array Update result
|
||||
*/
|
||||
public function updateProductAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax, $id_images, $reference, $supplier_reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity, $available_date)
|
||||
public function updateAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax,
|
||||
$id_images, $reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity, $available_date)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `id_product_attribute` = '.(int)($id_product_attribute));
|
||||
WHERE `id_product_attribute` = '.(int)$id_product_attribute);
|
||||
|
||||
$price = str_replace(',', '.', $price);
|
||||
$weight = str_replace(',', '.', $weight);
|
||||
$data = array(
|
||||
'wholesale_price' => (float)($wholesale_price),
|
||||
'price' => (float)($price),
|
||||
'ecotax' => (float)($ecotax),
|
||||
'weight' => ($weight ? (float)($weight) : 0),
|
||||
'unit_price_impact' => ($unit ? (float)($unit) : 0),
|
||||
'wholesale_price' => (float)$wholesale_price,
|
||||
'price' => (float)$price,
|
||||
'ecotax' => (float)$ecotax,
|
||||
'weight' => ($weight ? (float)$weight : 0),
|
||||
'unit_price_impact' => ($unit ? (float)$unit : 0),
|
||||
'reference' => pSQL($reference),
|
||||
'supplier_reference' => pSQL($supplier_reference),
|
||||
'location' => pSQL($location),
|
||||
'ean13' => pSQL($ean13),
|
||||
'upc' => pSQL($upc),
|
||||
'default_on' => (int)($default),
|
||||
'minimal_quantity' => (int)($minimal_quantity),
|
||||
'default_on' => (int)$default,
|
||||
'minimal_quantity' => (int)$minimal_quantity,
|
||||
'available_date' => pSQL($available_date)
|
||||
);
|
||||
|
||||
if (!Db::getInstance()->AutoExecute(_DB_PREFIX_.'product_attribute', $data, 'UPDATE', '`id_product_attribute` = '.(int)($id_product_attribute)) OR !Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_attribute_image` WHERE `id_product_attribute` = '.(int)($id_product_attribute)))
|
||||
$res1 = Db::getInstance()->AutoExecute(
|
||||
_DB_PREFIX_.'product_attribute',
|
||||
$data,
|
||||
'UPDATE',
|
||||
'`id_product_attribute` = '.(int)$id_product_attribute
|
||||
);
|
||||
|
||||
$res2 = Db::getInstance()->execute(
|
||||
'DELETE FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||
WHERE `id_product_attribute` = '.(int)$id_product_attribute
|
||||
);
|
||||
|
||||
if (!$res1 || !$res2)
|
||||
return false;
|
||||
if ($quantity)
|
||||
|
||||
//if ($quantity)
|
||||
Hook::exec('updateProductAttribute', array('id_product_attribute' => $id_product_attribute));
|
||||
|
||||
Product::updateDefaultAttribute($this->id);
|
||||
|
||||
if (empty($id_images))
|
||||
return true;
|
||||
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'product_attribute_image` (`id_product_attribute`, `id_image`) VALUES ';
|
||||
|
||||
foreach ($id_images as $id_image)
|
||||
$query .= '('.(int)($id_product_attribute).', '.(int)($id_image).'), ';
|
||||
$query .= '('.(int)$id_product_attribute.', '.(int)$id_image.'), ';
|
||||
$query = trim($query, ', ');
|
||||
|
||||
return Db::getInstance()->execute($query);
|
||||
}
|
||||
|
||||
@@ -1133,9 +1253,9 @@ class ProductCore extends ObjectModel
|
||||
(
|
||||
SELECT SUM(`quantity`)
|
||||
FROM `'._DB_PREFIX_.'product_attribute`
|
||||
WHERE `id_product` = '.(int)($this->id).'
|
||||
WHERE `id_product` = '.(int)$this->id.'
|
||||
), \'0\')
|
||||
WHERE `id_product` = '.(int)($this->id));
|
||||
WHERE `id_product` = '.(int)$this->id);
|
||||
}
|
||||
/**
|
||||
* Delete product attributes
|
||||
@@ -1286,7 +1406,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteAttributeCombinaison($id_product_attribute)
|
||||
{
|
||||
if (!$this->id || !$id_product_attribute OR !is_numeric($id_product_attribute))
|
||||
if (!$this->id || !$id_product_attribute || !is_numeric($id_product_attribute))
|
||||
return false;
|
||||
|
||||
Hook::exec('deleteProductAttribute', array('id_product_attribute' => $id_product_attribute, 'id_product' => $this->id, 'deleteAllAttributes' => false));
|
||||
@@ -1303,7 +1423,7 @@ class ProductCore extends ObjectModel
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'cart_product`
|
||||
WHERE `id_product_attribute` = '.$id_product_attribute;
|
||||
$result3 = Db::getInstance()->execute($sql);
|
||||
return ($result AND $result2 AND $result3);
|
||||
return ($result && $result2 && $result3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1320,7 +1440,8 @@ class ProductCore extends ObjectModel
|
||||
WHERE `id_product` = '.(int)($this->id));
|
||||
foreach ($features as $tab)
|
||||
// Delete product custom features
|
||||
if ($tab['custom']) {
|
||||
if ($tab['custom'])
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'feature_value`
|
||||
WHERE `id_feature_value` = '.(int)($tab['id_feature_value']));
|
||||
@@ -1435,11 +1556,11 @@ class ProductCore extends ObjectModel
|
||||
if ($nbProducts < 1) $nbProducts = 10;
|
||||
if (empty($orderBy) || $orderBy == 'position') $orderBy = 'date_add';
|
||||
if (empty($orderWay)) $orderWay = 'DESC';
|
||||
if ($orderBy == 'id_product' OR $orderBy == 'price' OR $orderBy == 'date_add')
|
||||
if ($orderBy == 'id_product' || $orderBy == 'price' || $orderBy == 'date_add')
|
||||
$orderByPrefix = 'p';
|
||||
else if ($orderBy == 'name')
|
||||
$orderByPrefix = 'pl';
|
||||
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay))
|
||||
if (!Validate::isOrderBy($orderBy) || !Validate::isOrderWay($orderWay))
|
||||
die(Tools::displayError());
|
||||
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
@@ -1557,8 +1678,9 @@ class ProductCore extends ObjectModel
|
||||
if (!$id_product)
|
||||
return false;
|
||||
|
||||
$sql = 'SELECT p.*, sa.out_of_stock, sa.out_of_stock out_of_stock, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`,
|
||||
i.`id_image`, il.`legend`, t.`rate`
|
||||
$sql = 'SELECT p.*, sa.out_of_stock, sa.out_of_stock out_of_stock, pl.`description`, pl.`description_short`,
|
||||
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
|
||||
p.`ean13`, p.`upc`, i.`id_image`, il.`legend`, t.`rate`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
@@ -1593,11 +1715,11 @@ class ProductCore extends ObjectModel
|
||||
if ($nbProducts < 1) $nbProducts = 10;
|
||||
if (empty($orderBy) || $orderBy == 'position') $orderBy = 'price';
|
||||
if (empty($orderWay)) $orderWay = 'DESC';
|
||||
if ($orderBy == 'id_product' OR $orderBy == 'price' OR $orderBy == 'date_add')
|
||||
if ($orderBy == 'id_product' || $orderBy == 'price' || $orderBy == 'date_add')
|
||||
$orderByPrefix = 'p';
|
||||
else if ($orderBy == 'name')
|
||||
$orderByPrefix = 'pl';
|
||||
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay))
|
||||
if (!Validate::isOrderBy($orderBy) || !Validate::isOrderWay($orderWay))
|
||||
die (Tools::displayError());
|
||||
$currentDate = date('Y-m-d H:i:s');
|
||||
$ids_product = self::_getProductIdByDate((!$beginning ? $currentDate : $beginning), (!$ending ? $currentDate : $ending), $context);
|
||||
@@ -1612,7 +1734,7 @@ class ProductCore extends ObjectModel
|
||||
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||
WHERE p.`active` = 1
|
||||
AND p.`show_price` = 1
|
||||
'.((!$beginning AND !$ending) ? ' AND p.`id_product` IN('.((is_array($ids_product) AND count($ids_product)) ? implode(', ', array_map('intval', $ids_product)) : 0).')' : '').'
|
||||
'.((!$beginning && !$ending) ? ' AND p.`id_product` IN('.((is_array($ids_product) && count($ids_product)) ? implode(', ', array_map('intval', $ids_product)) : 0).')' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -1640,7 +1762,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.`id_product` = p.`id_product` AND sa.id_product_attribute = 0)
|
||||
WHERE p.`active` = 1
|
||||
AND p.`show_price` = 1
|
||||
'.((!$beginning AND !$ending) ? ' AND p.`id_product` IN ('.((is_array($ids_product) AND count($ids_product)) ? implode(', ', $ids_product) : 0).')' : '').'
|
||||
'.((!$beginning && !$ending) ? ' AND p.`id_product` IN ('.((is_array($ids_product) && count($ids_product)) ? implode(', ', $ids_product) : 0).')' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -1696,7 +1818,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
return Product::getProductCategories($this->id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets carriers assigned to the product
|
||||
*/
|
||||
@@ -1710,14 +1832,14 @@ class ProductCore extends ObjectModel
|
||||
WHERE pc.`id_product` = '.(int)$this->id.'
|
||||
AND pc.`id_shop` = '.(int)$this->id_shop);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets carriers assigned to the product
|
||||
*/
|
||||
public function setCarriers($carrier_list)
|
||||
{
|
||||
$data = array();
|
||||
foreach($carrier_list as $carrier)
|
||||
foreach ($carrier_list as $carrier)
|
||||
{
|
||||
$data[] = array(
|
||||
'id_product' => (int)$this->id,
|
||||
@@ -1786,8 +1908,9 @@ class ProductCore extends ObjectModel
|
||||
* @param boolean $with_ecotax insert ecotax in price output.
|
||||
* @return float Product price
|
||||
*/
|
||||
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null, $only_reduc = false,
|
||||
$usereduc = true, $quantity = 1, $forceAssociatedTax = false, $id_customer = null, $id_cart = null, $id_address = null, &$specificPriceOutput = null, $with_ecotax = true, $use_groupReduction = true, Context $context = null)
|
||||
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null,
|
||||
$only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = false, $id_customer = null, $id_cart = null,
|
||||
$id_address = null, &$specificPriceOutput = null, $with_ecotax = true, $use_groupReduction = true, Context $context = null)
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
@@ -1797,18 +1920,18 @@ class ProductCore extends ObjectModel
|
||||
if (isset($divisor))
|
||||
Tools::displayParameterAsDeprecated('divisor');
|
||||
|
||||
if (!Validate::isBool($usetax) OR !Validate::isUnsignedId($id_product))
|
||||
if (!Validate::isBool($usetax) || !Validate::isUnsignedId($id_product))
|
||||
die(Tools::displayError());
|
||||
// Initializations
|
||||
$id_group = (isset($context->customer) ? $context->customer->id_default_group : _PS_DEFAULT_CUSTOMER_GROUP_);
|
||||
if (!is_object($cur_cart) OR (Validate::isUnsignedInt($id_cart) AND $id_cart))
|
||||
if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart))
|
||||
{
|
||||
/*
|
||||
* When a user (e.g., guest, customer, Google...) is on PrestaShop, he has already its cart as the global (see /init.php)
|
||||
* When a non-user calls directly this method (e.g., payment module...) is on PrestaShop, he does not have already it BUT knows the cart ID
|
||||
* When called from the back office, cart ID can be inexistant
|
||||
*/
|
||||
if (!$id_cart &&!isset($context->employee))
|
||||
if (!$id_cart && !isset($context->employee))
|
||||
die(Tools::displayError());
|
||||
$cur_cart = new Cart($id_cart);
|
||||
}
|
||||
@@ -1837,7 +1960,7 @@ class ProductCore extends ObjectModel
|
||||
$cart_quantity = self::$_cart_quantity[$cache_name];
|
||||
}
|
||||
}
|
||||
$quantity = ($id_cart AND $cart_quantity) ? $cart_quantity : $quantity;
|
||||
$quantity = ($id_cart && $cart_quantity) ? $cart_quantity : $quantity;
|
||||
$id_currency = (int)(Validate::isLoadedObject($context->currency) ? $context->currency->id : Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
|
||||
// retrieve address informations
|
||||
@@ -1868,7 +1991,7 @@ class ProductCore extends ObjectModel
|
||||
if (Tax::excludeTaxeOption())
|
||||
$usetax = false;
|
||||
|
||||
if ($usetax != false AND !empty($address_infos['vat_number']) AND $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY') AND Configuration::get('VATNUMBER_MANAGEMENT'))
|
||||
if ($usetax != false && !empty($address_infos['vat_number']) && $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY') && Configuration::get('VATNUMBER_MANAGEMENT'))
|
||||
$usetax = false;
|
||||
|
||||
return Product::priceCalculation($context->shop->getID(), $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency, $id_group, $quantity, $usetax, $decimals, $only_reduc,
|
||||
@@ -1895,14 +2018,16 @@ class ProductCore extends ObjectModel
|
||||
*
|
||||
* @return float Product price
|
||||
**/
|
||||
public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_groupReduction)
|
||||
public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency, $id_group, $quantity,
|
||||
$use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_groupReduction)
|
||||
{
|
||||
// Caching
|
||||
if ($id_product_attribute === null)
|
||||
$product_attribute_label = 'null';
|
||||
else
|
||||
$product_attribute_label = ($id_product_attribute === false ? 'false' : $id_product_attribute);
|
||||
$cacheId = $id_product.'-'.$id_shop.'-'.$id_currency.'-'.$id_country.'-'.$id_state.'-'.$zipcode.'-'.$id_group.'-'.$quantity.'-'.$product_attribute_label.'-'.($use_tax?'1':'0').'-'.$decimals.'-'.($only_reduc?'1':'0').'-'.($use_reduc?'1':'0').'-'.$with_ecotax;
|
||||
$cacheId = $id_product.'-'.$id_shop.'-'.$id_currency.'-'.$id_country.'-'.$id_state.'-'.$zipcode.'-'.$id_group.
|
||||
'-'.$quantity.'-'.$product_attribute_label.'-'.($use_tax?'1':'0').'-'.$decimals.'-'.($only_reduc?'1':'0').'-'.($use_reduc?'1':'0').'-'.$with_ecotax;
|
||||
|
||||
// reference parameter is filled before any returns
|
||||
$specific_price = SpecificPrice::getSpecificPrice((int)($id_product), $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute);
|
||||
@@ -1933,9 +2058,9 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
$result = self::$_pricesLevel2[$cacheId2];
|
||||
|
||||
$price = (float)(!$specific_price OR $specific_price['price'] == 0) ? $result['price'] : $specific_price['price'];
|
||||
$price = (float)(!$specific_price || $specific_price['price'] == 0) ? $result['price'] : $specific_price['price'];
|
||||
// convert only if the specific price is in the default currency (id_currency = 0)
|
||||
if (!$specific_price OR !($specific_price['price'] > 0 AND $specific_price['id_currency']))
|
||||
if (!$specific_price || !($specific_price['price'] > 0 && $specific_price['id_currency']))
|
||||
$price = Tools::convertPrice($price, $id_currency);
|
||||
|
||||
// Attribute price
|
||||
@@ -1959,7 +2084,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
// Reduction
|
||||
$reduc = 0;
|
||||
if (($only_reduc OR $use_reduc) AND $specific_price)
|
||||
if (($only_reduc || $use_reduc) && $specific_price)
|
||||
{
|
||||
if ($specific_price['reduction_type'] == 'amount')
|
||||
{
|
||||
@@ -1989,7 +2114,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
$price = Tools::ps_round($price, $decimals);
|
||||
// Eco Tax
|
||||
if (($result['ecotax'] OR isset($result['attribute_ecotax'])) AND $with_ecotax)
|
||||
if (($result['ecotax'] || isset($result['attribute_ecotax'])) AND $with_ecotax)
|
||||
{
|
||||
$ecotax = $result['ecotax'];
|
||||
if (isset($result['attribute_ecotax']) && $result['attribute_ecotax'] > 0)
|
||||
@@ -2070,7 +2195,7 @@ class ProductCore extends ObjectModel
|
||||
WHERE `id_product` = '.(int)($this->id).'
|
||||
ORDER BY `price` DESC');
|
||||
|
||||
return (isset($row['id_product_attribute']) AND $row['id_product_attribute']) ? (int)$row['id_product_attribute'] : 0;
|
||||
return (isset($row['id_product_attribute']) && $row['id_product_attribute']) ? (int)$row['id_product_attribute'] : 0;
|
||||
}
|
||||
|
||||
public function getPriceWithoutReduct($notax = false, $id_product_attribute = false)
|
||||
@@ -2333,7 +2458,7 @@ class ProductCore extends ObjectModel
|
||||
if ($this->isAvailableWhenOutOfStock($this->getOutOfStock()))
|
||||
return true;
|
||||
|
||||
if(isset($this->id_product_attribute))
|
||||
if (isset($this->id_product_attribute))
|
||||
$id_product_attribute = $this->id_product_attribute;
|
||||
else
|
||||
$id_product_attribute = 0;
|
||||
@@ -2551,7 +2676,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
$productImplode = array();
|
||||
foreach ($productIds as $id_product)
|
||||
if ((int)$id_product AND !array_key_exists($id_product, self::$_cacheFeatures))
|
||||
if ((int)$id_product && !array_key_exists($id_product, self::$_cacheFeatures))
|
||||
$productImplode[] = (int)$id_product;
|
||||
if (!count($productImplode))
|
||||
return;
|
||||
@@ -2575,7 +2700,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
$productImplode = array();
|
||||
foreach ($productIds as $id_product)
|
||||
if ((int)$id_product AND !array_key_exists($id_product.'-'.$id_lang, self::$_cacheFeatures))
|
||||
if ((int)$id_product && !array_key_exists($id_product.'-'.$id_lang, self::$_cacheFeatures))
|
||||
$productImplode[] = (int)$id_product;
|
||||
if (!count($productImplode))
|
||||
return;
|
||||
@@ -2739,9 +2864,12 @@ class ProductCore extends ObjectModel
|
||||
|
||||
if (!Db::getInstance()->NumRows())
|
||||
return true;
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'product_download` (`id_product`, `display_filename`, `filename`, `date_add`, `date_expiration`, `nb_days_accessible`, `nb_downloadable`, `active`, `is_shareable`) VALUES';
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'product_download`
|
||||
(`id_product`, `display_filename`, `filename`, `date_add`, `date_expiration`, `nb_days_accessible`, `nb_downloadable`, `active`, `is_shareable`)
|
||||
VALUES';
|
||||
while ($row = Db::getInstance()->nextRow($resource))
|
||||
$query .= ' ('.(int)($id_product_new).', \''.pSQL($row['display_filename']).'\', \''.pSQL($row['filename']).'\', \''.pSQL($row['date_add']).'\', \''.pSQL($row['date_expiration']).'\', '.(int)($row['nb_days_accessible']).', '.(int)($row['nb_downloadable']).', '.(int)($row['active']).'), '.(int)($row['is_shareable']).'),';
|
||||
$query .= ' ('.(int)($id_product_new).', \''.pSQL($row['display_filename']).'\', \''.pSQL($row['filename']).'\', \''.pSQL($row['date_add']).'\', \''.
|
||||
pSQL($row['date_expiration']).'\', '.(int)($row['nb_days_accessible']).', '.(int)($row['nb_downloadable']).', '.(int)($row['active']).'), '.(int)($row['is_shareable']).'),';
|
||||
$query = rtrim($query, ',');
|
||||
return Db::getInstance()->execute($query);
|
||||
}
|
||||
@@ -2846,7 +2974,7 @@ class ProductCore extends ObjectModel
|
||||
$customizationField['id_product'] = (int)($productId);
|
||||
$oldCustomizationFieldId = (int)($customizationField['id_customization_field']);
|
||||
unset($customizationField['id_customization_field']);
|
||||
if (!Db::getInstance()->AutoExecute(_DB_PREFIX_.'customization_field', $customizationField, 'INSERT') OR !$customizationFieldId = Db::getInstance()->Insert_ID())
|
||||
if (!Db::getInstance()->AutoExecute(_DB_PREFIX_.'customization_field', $customizationField, 'INSERT') || !$customizationFieldId = Db::getInstance()->Insert_ID())
|
||||
return false;
|
||||
if (isset($customizations['labels']))
|
||||
{
|
||||
@@ -2876,7 +3004,7 @@ class ProductCore extends ObjectModel
|
||||
if (!$this->isFullyLoaded && is_null($this->tags))
|
||||
$this->tags = Tag::getProductTags($this->id);
|
||||
|
||||
if (!($this->tags AND key_exists($id_lang, $this->tags)))
|
||||
if (!($this->tags && key_exists($id_lang, $this->tags)))
|
||||
return '';
|
||||
|
||||
$result = '';
|
||||
@@ -2905,7 +3033,7 @@ class ProductCore extends ObjectModel
|
||||
&& ((isset($row['cache_default_attribute']) && ($ipa_default = $row['cache_default_attribute']) !== null)
|
||||
|| ($ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp']))))
|
||||
$row['id_product_attribute'] = $ipa_default;
|
||||
if (!Combination::isFeatureActive() OR !isset($row['id_product_attribute']))
|
||||
if (!Combination::isFeatureActive() || !isset($row['id_product_attribute']))
|
||||
$row['id_product_attribute'] = 0;
|
||||
|
||||
// Tax
|
||||
@@ -2918,18 +3046,18 @@ class ProductCore extends ObjectModel
|
||||
// Datas
|
||||
$row['category'] = Category::getLinkRewrite((int)$row['id_category_default'], (int)($id_lang));
|
||||
$row['link'] = $context->link->getProductLink((int)$row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
|
||||
$row['attribute_price'] = (isset($row['id_product_attribute']) AND $row['id_product_attribute']) ? (float)(Product::getProductAttributePrice($row['id_product_attribute'])) : 0;
|
||||
$row['price_tax_exc'] = Product::getPriceStatic((int)$row['id_product'], false, ((isset($row['id_product_attribute']) AND !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : null), (self::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6));
|
||||
$row['attribute_price'] = (isset($row['id_product_attribute']) && $row['id_product_attribute']) ? (float)(Product::getProductAttributePrice($row['id_product_attribute'])) : 0;
|
||||
$row['price_tax_exc'] = Product::getPriceStatic((int)$row['id_product'], false, ((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : null), (self::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6));
|
||||
if (self::$_taxCalculationMethod == PS_TAX_EXC)
|
||||
{
|
||||
$row['price_tax_exc'] = Tools::ps_round($row['price_tax_exc'], 2);
|
||||
$row['price'] = Product::getPriceStatic((int)$row['id_product'], true, ((isset($row['id_product_attribute']) AND !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : null), 6);
|
||||
$row['price'] = Product::getPriceStatic((int)$row['id_product'], true, ((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : null), 6);
|
||||
$row['price_without_reduction'] = Product::getPriceStatic((int)$row['id_product'], false, ((isset($row['id_product_attribute']) AND !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : null), 2, null, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['price'] = Tools::ps_round(Product::getPriceStatic((int)$row['id_product'], true, ((isset($row['id_product_attribute']) AND !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : null), 2), 2);
|
||||
$row['price_without_reduction'] = Product::getPriceStatic((int)$row['id_product'], true, ((isset($row['id_product_attribute']) AND !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : null), 6, null, false, false);
|
||||
$row['price'] = Tools::ps_round(Product::getPriceStatic((int)$row['id_product'], true, ((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : null), 2), 2);
|
||||
$row['price_without_reduction'] = Product::getPriceStatic((int)$row['id_product'], true, ((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : null), 6, null, false, false);
|
||||
}
|
||||
|
||||
$row['reduction'] = Product::getPriceStatic((int)($row['id_product']), (bool)$usetax, (int)($row['id_product_attribute']), 6, null, true, true, 1, true, null, null, null, $specific_prices);
|
||||
@@ -2942,14 +3070,14 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
$row['id_image'] = Product::defineProductImage($row, $id_lang);
|
||||
$row['features'] = Product::getFrontFeaturesStatic((int)$id_lang, $row['id_product']);
|
||||
$row['attachments'] = ((!isset($row['cache_has_attachments']) OR $row['cache_has_attachments']) ? Product::getAttachmentsStatic((int)($id_lang), $row['id_product']) : array());
|
||||
$row['virtual'] = ((!isset($row['is_virtual']) OR $row['is_virtual']) ? 1 : 0);
|
||||
$row['attachments'] = ((!isset($row['cache_has_attachments']) || $row['cache_has_attachments']) ? Product::getAttachmentsStatic((int)($id_lang), $row['id_product']) : array());
|
||||
$row['virtual'] = ((!isset($row['is_virtual']) || $row['is_virtual']) ? 1 : 0);
|
||||
|
||||
// Pack management
|
||||
$row['pack'] = (!isset($row['cache_is_pack']) ? Pack::isPack($row['id_product']) : (int)$row['cache_is_pack']);
|
||||
$row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
|
||||
$row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
|
||||
if ($row['pack'] AND !Pack::isInStock($row['id_product']))
|
||||
if ($row['pack'] && !Pack::isInStock($row['id_product']))
|
||||
$row['quantity'] = 0;
|
||||
|
||||
self::$producPropertiesCache[$cacheKey] = $row;
|
||||
@@ -3051,9 +3179,9 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public static function addCustomizationPrice(&$products, &$customizedDatas)
|
||||
{
|
||||
if(!$customizedDatas)
|
||||
if (!$customizedDatas)
|
||||
return;
|
||||
|
||||
|
||||
foreach ($products as &$productUpdate)
|
||||
{
|
||||
if (!Customization::isFeatureActive())
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7310 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class ProductSupplierCore extends ObjectModel
|
||||
{
|
||||
/**
|
||||
* @var integer product ID
|
||||
* */
|
||||
public $id_product;
|
||||
|
||||
/**
|
||||
* @var integer product attribute ID
|
||||
* */
|
||||
public $id_product_attribute;
|
||||
|
||||
/**
|
||||
* @var integer the supplier ID
|
||||
* */
|
||||
public $id_supplier;
|
||||
|
||||
/**
|
||||
* @var string The supplier reference of the product
|
||||
* */
|
||||
public $product_supplier_reference;
|
||||
|
||||
protected $fieldsRequired = array('id_product', 'id_product_attribute', 'id_supplier');
|
||||
protected $fieldsSize = array('supplier_reference' => 32);
|
||||
protected $fieldsValidate = array(
|
||||
'product_supplier_reference' => 'isReference',
|
||||
'id_product' => 'isUnsignedId',
|
||||
'id_product_attribute' => 'isUnsignedId',
|
||||
'id_supplier' => 'isUnsignedId',
|
||||
);
|
||||
|
||||
protected $table = 'product_supplier';
|
||||
protected $identifier = 'id_product_supplier';
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
|
||||
$fields['id_product'] = (int)$this->id_product;
|
||||
$fields['id_product_attribute'] = (int)$this->id_product_attribute;
|
||||
$fields['id_supplier'] = (int)$this->id_supplier;
|
||||
$fields['product_supplier_reference'] = pSQL($this->product_supplier_reference);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given product and supplier, get the product reference
|
||||
*
|
||||
* @param int $id_product
|
||||
* @param int $id_product_attribute
|
||||
* @param int $id_supplier
|
||||
* @return array
|
||||
*/
|
||||
public static function getProductSupplierReference($id_product, $id_product_attribute, $id_supplier)
|
||||
{
|
||||
// build query
|
||||
$query = new DbQuery();
|
||||
$query->select('ps.product_supplier_reference');
|
||||
$query->from('product_supplier ps');
|
||||
$query->where('ps.id_product = '.(int)$id_product.'
|
||||
AND ps.id_product_attribute = '.(int)$id_product_attribute.'
|
||||
AND ps.id_supplier = '.(int)$id_supplier
|
||||
);
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given product and supplier, get the ProductSupplier corresponding ID
|
||||
*
|
||||
* @param int $id_product
|
||||
* @param int $id_product_attribute
|
||||
* @param int $id_supplier
|
||||
* @return array
|
||||
*/
|
||||
public static function getIdByProductAndSupplier($id_product, $id_product_attribute, $id_supplier)
|
||||
{
|
||||
// build query
|
||||
$query = new DbQuery();
|
||||
$query->select('ps.id_product_supplier');
|
||||
$query->from('product_supplier ps');
|
||||
$query->where('ps.id_product = '.(int)$id_product.'
|
||||
AND ps.id_product_attribute = '.(int)$id_product_attribute.'
|
||||
AND ps.id_supplier = '.(int)$id_supplier
|
||||
);
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given product, retrieves its suppliers
|
||||
*
|
||||
* @param int $id_product
|
||||
* @param int $id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getSupplierCollection($id_product, $group_by_product = true)
|
||||
{
|
||||
// build query
|
||||
$query = new DbQuery();
|
||||
$query->select('*');
|
||||
$query->from('product_supplier ps');
|
||||
$query->where('ps.id_product = '.(int)$id_product);
|
||||
|
||||
if ($group_by_product)
|
||||
$query->groupBy('ps.id_supplier');
|
||||
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
|
||||
return ObjectModel::hydrateCollection('ProductSupplier', $results);
|
||||
}
|
||||
}
|
||||
+124
-81
@@ -27,47 +27,51 @@
|
||||
|
||||
class SupplierCore extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
public $id;
|
||||
|
||||
/** @var integer supplier ID */
|
||||
public $id_supplier;
|
||||
public $id_supplier;
|
||||
|
||||
/** @var string Name */
|
||||
public $name;
|
||||
public $name;
|
||||
|
||||
/** @var string A short description for the discount */
|
||||
public $description;
|
||||
public $description;
|
||||
|
||||
/** @var string Object creation date */
|
||||
public $date_add;
|
||||
public $date_add;
|
||||
|
||||
/** @var string Object last modification date */
|
||||
public $date_upd;
|
||||
public $date_upd;
|
||||
|
||||
/** @var string Friendly URL */
|
||||
public $link_rewrite;
|
||||
public $link_rewrite;
|
||||
|
||||
/** @var string Meta title */
|
||||
public $meta_title;
|
||||
public $meta_title;
|
||||
|
||||
/** @var string Meta keywords */
|
||||
public $meta_keywords;
|
||||
public $meta_keywords;
|
||||
|
||||
/** @var string Meta description */
|
||||
public $meta_description;
|
||||
public $meta_description;
|
||||
|
||||
/** @var boolean active */
|
||||
public $active;
|
||||
public $active;
|
||||
|
||||
protected $fieldsRequired = array('name');
|
||||
protected $fieldsSize = array('name' => 64);
|
||||
protected $fieldsValidate = array('name' => 'isCatalogName');
|
||||
protected $fieldsRequired = array('name');
|
||||
protected $fieldsSize = array('name' => 64);
|
||||
protected $fieldsValidate = array('name' => 'isCatalogName');
|
||||
protected $fieldsSizeLang = array('meta_title' => 128, 'meta_description' => 255, 'meta_keywords' => 255);
|
||||
protected $fieldsValidateLang = array(
|
||||
'description' => 'isGenericName',
|
||||
'meta_title' => 'isGenericName',
|
||||
'meta_description' => 'isGenericName',
|
||||
'meta_keywords' => 'isGenericName'
|
||||
);
|
||||
|
||||
protected $fieldsSizeLang = array('meta_title' => 128, 'meta_description' => 255, 'meta_keywords' => 255);
|
||||
protected $fieldsValidateLang = array('description' => 'isGenericName', 'meta_title' => 'isGenericName', 'meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName');
|
||||
|
||||
protected $table = 'supplier';
|
||||
protected $identifier = 'id_supplier';
|
||||
protected $table = 'supplier';
|
||||
protected $identifier = 'id_supplier';
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'fields' => array(
|
||||
@@ -75,7 +79,7 @@ class SupplierCore extends ObjectModel
|
||||
),
|
||||
);
|
||||
|
||||
public function __construct($id = NULL, $id_lang = NULL)
|
||||
public function __construct($id = null, $id_lang = null)
|
||||
{
|
||||
parent::__construct($id, $id_lang);
|
||||
|
||||
@@ -92,11 +96,11 @@ class SupplierCore extends ObjectModel
|
||||
{
|
||||
$this->validateFields();
|
||||
if (isset($this->id))
|
||||
$fields['id_supplier'] = (int)($this->id);
|
||||
$fields['id_supplier'] = (int)$this->id;
|
||||
$fields['name'] = pSQL($this->name);
|
||||
$fields['date_add'] = pSQL($this->date_add);
|
||||
$fields['date_upd'] = pSQL($this->date_upd);
|
||||
$fields['active'] = (int)($this->active);
|
||||
$fields['active'] = (int)$this->active;
|
||||
return $fields;
|
||||
}
|
||||
|
||||
@@ -111,47 +115,50 @@ class SupplierCore extends ObjectModel
|
||||
*
|
||||
* @return array Suppliers
|
||||
*/
|
||||
public static function getSuppliers($getNbProducts = false, $id_lang = 0, $active = true, $p = false, $n = false, $all_groups = false)
|
||||
public static function getSuppliers($get_nb_products = false, $id_lang = 0, $active = true, $p = false, $n = false, $all_groups = false)
|
||||
{
|
||||
if (!$id_lang)
|
||||
$id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
$query = 'SELECT s.*, sl.`description`';
|
||||
$query .= ' FROM `'._DB_PREFIX_.'supplier` as s
|
||||
LEFT JOIN `'._DB_PREFIX_.'supplier_lang` sl ON (s.`id_supplier` = sl.`id_supplier` AND sl.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'supplier_lang` sl ON (s.`id_supplier` = sl.`id_supplier` AND sl.`id_lang` = '.(int)$id_lang.')
|
||||
'.($active ? ' WHERE s.`active` = 1 ' : '');
|
||||
$query .= ' ORDER BY s.`name` ASC'.($p ? ' LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n) : '');
|
||||
$query .= ' ORDER BY s.`name` ASC'.($p ? ' LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n : '');
|
||||
$suppliers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
if ($suppliers === false)
|
||||
return false;
|
||||
if ($getNbProducts)
|
||||
if ($get_nb_products)
|
||||
{
|
||||
$sqlGroups = '';
|
||||
$sql_groups = '';
|
||||
if (!$all_groups)
|
||||
{
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sqlGroups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
}
|
||||
foreach ($suppliers as $key => $supplier)
|
||||
{
|
||||
$sql = '
|
||||
SELECT p.`id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'supplier` as m ON (m.`id_supplier`= p.`id_supplier`)
|
||||
WHERE m.`id_supplier` = '.(int)($supplier['id_supplier']).
|
||||
SELECT DISTINCT(ps.`id_product`)
|
||||
FROM `'._DB_PREFIX_.'product_supplier` ps
|
||||
JOIN `'._DB_PREFIX_.'product` p ON (ps.`id_product`= p.`id_product`)
|
||||
WHERE ps.`id_supplier` = '.(int)$supplier['id_supplier'].'
|
||||
AND ps.id_product_attribute = 0'.
|
||||
($active ? ' AND p.`active` = 1' : '').
|
||||
($all_groups ? '' :'
|
||||
AND p.`id_product` IN (
|
||||
AND ps.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sqlGroups.'
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)');
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$suppliers[$key]['nb_products'] = sizeof($result);
|
||||
$suppliers[$key]['nb_products'] = count($result);
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < sizeof($suppliers); $i++)
|
||||
if ((int)(Configuration::get('PS_REWRITING_SETTINGS')))
|
||||
|
||||
$nb_suppliers = count($suppliers);
|
||||
for ($i = 0; $i < $nb_suppliers; $i++)
|
||||
if ((int)Configuration::get('PS_REWRITING_SETTINGS'))
|
||||
$suppliers[$i]['link_rewrite'] = Tools::link_rewrite($suppliers[$i]['name'], false);
|
||||
else
|
||||
$suppliers[$i]['link_rewrite'] = 0;
|
||||
@@ -164,98 +171,133 @@ class SupplierCore extends ObjectModel
|
||||
* @param integer $id_supplier Supplier ID
|
||||
* @return string name
|
||||
*/
|
||||
static protected $cacheName = array();
|
||||
static protected $cache_name = array();
|
||||
public static function getNameById($id_supplier)
|
||||
{
|
||||
if (!isset(self::$cacheName[$id_supplier]))
|
||||
self::$cacheName[$id_supplier] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `name` FROM `'._DB_PREFIX_.'supplier` WHERE `id_supplier` = '.(int)($id_supplier));
|
||||
return self::$cacheName[$id_supplier];
|
||||
if (!isset(self::$cache_name[$id_supplier]))
|
||||
self::$cache_name[$id_supplier] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `name` FROM `'._DB_PREFIX_.'supplier` WHERE `id_supplier` = '.(int)$id_supplier);
|
||||
return self::$cache_name[$id_supplier];
|
||||
}
|
||||
|
||||
public static function getIdByName($name)
|
||||
{
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT `id_supplier`
|
||||
FROM `'._DB_PREFIX_.'supplier`
|
||||
WHERE `name` = \''.pSQL($name).'\'');
|
||||
if (isset($result['id_supplier']))
|
||||
return (int)($result['id_supplier']);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getProducts($id_supplier, $id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $active_category = true)
|
||||
if (isset($result['id_supplier']))
|
||||
return (int)$result['id_supplier'];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getProducts($id_supplier, $id_lang, $p, $n,
|
||||
$order_by = null, $order_way = null, $get_total = false, $active = true, $active_category = true)
|
||||
{
|
||||
if ($p < 1) $p = 1;
|
||||
if (empty($orderBy) OR $orderBy == 'position') $orderBy = 'name';
|
||||
if (empty($orderWay)) $orderWay = 'ASC';
|
||||
if (empty($order_by) || $order_by == 'position') $order_by = 'name';
|
||||
if (empty($order_way)) $order_way = 'ASC';
|
||||
|
||||
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay))
|
||||
if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way))
|
||||
die (Tools::displayError());
|
||||
|
||||
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sqlGroups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
|
||||
/* Return only the number of products */
|
||||
if ($getTotal)
|
||||
if ($get_total)
|
||||
{
|
||||
$sql = '
|
||||
SELECT p.`id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
WHERE p.id_supplier = '.(int)($id_supplier)
|
||||
.($active ? ' AND p.`active` = 1' : '').'
|
||||
SELECT DISTINCT(ps.`id_product`)
|
||||
FROM `'._DB_PREFIX_.'product_supplier` ps
|
||||
JOIN `'._DB_PREFIX_.'product` p ON (ps.`id_product`= p.`id_product`)
|
||||
WHERE ps.`id_supplier` = '.(int)$id_supplier.'
|
||||
AND ps.id_product_attribute = 0'.
|
||||
($active ? ' AND p.`active` = 1' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)'.
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sqlGroups.'
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
return (int)(sizeof($result));
|
||||
return (int)count($result);
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.*, sa.out_of_stock, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, s.`name` AS supplier_name, tl.`name` AS tax_name, t.`rate`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new,
|
||||
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice, m.`name` AS manufacturer_name
|
||||
$nb_days_new_product = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
|
||||
|
||||
$sql = 'SELECT p.*, sa.out_of_stock,
|
||||
pl.`description`,
|
||||
pl.`description_short`,
|
||||
pl.`link_rewrite`,
|
||||
pl.`meta_description`,
|
||||
pl.`meta_keywords`,
|
||||
pl.`meta_title`,
|
||||
pl.`name`,
|
||||
i.`id_image`,
|
||||
il.`legend`,
|
||||
s.`name` AS supplier_name,
|
||||
tl.`name` AS tax_name,
|
||||
t.`rate`,
|
||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.($nb_days_new_product).' DAY)) > 0 AS new,
|
||||
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice,
|
||||
m.`name` AS manufacturer_name
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
JOIN `'._DB_PREFIX_.'product_supplier` ps ON (ps.id_product = p.id_product
|
||||
AND ps_id_product_attribute = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`
|
||||
AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`
|
||||
AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0
|
||||
AND tr.`zipcode_from` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax`
|
||||
AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'supplier` s ON s.`id_supplier` = p.`id_supplier`
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.`id_product` = p.`id_product` AND sa.id_product_attribute = 0)
|
||||
WHERE p.`id_supplier` = '.(int)$id_supplier.($active ? ' AND p.`active` = 1' : '').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.`id_product` = p.`id_product`
|
||||
AND sa.id_product_attribute = 0)
|
||||
WHERE ps.`id_supplier` = '.(int)$id_supplier.
|
||||
($active ? ' AND p.`active` = 1' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)'.
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sqlGroups.'
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||
LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
||||
ORDER BY '.(($order_by == 'id_product') ? 'p.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
|
||||
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
if (!$result)
|
||||
return false;
|
||||
if ($orderBy == 'price')
|
||||
Tools::orderbyPrice($result, $orderWay);
|
||||
|
||||
if ($order_by == 'price')
|
||||
Tools::orderbyPrice($result, $order_way);
|
||||
|
||||
return Product::getProductsProperties($id_lang, $result);
|
||||
}
|
||||
|
||||
public function getProductsLite($id_lang)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).')
|
||||
WHERE p.`id_supplier` = '.(int)($this->id));
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE p.`id_supplier` = '.(int)$this->id
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify if a supplier already in base
|
||||
*
|
||||
@@ -265,17 +307,18 @@ class SupplierCore extends ObjectModel
|
||||
public static function supplierExists($id_supplier)
|
||||
{
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT `id_supplier`
|
||||
FROM '._DB_PREFIX_.'supplier s
|
||||
WHERE s.`id_supplier` = '.(int)($id_supplier));
|
||||
SELECT `id_supplier`
|
||||
FROM '._DB_PREFIX_.'supplier s
|
||||
WHERE s.`id_supplier` = '.(int)$id_supplier
|
||||
);
|
||||
|
||||
return isset($row['id_supplier']);
|
||||
}
|
||||
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (parent::delete())
|
||||
return $this->deleteImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ class StockAvailableCore extends ObjectModel
|
||||
$quantity = $manager->getProductRealQuantities($id_product, $id_product_attribute, $warehouses, true);
|
||||
|
||||
$query = array(
|
||||
'table' => 'stock_available',
|
||||
'table' => _DB_PREFIX_.'stock_available',
|
||||
'data' => array('quantity' => $quantity),
|
||||
'type' => 'UPDATE',
|
||||
'where' => 'id_product = '.(int)$id_product.' AND id_product_attribute = '.(int)$id_product_attribute.' AND id_shop = '.(int)$id_shop
|
||||
@@ -167,7 +167,7 @@ class StockAvailableCore extends ObjectModel
|
||||
}
|
||||
|
||||
$query = array(
|
||||
'table' => 'stock_available',
|
||||
'table' => _DB_PREFIX_.'stock_available',
|
||||
'data' => array('quantity' => $total_quantity),
|
||||
'type' => 'UPDATE',
|
||||
'where' => 'id_product = '.(int)$id_product.' AND id_product_attribute = 0 AND id_shop = '.(int)$id_shop
|
||||
@@ -215,7 +215,7 @@ class StockAvailableCore extends ObjectModel
|
||||
$id_shop = Context::getContext()->shop->getID(true);
|
||||
|
||||
Db::getInstance()->autoExecute(
|
||||
'stock_available',
|
||||
_DB_PREFIX_.'stock_available',
|
||||
array('out_of_stock' => (int)$out_of_stock),
|
||||
'UPDATE',
|
||||
'id_product = '.(int)$id_product.' AND id_shop = '.(int)$id_shop
|
||||
|
||||
@@ -35,6 +35,11 @@ class SupplyOrderCore extends ObjectModel
|
||||
*/
|
||||
public $id_supplier;
|
||||
|
||||
/**
|
||||
* @var string Supplier Name
|
||||
*/
|
||||
public $supplier_name;
|
||||
|
||||
/**
|
||||
* @var int The language id used on the delivery note
|
||||
*/
|
||||
@@ -112,6 +117,7 @@ class SupplyOrderCore extends ObjectModel
|
||||
|
||||
protected $fieldsRequired = array(
|
||||
'id_supplier',
|
||||
'supplier_name',
|
||||
'id_lang',
|
||||
'id_warehouse',
|
||||
'id_supply_order_state',
|
||||
@@ -124,6 +130,7 @@ class SupplyOrderCore extends ObjectModel
|
||||
|
||||
protected $fieldsValidate = array(
|
||||
'id_supplier' => 'isUnsignedId',
|
||||
'supplier_name' => 'isCatalogName',
|
||||
'id_lang' => 'isUnsignedId',
|
||||
'id_warehouse' => 'isUnsignedId',
|
||||
'id_supply_order_state' => 'isUnsignedId',
|
||||
@@ -156,6 +163,7 @@ class SupplyOrderCore extends ObjectModel
|
||||
$this->validateFields();
|
||||
|
||||
$fields['id_supplier'] = (int)$this->id_supplier;
|
||||
$fields['supplier_name'] = pSQL($this->supplier_name);
|
||||
$fields['id_lang'] = (int)$this->id_lang;
|
||||
$fields['id_warehouse'] = (int)$this->id_warehouse;
|
||||
$fields['id_supply_order_state'] = (int)$this->id_supply_order_state;
|
||||
|
||||
@@ -50,6 +50,11 @@ class SupplyOrderDetailCore extends ObjectModel
|
||||
*/
|
||||
public $reference;
|
||||
|
||||
/**
|
||||
* @var string Product supplier reference
|
||||
*/
|
||||
public $supplier_reference;
|
||||
|
||||
/**
|
||||
* @var int Product name
|
||||
*/
|
||||
@@ -162,6 +167,7 @@ class SupplyOrderDetailCore extends ObjectModel
|
||||
'id_product' => 'isUnsignedId',
|
||||
'id_product_attribute' => 'isUnsignedId',
|
||||
'reference' => 'isReference',
|
||||
'supplier_reference' => 'isReference',
|
||||
'name' => 'isGenericName',
|
||||
'ean13' => 'isEan13',
|
||||
'upc' => 'isUpc',
|
||||
@@ -202,6 +208,7 @@ class SupplyOrderDetailCore extends ObjectModel
|
||||
$fields['id_product'] = (int)$this->id_product;
|
||||
$fields['id_product_attribute'] = (int)$this->id_product_attribute;
|
||||
$fields['reference'] = pSQL($this->reference);
|
||||
$fields['supplier_reference'] = pSQL($this->supplier_reference);
|
||||
$fields['name'] = pSQL($this->name);
|
||||
$fields['ean13'] = pSQL($this->ean13);
|
||||
$fields['upc'] = pSQL($this->upc);
|
||||
@@ -281,8 +288,9 @@ class SupplyOrderDetailCore extends ObjectModel
|
||||
if ($discount_rate != null && is_numeric($discount_rate) && (float)$discount_rate > 0)
|
||||
{
|
||||
// calculates new price, with global order discount, tax ecluded
|
||||
$this->price_with_order_discount_te = Tools::ps_round($this->price_with_discount_te - ($this->price_with_discount_te * ((float)$discount_rate / 100)),
|
||||
6);
|
||||
$discount_value = $this->price_with_discount_te - ($this->price_with_discount_te * ((float)$discount_rate / 100));
|
||||
|
||||
$this->price_with_order_discount_te = Tools::ps_round($discount_value, 6);
|
||||
|
||||
// calculates new tax value, with global order discount
|
||||
$this->tax_value_with_order_discount = Tools::ps_round($this->price_with_order_discount_te * ((float)$this->tax_rate / 100), 6);
|
||||
|
||||
@@ -44,6 +44,7 @@ class AdminProductsController extends AdminController
|
||||
'Customization',
|
||||
'Attachments',
|
||||
'Quantities',
|
||||
'Suppliers',
|
||||
'Accounting');
|
||||
|
||||
public function __construct()
|
||||
@@ -87,7 +88,7 @@ class AdminProductsController extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
|
||||
$this->_filter = 'AND cp.`id_category` = '.(int)$this->_category->id;
|
||||
$this->_select = 'cl.name `name_category`, cp.`position`, i.`id_image`, (a.`price` * ((100 + (t.`rate`))/100)) AS price_final';
|
||||
|
||||
@@ -177,7 +178,7 @@ class AdminProductsController extends AdminController
|
||||
public function deleteVirtualProduct()
|
||||
{
|
||||
if (!($id_product_download = ProductDownload::getIdFromIdAttribute((int)Tools::getValue('id_product'), 0)))
|
||||
return false;
|
||||
return false;
|
||||
$productDownload = new ProductDownload((int)($id_product_download));
|
||||
return $productDownload->deleteFile((int)($id_product_download));
|
||||
}
|
||||
@@ -186,7 +187,7 @@ class AdminProductsController extends AdminController
|
||||
{
|
||||
if (!($id_product_download = ProductDownload::getIdFromIdAttribute((int)Tools::getValue('id_product'), (int) Tools::getValue('id_product_attribute'))))
|
||||
return false;
|
||||
$productDownload = new ProductDownload((int)($id_product_download));
|
||||
$productDownload = new ProductDownload((int)($id_product_download));
|
||||
return $productDownload->deleteFile((int)($id_product_download));
|
||||
}
|
||||
|
||||
@@ -553,16 +554,14 @@ class AdminProductsController extends AdminController
|
||||
{
|
||||
if (Validate::isDateFormat(Tools::getValue('available_date')))
|
||||
{
|
||||
$product->updateProductAttribute($id_product_attribute,
|
||||
$product->updateAttribute($id_product_attribute,
|
||||
Tools::getValue('attribute_wholesale_price'),
|
||||
Tools::getValue('attribute_price') * Tools::getValue('attribute_price_impact'),
|
||||
Tools::getValue('attribute_weight') * Tools::getValue('attribute_weight_impact'),
|
||||
Tools::getValue('attribute_unity') * Tools::getValue('attribute_unit_impact'),
|
||||
Tools::getValue('attribute_ecotax'),
|
||||
false,
|
||||
Tools::getValue('id_image_attr'),
|
||||
Tools::getValue('attribute_reference'),
|
||||
Tools::getValue('attribute_supplier_reference'),
|
||||
Tools::getValue('attribute_ean13'),
|
||||
Tools::getValue('attribute_default'),
|
||||
Tools::getValue('attribute_location'),
|
||||
@@ -603,7 +602,7 @@ class AdminProductsController extends AdminController
|
||||
Tools::getValue('attribute_ecotax'),
|
||||
Tools::getValue('id_image_attr'),
|
||||
Tools::getValue('attribute_reference'),
|
||||
Tools::getValue('attribute_supplier_reference'),
|
||||
null,
|
||||
Tools::getValue('attribute_ean13'),
|
||||
Tools::getValue('attribute_default'),
|
||||
Tools::getValue('attribute_location'),
|
||||
@@ -658,7 +657,7 @@ class AdminProductsController extends AdminController
|
||||
}
|
||||
else
|
||||
Product::updateDefaultAttribute($id_product);
|
||||
|
||||
|
||||
Tools::redirectAdmin(self::$currentIndex.'&add'.$this->table.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&tabs=3&id_product='.$product->id.'&token='.($token ? $token : $this->token));
|
||||
}
|
||||
else
|
||||
@@ -926,6 +925,12 @@ class AdminProductsController extends AdminController
|
||||
}
|
||||
else if (Tools::isSubmit('submitAccountingDetails'))
|
||||
$this->postProcessFormAccounting();
|
||||
//Manage suppliers
|
||||
else if (Tools::isSubmit('submitSuppliers'))
|
||||
$this->postProcessFormSuppliers();
|
||||
//Manage suppliers
|
||||
else if (Tools::isSubmit('submitSupplierReferences'))
|
||||
$this->postProcessFormSupplierReferences();
|
||||
else
|
||||
parent::postProcess(true);
|
||||
}
|
||||
@@ -1033,7 +1038,6 @@ if (false)
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add or update a product image
|
||||
*
|
||||
@@ -1195,7 +1199,6 @@ if (false)
|
||||
$this->copyFromPost($object, $this->table);
|
||||
if ($object->update())
|
||||
{
|
||||
$this->addCarriers();
|
||||
if ($id_reason = (int)Tools::getValue('id_mvt_reason') && Tools::getValue('mvt_quantity') > 0 && $id_reason > 0)
|
||||
{
|
||||
if (!$object->addStockMvt(Tools::getValue('mvt_quantity'), $id_reason, null, null, $this->context->employee->id))
|
||||
@@ -1259,7 +1262,6 @@ if (false)
|
||||
$this->copyFromPost($object, $this->table);
|
||||
if ($object->add())
|
||||
{
|
||||
$this->addCarriers();
|
||||
$this->updateAssoShop((int)$object->id);
|
||||
$this->updateAccessories($object);
|
||||
if (!$this->updatePackItems($object))
|
||||
@@ -1307,30 +1309,19 @@ if (false)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function addCarriers()
|
||||
{
|
||||
if (Tools::getValue('carriers'))
|
||||
{
|
||||
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
||||
{
|
||||
if (Tools::getValue('carriers'))
|
||||
$product->setCarriers(Tools::getValue('carriers'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function _removeTaxFromEcotax()
|
||||
{
|
||||
$ecotaxTaxRate = Tax::getProductEcotaxRate();
|
||||
$ecotaxTaxRate = Tax::getProductEcotaxRate();
|
||||
if ($ecotax = Tools::getValue('ecotax'))
|
||||
$_POST['ecotax'] = Tools::ps_round(Tools::getValue('ecotax') / (1 + $ecotaxTaxRate / 100), 6);
|
||||
}
|
||||
|
||||
private function _applyTaxToEcotax($product)
|
||||
{
|
||||
$ecotaxTaxRate = Tax::getProductEcotaxRate();
|
||||
$ecotaxTaxRate = Tax::getProductEcotaxRate();
|
||||
if ($product->ecotax)
|
||||
$product->ecotax = Tools::ps_round($product->ecotax * (1 + $ecotaxTaxRate / 100), 2);
|
||||
}
|
||||
@@ -1415,9 +1406,9 @@ if (false)
|
||||
{
|
||||
$id_product_download_attribute = ProductDownload::getIdFromIdAttribute((int) $product->id, $id_product_attribute);
|
||||
$id_product_download = ($id_product_download_attribute) ? (int) $id_product_download_attribute : (int) Tools::getValue('virtual_product_id');
|
||||
} else
|
||||
} else
|
||||
$id_product_download = Tools::getValue('virtual_product_id');
|
||||
|
||||
|
||||
$is_shareable = Tools::getValue('virtual_product_is_shareable');
|
||||
$virtual_product_name = Tools::getValue('virtual_product_name');
|
||||
$virtual_product_filename = Tools::getValue('virtual_product_filename');
|
||||
@@ -1632,17 +1623,6 @@ if (false)
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessProductSuppliers()
|
||||
{
|
||||
$suppliers = Supplier::getSuppliers();
|
||||
if ($suppliers)
|
||||
{
|
||||
$jsonArray = array();
|
||||
foreach ($suppliers AS $supplier)
|
||||
$jsonArray[] = '{"optionValue": "'.$supplier['id_supplier'].'", "optionDisplay": "'.htmlspecialchars(trim($supplier['name'])).'"}';
|
||||
die('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* displayList show ordered list of current category
|
||||
*
|
||||
@@ -1895,6 +1875,132 @@ if (false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post traitment for suppliers
|
||||
*/
|
||||
public function postProcessFormSuppliers()
|
||||
{
|
||||
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
||||
{
|
||||
// Get all available suppliers
|
||||
$suppliers = Supplier::getSuppliers();
|
||||
|
||||
// Get already associated suppliers
|
||||
$associated_suppliers = ProductSupplier::getSupplierCollection($product->id);
|
||||
|
||||
$suppliers_to_associate = array();
|
||||
$new_default_supplier = 0;
|
||||
|
||||
if (Tools::isSubmit('default_supplier'))
|
||||
$new_default_supplier = (int)Tools::getValue('default_supplier');
|
||||
|
||||
// Get new associations
|
||||
foreach ($suppliers as $supplier)
|
||||
if (Tools::isSubmit('check_supplier_'.$supplier['id_supplier']))
|
||||
$suppliers_to_associate[] = $supplier['id_supplier'];
|
||||
|
||||
// Delete already associated suppliers if needed
|
||||
foreach ($associated_suppliers as &$associated_supplier)
|
||||
if (!in_array($associated_supplier->id_supplier, $suppliers_to_associate))
|
||||
$associated_supplier->delete();
|
||||
|
||||
// Associate suppliers
|
||||
foreach ($suppliers_to_associate as $id)
|
||||
{
|
||||
$to_add = true;
|
||||
foreach ($associated_suppliers as $as)
|
||||
if ($id == $as->id_supplier)
|
||||
$to_add = false;
|
||||
|
||||
if ($to_add)
|
||||
{
|
||||
$product_supplier = new ProductSupplier();
|
||||
$product_supplier->id_product = $product->id;
|
||||
$product_supplier->id_product_attribute = 0;
|
||||
$product_supplier->id_supplier = $id;
|
||||
$product_supplier->save();
|
||||
}
|
||||
}
|
||||
|
||||
// Manage defaut supplier for product
|
||||
if ($new_default_supplier != 0 && $new_default_supplier != $product->id_supplier && Supplier::supplierExists($new_default_supplier))
|
||||
{
|
||||
$product->id_supplier = $new_default_supplier;
|
||||
$product->update();
|
||||
}
|
||||
|
||||
$this->confirmations[] = $this->l('Suppliers of the product have been updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post traitment for supplier product references
|
||||
*/
|
||||
public function postProcessFormSupplierReferences()
|
||||
{
|
||||
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
||||
{
|
||||
// Get all id_product_attribute
|
||||
$attributes = $product->getAttributesResume($this->context->language->id);
|
||||
if (empty($attributes))
|
||||
$attributes[] = array(
|
||||
'id_product_attribute' => 0,
|
||||
'attribute_designation' => ''
|
||||
);
|
||||
|
||||
// get associated suppliers
|
||||
$associated_suppliers = ProductSupplier::getSupplierCollection($product->id);
|
||||
|
||||
// Get already associated suppliers and force to retreive product declinaisons
|
||||
$product_supplier_collection = ProductSupplier::getSupplierCollection($product->id, false);
|
||||
|
||||
// Manage references
|
||||
foreach ($attributes as $attribute)
|
||||
foreach ($associated_suppliers as $supplier)
|
||||
if (Tools::isSubmit('supplier_reference_'.$attribute['id_product'].'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier))
|
||||
{
|
||||
$reference = Tools::getValue('supplier_reference_'.$attribute['id_product'].'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier, '');
|
||||
|
||||
if (!empty($reference))
|
||||
{
|
||||
$existing_reference = ProductSupplier::getProductSupplierReference($attribute['id_product'], $attribute['id_product_attribute'], $supplier->id_supplier);
|
||||
|
||||
if (empty($existing_reference))
|
||||
{
|
||||
//create new record
|
||||
$product_supplier_entity = new ProductSupplier();
|
||||
$product_supplier_entity->id_product = $attribute['id_product'];
|
||||
$product_supplier_entity->id_product_attribute = $attribute['id_product_attribute'];
|
||||
$product_supplier_entity->id_supplier = $supplier->id_supplier;
|
||||
$product_supplier_entity->product_supplier_reference = pSQL($reference);
|
||||
$product_supplier_entity->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
//update existing record
|
||||
foreach ($product_supplier_collection as &$psc)
|
||||
if ($psc->id_product == $attribute['id_product']
|
||||
&& $psc->id_product_attribute == $attribute['id_product_attribute']
|
||||
&& $psc->id_supplier == $supplier->id_supplier
|
||||
)
|
||||
{
|
||||
$reference = pSQL($reference);
|
||||
|
||||
if ($reference != $psc->product_supplier_reference)
|
||||
{
|
||||
$psc->product_supplier_reference = pSQL($reference);
|
||||
$psc->save();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->confirmations[] = $this->l('Supplier Reference(s) of the product have been updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Init data for accounting
|
||||
*/
|
||||
@@ -2133,7 +2239,6 @@ if (false)
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
private function _getCustomizationFieldIds($labels, $alreadyGenerated, $obj)
|
||||
{
|
||||
$customizableFieldIds = array();
|
||||
@@ -2366,14 +2471,12 @@ if (false)
|
||||
$cache_default_attribute = (int) $this->getFieldValue($product, 'cache_default_attribute');
|
||||
$data->assign('feature_shop_active', Shop::isFeatureActive());
|
||||
$data->assign('displayAssoShop', $this->displayAssoShop());
|
||||
$data->assign('carrier_list', $this->getCarrierList());
|
||||
|
||||
|
||||
$product_props = array();
|
||||
// global informations
|
||||
array_push($product_props, 'reference', 'supplier_reference', 'ean13', 'upc', 'location',
|
||||
array_push($product_props, 'reference', 'ean13', 'upc', 'location',
|
||||
'available_for_order', 'show_price', 'online_only',
|
||||
'id_manufacturer', 'id_supplier'
|
||||
'id_manufacturer'
|
||||
);
|
||||
|
||||
// specific / detailled information
|
||||
@@ -2403,7 +2506,6 @@ if (false)
|
||||
$product->name['class'] .= ' copy2friendlyUrl';
|
||||
|
||||
$product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer);
|
||||
$product->supplier_name = Supplier::getNameById($product->id_supplier);
|
||||
|
||||
$data->assign('ps_dimension_unit', Configuration::get('PS_DIMENSION_UNIT'));
|
||||
$data->assign('ps_weight_unit', Configuration::get('PS_WEIGHT_UNIT'));
|
||||
@@ -2790,7 +2892,6 @@ if (false)
|
||||
$combArray[$combinaison['id_product_attribute']]['weight'] = $combinaison['weight'];
|
||||
$combArray[$combinaison['id_product_attribute']]['unit_impact'] = $combinaison['unit_price_impact'];
|
||||
$combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
|
||||
$combArray[$combinaison['id_product_attribute']]['supplier_reference'] = $combinaison['supplier_reference'];
|
||||
$combArray[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
|
||||
$combArray[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc'];
|
||||
$combArray[$combinaison['id_product_attribute']]['minimal_quantity'] = $combinaison['minimal_quantity'];
|
||||
@@ -2866,7 +2967,7 @@ if (false)
|
||||
$content .= '<td class="center">
|
||||
<a style="cursor: pointer;">
|
||||
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this combination').'"
|
||||
onclick="javascript:fillCombinaison(\''.$product_attribute['wholesale_price'].'\', \''.$product_attribute['price'].'\', \''.$product_attribute['weight'].'\', \''.$product_attribute['unit_impact'].'\', \''.$product_attribute['reference'].'\', \''.$product_attribute['supplier_reference'].'\', \''.$product_attribute['ean13'].'\',
|
||||
onclick="javascript:fillCombinaison(\''.$product_attribute['wholesale_price'].'\', \''.$product_attribute['price'].'\', \''.$product_attribute['weight'].'\', \''.$product_attribute['unit_impact'].'\', \''.$product_attribute['reference'].'\', \''.$product_attribute['ean13'].'\',
|
||||
\'0\', \''.($attrImage ? $attrImage->id : 0).'\', Array('.$jsList.'), \''.$id_product_attribute.'\', \''.$product_attribute['default_on'].'\', \''.$product_attribute['ecotax'].'\', \''.$product_attribute['location'].'\', \''.$product_attribute['upc'].'\', \''.$product_attribute['minimal_quantity'].'\', \''.$available_date.'\',
|
||||
\''.$product->productDownload->display_filename.'\', \''.$filename.'\', \''.$product->productDownload->nb_downloadable.'\', \''.$available_date_attribute.'\', \''.$product->productDownload->nb_days_accessible.'\', \''.$product->productDownload->is_shareable.'\'); calcImpactPriceTI();" /></a>
|
||||
'.(!$product_attribute['default_on'] ? '<a href="'.self::$currentIndex.'&defaultProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$product->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminProducts'.(int)(Tab::getIdFromClassName('AdminProducts')).$this->context->employee->id).'">
|
||||
@@ -2916,260 +3017,126 @@ if (false)
|
||||
|
||||
public function initFormQuantities($obj)
|
||||
{
|
||||
$data = $this->context->smarty->createData();
|
||||
|
||||
// Get all id_product_atribute
|
||||
$attributes = $obj->getAttributesResume($this->context->language->id);
|
||||
if (empty($attributes))
|
||||
$attributes[] = array(
|
||||
'id_product_attribute' => 0,
|
||||
'attribute_designation' => ''
|
||||
);
|
||||
|
||||
// Get physical quantities & available quantities
|
||||
$totalQuantity = 0;
|
||||
$physicalQuantity = array();
|
||||
$availableQuantity = array();
|
||||
$productDesignation = array();
|
||||
foreach ($attributes as $attribute)
|
||||
if ($this->object->id)
|
||||
{
|
||||
$physicalQuantity[$attribute['id_product_attribute']] = (int)StockManagerFactory::getManager()->getProductPhysicalQuantities((int)$obj->id, $attribute['id_product_attribute']);
|
||||
$totalQuantity += $physicalQuantity[$attribute['id_product_attribute']];
|
||||
// Get all id_product_attribute
|
||||
$attributes = $obj->getAttributesResume($this->context->language->id);
|
||||
if (empty($attributes))
|
||||
$attributes[] = array(
|
||||
'id_product_attribute' => 0,
|
||||
'attribute_designation' => ''
|
||||
);
|
||||
|
||||
// @TODO
|
||||
$availableQuantity[$attribute['id_product_attribute']] = StockAvailable::getIdStockAvailableByProductId((int)$obj->id, $attribute['id_product_attribute']);
|
||||
// Get physical quantities & available quantities
|
||||
$stock_manager = StockManagerFactory::getManager();
|
||||
$total_quantity = 0;
|
||||
$physical_quantity = array();
|
||||
$available_quantity = array();
|
||||
$product_designation = array();
|
||||
|
||||
// Get all product designation
|
||||
$productDesignation[$attribute['id_product_attribute']] = rtrim($obj->name[$this->context->language->id].' - '.$attribute['attribute_designation'], ' - ');
|
||||
foreach ($attributes as $attribute)
|
||||
{
|
||||
$physical_quantity[$attribute['id_product_attribute']] = (int)$stock_manager->getProductPhysicalQuantities(
|
||||
(int)$obj->id,
|
||||
(int)$attribute['id_product_attribute']
|
||||
);
|
||||
|
||||
$total_quantity += $physical_quantity[$attribute['id_product_attribute']];
|
||||
|
||||
// Get available quantity for the current product attribute in the current shop
|
||||
$available_quantity[$attribute['id_product_attribute']] = StockAvailable::getStockAvailableForProduct(
|
||||
(int)$obj->id,
|
||||
$attribute['id_product_attribute']
|
||||
);
|
||||
|
||||
// Get all product designation
|
||||
$product_designation[$attribute['id_product_attribute']] = rtrim($obj->name[$this->context->language->id].' - '.$attribute['attribute_designation'], ' - ');
|
||||
}
|
||||
|
||||
$data->assign(array(
|
||||
'attributes' => $attributes,
|
||||
'total_quantity' => $total_quantity,
|
||||
'physical_quantity' => $physical_quantity,
|
||||
'available_quantity' => $available_quantity,
|
||||
'product_designation' => $product_designation,
|
||||
'product' => $this->object,
|
||||
'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'),
|
||||
'token' => $this->token
|
||||
));
|
||||
}
|
||||
else
|
||||
$data->assign('content', '<b>'.$this->l('You must save this product before manage quantities').'.</b>');
|
||||
|
||||
$content = '
|
||||
<div class="tab-page" id="step8">
|
||||
<h4 class="tab">8. '.$this->l('Quantities').'</h4>
|
||||
<table cellpadding="5">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b>'.$this->l('Available stock in warehouses').'</b>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="separation"></div>
|
||||
<p>'.sprintf($this->l('There is %s quantities available in stock for this product'), '<b>'.$totalQuantity.'</b>').'</p>
|
||||
<table cellpadding="5" style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" style="text-align:center;vertical-align:top;">
|
||||
<table class="table" cellpadding="0" cellspacing="0" style="width:60%;margin-left:20%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.$this->l('Quantity').'</th>
|
||||
<th>'.$this->l('Designation').'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($attributes as $attribute)
|
||||
$content .= '
|
||||
<tr>
|
||||
<td>'.$physicalQuantity[$attribute['id_product_attribute']].'</td>
|
||||
<td>'.$productDesignation[$attribute['id_product_attribute']].'</td>
|
||||
</tr>';
|
||||
$content .= '
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<table cellpadding="5">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b>'.$this->l('Available quantities for sale').'</b>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="separation"></div>
|
||||
<div class="warn" id="available_quantity_ajax_msg" style="display: none;"></div>
|
||||
<div class="error" id="available_quantity_ajax_error_msg" style="display: none;"></div>
|
||||
<div class="conf" id="available_quantity_ajax_success_msg" style="display: none;"></div>
|
||||
';
|
||||
$content .= '
|
||||
<table cellpadding="5" style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" style="vertical-align:top;">
|
||||
<input '.(($obj->depends_on_stock) ? 'checked="checked"' : '' ).' type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/>
|
||||
<label style="float:none;font-weight:normal" for="depends_on_stock_1">'.$this->l('Available quantities for current product and its combinations are based on stock in the warehouses').'</label>
|
||||
<br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="vertical-align:top;">
|
||||
<input '.((!$obj->depends_on_stock) ? 'checked="checked"' : '' ).' type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/>
|
||||
<label style="float:none;font-weight:normal" for="depends_on_stock_0">'.$this->l('I want to specify available quantities manually, and manage my stock independently').'</label>
|
||||
<br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="text-align:center;vertical-align:top;">
|
||||
<table class="table" cellpadding="0" cellspacing="0" style="width:60%;margin-left:20%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:200px;">'.$this->l('Quantity').'</th>
|
||||
<th>'.$this->l('Designation').'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($attributes as $attribute)
|
||||
$content .= '
|
||||
<tr>
|
||||
<td class="available_quantity" id="qty_'.$attribute['id_product_attribute'].'">
|
||||
<span>'.$availableQuantity[$attribute['id_product_attribute']].'</span>
|
||||
<input type="text" value="'.$availableQuantity[$attribute['id_product_attribute']].'"/>
|
||||
</td>
|
||||
<td>'.$productDesignation[$attribute['id_product_attribute']].'</td>
|
||||
</tr>';
|
||||
$content .= '
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="when_out_of_stock">
|
||||
<td>
|
||||
<table style="margin-top: 15px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-left"><label>'.$this->l('When out of stock:').'</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input '.(($obj->out_of_stock == 0) ? 'checked="checked"' : '' ).' id="out_of_stock_1" type="radio" checked="checked" value="0" class="out_of_stock" name="out_of_stock">
|
||||
<label id="label_out_of_stock_1" class="t" for="out_of_stock_1">'.$this->l('Deny orders').'</label>
|
||||
<br>
|
||||
<input '.(($obj->out_of_stock == 1) ? 'checked="checked"' : '' ).' id="out_of_stock_2" type="radio" value="1" class="out_of_stock" name="out_of_stock">
|
||||
<label id="label_out_of_stock_2" class="t" for="out_of_stock_2">'.$this->l('Allow orders').'</label>
|
||||
<br>
|
||||
<input '.(($obj->out_of_stock == 2) ? 'checked="checked"' : '' ).' id="out_of_stock_3" type="radio" value="2" class="out_of_stock" name="out_of_stock">
|
||||
<label id="label_out_of_stock_3" class="t" for="out_of_stock_3">
|
||||
Default:
|
||||
<i>Deny orders</i>
|
||||
'.sprintf($this->l('(as set in %s)'),
|
||||
'<a onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?').'\');"
|
||||
href="index.php?tab=AdminPPreferences&token='.Tools::getAdminTokenLite('AdminPPreferences').'">
|
||||
'.$this->l('Preferences').'</a>').'
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>';
|
||||
$content .= '
|
||||
</div>
|
||||
<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();
|
||||
};
|
||||
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
||||
}
|
||||
|
||||
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();
|
||||
};
|
||||
public function initFormSuppliers($obj)
|
||||
{
|
||||
$data = $this->context->smarty->createData();
|
||||
|
||||
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();
|
||||
};
|
||||
if ($this->object->id)
|
||||
{
|
||||
// Get all id_product_attribute
|
||||
$attributes = $obj->getAttributesResume($this->context->language->id);
|
||||
if (empty($attributes))
|
||||
$attributes[] = array(
|
||||
'id_product_attribute' => 0,
|
||||
'attribute_designation' => ''
|
||||
);
|
||||
|
||||
var ajaxCall = function(data)
|
||||
$product_designation = array();
|
||||
|
||||
foreach ($attributes as $attribute)
|
||||
$product_designation[$attribute['id_product_attribute']] = rtrim($obj->name[$this->context->language->id].' - '.$attribute['attribute_designation'], ' - ');
|
||||
|
||||
// Get all available suppliers
|
||||
$suppliers = Supplier::getSuppliers();
|
||||
|
||||
// Get already associated suppliers
|
||||
$associated_suppliers = ProductSupplier::getSupplierCollection($this->object->id);
|
||||
|
||||
// Get already associated suppliers and force to retreive product declinaisons
|
||||
$product_supplier_collection = ProductSupplier::getSupplierCollection($this->object->id, false);
|
||||
|
||||
$default_supplier = 0;
|
||||
|
||||
foreach ($suppliers as &$supplier)
|
||||
{
|
||||
data.ajaxProductQuantity = 1;
|
||||
data.id_product = '.(int)$obj->id.';
|
||||
data.token = "'.$this->token.'";
|
||||
data.ajax = 1;
|
||||
data.controller = "AdminProducts";
|
||||
data.action = "productQuantity";
|
||||
showAjaxMsg(\''.$this->l('Saving data...').'\');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax-tab.php",
|
||||
data: data,
|
||||
dataType: \'json\',
|
||||
async : true,
|
||||
success: function(msg)
|
||||
$supplier['is_selected'] = false;
|
||||
$supplier['is_default'] = false;
|
||||
|
||||
foreach ($associated_suppliers as &$associated_supplier)
|
||||
if ($associated_supplier->id_supplier == $supplier['id_supplier'])
|
||||
{
|
||||
if (msg.error)
|
||||
$associated_supplier->name = $supplier['name'];
|
||||
$supplier['is_selected'] = true;
|
||||
|
||||
if ($this->object->id_supplier == $supplier['id_supplier'])
|
||||
{
|
||||
showAjaxError(\''.$this->l('Error durring saving data').'\');
|
||||
return;
|
||||
$supplier['is_default'] = true;
|
||||
$default_supplier = $supplier['id_supplier'];
|
||||
}
|
||||
showAjaxSuccess(\''.$this->l('Data saved').'\');
|
||||
},
|
||||
error: function(msg)
|
||||
{
|
||||
showAjaxError(\''.$this->l('Error durring saving data').'\');
|
||||
}
|
||||
});
|
||||
};
|
||||
var refreshQtyAvaibilityForm = function()
|
||||
{
|
||||
if ($(\'#depends_on_stock_0\').attr(\'checked\'))
|
||||
{
|
||||
$(\'.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).attr(\'value\')});
|
||||
if($(this).val() == 0)
|
||||
$(\'.available_quantity input\').trigger(\'change\');
|
||||
});
|
||||
$(\'.available_quantity\').find(\'input\').change(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())
|
||||
{
|
||||
window.clearInterval(it.intervalId);
|
||||
$(it).trigger(\'change\');
|
||||
$(it).trigger(\'click\');
|
||||
}
|
||||
}, 500, this, $(this).val())
|
||||
});
|
||||
$(\'.out_of_stock\').click(function(e)
|
||||
{
|
||||
ajaxCall({actionQty: \'out_of_stock\', value: $(this).val()});
|
||||
});
|
||||
refreshQtyAvaibilityForm();
|
||||
</script>';
|
||||
}
|
||||
|
||||
$this->tpl_form_vars['custom_form'] = $content;
|
||||
$data->assign(array(
|
||||
'attributes' => $attributes,
|
||||
'suppliers' => $suppliers,
|
||||
'default_supplier' => $default_supplier,
|
||||
'associated_suppliers' => $associated_suppliers,
|
||||
'associated_suppliers_collection' => $product_supplier_collection,
|
||||
'product_designation' => $product_designation,
|
||||
'product' => $this->object,
|
||||
'link' => $this->context->link,
|
||||
'token' => $this->token
|
||||
));
|
||||
}
|
||||
else
|
||||
$data->assign('content', '<b>'.$this->l('You must save this product before manage suppliers').'.</b>');
|
||||
|
||||
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
||||
}
|
||||
|
||||
public function initFormFeatures($obj)
|
||||
@@ -3214,23 +3181,6 @@ if (false)
|
||||
$data->assign('default_form_language', $this->default_form_language);
|
||||
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
||||
}
|
||||
|
||||
protected function getCarrierList()
|
||||
{
|
||||
$carrier_list = Carrier::getCarriers($this->context->language->id);
|
||||
if ($product = $this->loadObject(true))
|
||||
{
|
||||
$carrier_selected_list = $product->getCarriers();
|
||||
foreach ($carrier_list as &$carrier)
|
||||
foreach ($carrier_selected_list as $carrier_selected)
|
||||
if ($carrier_selected['id_reference'] == $carrier['id_reference'])
|
||||
{
|
||||
$carrier['selected'] = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return $carrier_list;
|
||||
}
|
||||
|
||||
public function ajaxProcessProductQuantity()
|
||||
{
|
||||
@@ -3359,8 +3309,6 @@ if (false)
|
||||
$this->tpl_form_vars['input_namepack_items'] = $input_namepack_items;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function updatePackItems($product)
|
||||
{
|
||||
Pack::deleteItems($product->id);
|
||||
|
||||
@@ -1022,11 +1022,14 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
//get the product name in the order language
|
||||
$entry->name = Product::getProductName($entry->id_product, $entry->id_product_attribute, $supply_order->id_lang);
|
||||
|
||||
//get the product name displayed in the backoffice according to the employee language
|
||||
$entry->name_displayed = Tools::getValue('input_name_'.$id, '');
|
||||
|
||||
if (empty($entry->name))
|
||||
$entry->name = $entry->name_displayed;
|
||||
$entry->name = '';
|
||||
|
||||
//get the product supplier reference
|
||||
$entry->supplier_reference = ProductSupplier::getProductSupplierReference($entry->id_product, $entry->id_product_attribute, $supply_order->id_supplier);
|
||||
|
||||
if ($entry->supplier_reference == null)
|
||||
$entry->supplier_reference = '';
|
||||
|
||||
$entry->exchange_rate = $currency->conversion_rate;
|
||||
$entry->id_currency = $currency->id;
|
||||
@@ -1034,6 +1037,9 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
|
||||
$errors = $entry->validateController();
|
||||
|
||||
//get the product name displayed in the backoffice according to the employee language
|
||||
$entry->name_displayed = Tools::getValue('input_name_'.$id, '');
|
||||
|
||||
// if there is a problem, handle error for the current product
|
||||
if (count($errors) > 0)
|
||||
{
|
||||
@@ -1098,14 +1104,20 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
if ($id_currency <= 0 || ( !($result = Currency::getCurrency($id_currency)) || empty($result) ))
|
||||
$this->_errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
|
||||
|
||||
// specify initial state
|
||||
$_POST['id_supply_order_state'] = 1; //defaut creation state
|
||||
if (!count($this->_errors))
|
||||
{
|
||||
// specify initial state
|
||||
$_POST['id_supply_order_state'] = 1; //defaut creation state
|
||||
|
||||
// specify global reference currency
|
||||
$_POST['id_ref_currency'] = Currency::getDefaultCurrency()->id;
|
||||
// specify global reference currency
|
||||
$_POST['id_ref_currency'] = Currency::getDefaultCurrency()->id;
|
||||
|
||||
//specific discount check
|
||||
$_POST['discount_rate'] = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('discount_rate', 0));
|
||||
// specify supplier name
|
||||
$_POST['supplier_name'] = Supplier::getNameById($id_supplier);
|
||||
|
||||
//specific discount check
|
||||
$_POST['discount_rate'] = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('discount_rate', 0));
|
||||
}
|
||||
|
||||
// manage each associated product
|
||||
$this->manageOrderProducts();
|
||||
@@ -1499,6 +1511,14 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
|
||||
// re-defines fieldsDisplay
|
||||
$this->fieldsDisplay = array(
|
||||
'supplier_reference' => array(
|
||||
'title' => $this->l('Supplier Reference'),
|
||||
'align' => 'center',
|
||||
'width' => 120,
|
||||
'orderby' => false,
|
||||
'filter' => false,
|
||||
'search' => false,
|
||||
),
|
||||
'reference' => array(
|
||||
'title' => $this->l('Reference'),
|
||||
'align' => 'center',
|
||||
@@ -1637,6 +1657,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
'supply_order_detail_content' => $content,
|
||||
'supply_order_warehouse' => (Validate::isLoadedObject($warehouse) ? $warehouse->name : ''),
|
||||
'supply_order_reference' => $supply_order->reference,
|
||||
'supply_order_supplier_name' => $supply_order->supplier_name,
|
||||
'supply_order_creation_date' => Tools::displayDate($supply_order->date_add, $lang_id, true),
|
||||
'supply_order_last_update' => Tools::displayDate($supply_order->date_upd, $lang_id, true),
|
||||
'supply_order_expected' => Tools::displayDate($supply_order->date_delivery_expected, $lang_id, true),
|
||||
|
||||
+14
-4
@@ -2100,6 +2100,7 @@ CREATE TABLE `PREFIX_stock_available` (
|
||||
CREATE TABLE `PREFIX_supply_order` (
|
||||
`id_supply_order` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_supplier` INT(11) UNSIGNED NOT NULL,
|
||||
`supplier_name` VARCHAR(64) NOT NULL,
|
||||
`id_lang` INT(11) UNSIGNED NOT NULL,
|
||||
`id_warehouse` INT(11) UNSIGNED NOT NULL,
|
||||
`id_supply_order_state` INT(11) UNSIGNED NOT NULL,
|
||||
@@ -2128,6 +2129,7 @@ CREATE TABLE `PREFIX_supply_order_detail` (
|
||||
`id_product` INT(11) UNSIGNED NOT NULL,
|
||||
`id_product_attribute` INT(11) UNSIGNED NOT NULL,
|
||||
`reference` VARCHAR(32) NOT NULL,
|
||||
`supplier_reference` VARCHAR(32) NOT NULL,
|
||||
`name` varchar(128) NOT NULL,
|
||||
`ean13` VARCHAR(13) DEFAULT NULL,
|
||||
`upc` VARCHAR(12) DEFAULT NULL,
|
||||
@@ -2197,15 +2199,23 @@ CREATE TABLE `PREFIX_supply_order_receipt_history` (
|
||||
KEY `id_supply_order_state` (`id_supply_order_state`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_product_supplier` (
|
||||
`id_product_supplier` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(11) UNSIGNED NOT NULL,
|
||||
`id_product_attribute` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`id_supplier` int(11) UNSIGNED NOT NULL,
|
||||
`product_supplier_reference` varchar(32) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_product_supplier`),
|
||||
UNIQUE KEY `id_product` (`id_product`,`id_product_attribute`,`id_supplier`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_supplier_rates` (
|
||||
`id_product` INT(11) UNSIGNED NOT NULL,
|
||||
`id_product_attribute` INT(11) UNSIGNED NOT NULL,
|
||||
`id_supplier` INT(11) UNSIGNED NOT NULL,
|
||||
`id_product_supplier` INT(11) UNSIGNED NOT NULL,
|
||||
`id_currency` INT(11) UNSIGNED NOT NULL,
|
||||
`quantity_min` INT(11) UNSIGNED NOT NULL,
|
||||
`quantity_max` INT(11) UNSIGNED NOT NULL,
|
||||
`price_te` DECIMAL(20,6) DEFAULT '0.000000',
|
||||
PRIMARY KEY (`id_product`, `id_product_attribute`, `id_supplier`, `quantity_min`, `quantity_max`)
|
||||
PRIMARY KEY (`id_product_supplier`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_accounting_zone_shop` (
|
||||
|
||||
@@ -220,6 +220,12 @@ INSERT INTO `PREFIX_product` (`id_product`, `indexed`, `id_supplier`, `id_manufa
|
||||
(8, 1, 0, 0, 1, 3, 0, 1, '0', 0.00, 0, 25.041806, 0.000000, '', NULL, 0, 2, 0, 0, 0, 0, 1, NOW(), NOW(), '0000-00-00'),
|
||||
(9, 1, 2, 2, 1, 3, 0, 1, '0', 0.00, 0, 124.581940, 0.000000, '', NULL, 0, 2, 0, 0, 0, 0, 1, NOW(), NOW(), '0000-00-00');
|
||||
|
||||
INSERT INTO `PREFIX_product_supplier` (`id_product_supplier`, `id_product`, `id_product_attribute`, `id_supplier`, `product_supplier_reference`) VALUES
|
||||
(1, 1, 0, 1, ''),
|
||||
(2, 2, 0, 1, ''),
|
||||
(3, 6, 0, 1, ''),
|
||||
(4, 7, 0, 1, '');
|
||||
|
||||
INSERT INTO `PREFIX_product_shop` (`id_product`, `id_shop`) (SELECT `id_product`, 1 FROM `PREFIX_product`);
|
||||
|
||||
INSERT INTO `PREFIX_product_lang` (`id_product`, `id_lang`, `description`, `description_short`, `link_rewrite`, `meta_description`, `meta_keywords`, `meta_title`, `name`, `available_now`, `available_later`) VALUES
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
var storeUsedGroups = {};
|
||||
|
||||
function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impact, reference, supplier_reference,
|
||||
function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impact, reference,
|
||||
ean, quantity, image, old_attr, id_product_attribute, default_attribute, eco_tax, location, upc, minimal_quantity, available_date,
|
||||
virtual_product_name_attribute, virtual_product_filename_attribute, virtual_product_nb_downloable, virtual_product_expiration_date_attribute,
|
||||
virtual_product_nb_days, is_shareable)
|
||||
@@ -52,7 +52,6 @@ virtual_product_nb_days, is_shareable)
|
||||
getE('virtual_product_expiration_date_attribute').value = virtual_product_expiration_date_attribute;
|
||||
getE('virtual_product_nb_days_attribute').value = virtual_product_nb_days;
|
||||
|
||||
getE('attribute_supplier_reference').value = supplier_reference;
|
||||
getE('attribute_ean13').value = ean;
|
||||
getE('attribute_upc').value = upc;
|
||||
getE('submitProductAttribute').value = modifyattributegroup;
|
||||
|
||||
Reference in New Issue
Block a user