// Fix bugs in AdminProductsController

This commit is contained in:
lLefevre committed 2011-12-09 13:37:08 +00:00
1 parent 8774d945d4
commit 540858527b
18 files changed
+547 -292

No files matched your search

+5 -6
View File
@@ -42,7 +42,7 @@
{if count($errors)} {* @todo what is ??? AND $this->_includeContainer *} {if count($errors)} {* @todo what is ??? AND $this->_includeContainer *}
<div class="error"> <div class="error">
<span style="float:right"><a id="hideError" href=""><img alt="X" src="../img/admin/close.png" /></a></span><img src="../img/admin/error2.png" /> <span style="float:right"><a id="hideError" href=""><img alt="X" src="../img/admin/close.png" /></a></span>
{if count($errors) == 1} {if count($errors) == 1}
{$errors[0]} {$errors[0]}
{else} {else}
@@ -78,17 +78,16 @@
<span style="float:right"> <span style="float:right">
<a id="hideWarn" href=""><img alt="X" src="../img/admin/close.png" /></a> <a id="hideWarn" href=""><img alt="X" src="../img/admin/close.png" /></a>
</span> </span>
<img src="../img/admin/warn2.png" />
{if count($warnings) > 1} {if count($warnings) > 1}
{l s='There are'} {count($warnings)} {l s='warnings'} {l s='There are'} {count($warnings)} {l s='warnings'}
{else}
{l s='There is'} {count($warnings)} {l s='warning'}
{/if}
<span style="margin-left:20px;" id="labelSeeMore"> <span style="margin-left:20px;" id="labelSeeMore">
<a id="linkSeeMore" href="#" style="text-decoration:underline">{l s='Click here to see more'}</a> <a id="linkSeeMore" href="#" style="text-decoration:underline">{l s='Click here to see more'}</a>
<a id="linkHide" href="#" style="text-decoration:underline;display:none">{l s='Hide warning'}</a> <a id="linkHide" href="#" style="text-decoration:underline;display:none">{l s='Hide warning'}</a>
</span> </span>
<ul style="display:none;" id="seeMore"> {else}
{l s='There is'} {count($warnings)} {l s='warning'} :
{/if}
<ul style="display:{if count($warnings) > 1}none{else}block{/if};" id="seeMore">
{foreach $warnings as $warning} {foreach $warnings as $warning}
<li>{$warning}</li> <li>{$warning}</li>
{/foreach} {/foreach}
@@ -23,11 +23,14 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<h4>{l s='Accounting'}</h4>
<div class="separation"></div> {if isset($product->id)}
{if !empty($error)}
<h4>{l s='Accounting'}</h4>
<div class="separation"></div>
{if !empty($error)}
<div class="hint" style="display:block">{$error}</div> <div class="hint" style="display:block">{$error}</div>
{else} {else}
<fieldset> <fieldset>
<legend>{l s='Account number'}</legend> <legend>{l s='Account number'}</legend>
<div class="hint" style="display:block"> <div class="hint" style="display:block">
@@ -46,4 +49,6 @@
</div> </div>
<div class="separation"></div> <div class="separation"></div>
</fieldset> </fieldset>
{/if}
{/if} {/if}
@@ -23,7 +23,9 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{if $obj->id}<input type="hidden" name="id_{$table}" value="{$obj->id}" />{/if}
{if isset($obj->id)}
<h4>{l s='Attachment'}</h4> <h4>{l s='Attachment'}</h4>
<div class="separation"></div> <div class="separation"></div>
<fieldset> <fieldset>
@@ -56,8 +58,8 @@
</div> </div>
<div class="small"><sup>*</sup> {l s='Required field'}</div> <div class="small"><sup>*</sup> {l s='Required field'}</div>
</fieldset> </fieldset>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<table> <table>
<tr> <tr>
<td> <td>
<p>{l s='Attachments for this product:'}</p> <p>{l s='Attachments for this product:'}</p>
@@ -69,25 +71,27 @@
<a href="#" id="removeAttachment" style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"> <a href="#" id="removeAttachment" style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px">
{l s='Remove'} &gt;&gt; {l s='Remove'} &gt;&gt;
</a> </a>
</td> </td>
<td style="padding-left:20px;"> <td style="padding-left:20px;">
<p>{l s='Available attachments:'}</p> <p>{l s='Available attachments:'}</p>
<select multiple id="selectAttachment2" style="width:300px;height:160px;"> <select multiple id="selectAttachment2" style="width:300px;height:160px;">
{foreach $attach2 as $attach} {foreach $attach2 as $attach}
<option value="{$attach.id_attachment}">{$attach.name}</option> <option value="{$attach.id_attachment}">{$attach.name}</option>
{/foreach} {/foreach}
</select><br /><br /> </select><br /><br />
<a href="#" id="addAttachment" style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"> <a href="#" id="addAttachment" style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px">
&lt;&lt; {l s='Add'} &lt;&lt; {l s='Add'}
</a> </a>
</div> </div>
</td> </td>
</tr> </tr>
</table> </table>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<input type="submit" name="submitAttachments" id="submitAttachments" value="{l s='Update attachments'}" class="button" /> <input type="submit" name="submitAttachments" id="submitAttachments" value="{l s='Update attachments'}" class="button" />
<script type="text/javascript"> <script type="text/javascript">
displayFlags(languages, id_language, allowEmployeeFormLang); displayFlags(languages, id_language, allowEmployeeFormLang);
</script> </script>
{/if}
@@ -24,7 +24,8 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<script type="text/javascript"> {if isset($product->id)}
<script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$('#id_mvt_reason').change(function(){ $('#id_mvt_reason').change(function(){
updateMvtStatus($(this).val()); updateMvtStatus($(this).val());
@@ -55,26 +56,26 @@
} }
}); });
}); });
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
var attrs = new Array(); var attrs = new Array();
var modifyattributegroup = "{l s='Modify this attribute combination' js=1}"; var modifyattributegroup = "{l s='Modify this attribute combination' js=1}";
attrs[0] = new Array(0, "---"); attrs[0] = new Array(0, "---");
{foreach from=$attributeJs key=idgrp item=group} {foreach from=$attributeJs key=idgrp item=group}
attrs[{$idgrp}] = new Array(0 attrs[{$idgrp}] = new Array(0
, '---' , '---'
{foreach from=$group key=idattr item=attrname} {foreach from=$group key=idattr item=attrname}
, "{$idattr}", "{$attrname|addslashes}" , "{$idattr}", "{$attrname|addslashes}"
{/foreach} {/foreach}
); );
{/foreach} {/foreach}
</script> </script>
<h4>{l s='Add or modify combinations for this product'}</h4> <h4>{l s='Add or modify combinations for this product'}</h4>
<div class="separation"></div> {l s='or go to'} <div class="separation"></div> {l s='or go to'}
&nbsp;<a class="button bt-icon" href="index.php?tab=AdminAttributeGenerator&id_product={$product->id}&attributegenerator&token={$token_generator}" onclick="return confirm('{l s='Are you sure you want to delete entered product information?'}');"><img src="../img/admin/appearance.gif" alt="combinations_generator" class="middle" title="{l s='Product combinations generator'}" /><span>{l s='Product combinations generator'}</span></a> &nbsp;<a class="button bt-icon" href="index.php?tab=AdminAttributeGenerator&id_product={$product->id}&attributegenerator&token={$token_generator}" onclick="return confirm('{l s='Are you sure you want to delete entered product information?'}');"><img src="../img/admin/appearance.gif" alt="combinations_generator" class="middle" title="{l s='Product combinations generator'}" /><span>{l s='Product combinations generator'}</span></a>
<div class="separation"></div> <div class="separation"></div>
<div id="add_new_combination" style="display: none;"> <div id="add_new_combination" style="display: none;">
<table cellpadding="5" style="width:100%"> <table cellpadding="5" style="width:100%">
<tr> <tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top"> <td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
@@ -330,6 +331,7 @@
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
{$list} {$list}
{/if}
@@ -23,10 +23,11 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<h4>{l s='Add or modify customizable properties'}</h4> {if isset($obj->id)}
<h4>{l s='Add or modify customizable properties'}</h4>
<div class="separation"></div><br /> <div class="separation"></div><br />
<table cellpadding="5" style="width:100%"> <table cellpadding="5" style="width:100%">
<tr> <tr>
<td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">{l s='File fields:'}</td> <td style="width:150px;text-align:right;padding-right:10px;font-weight:bold;vertical-align:top;" valign="top">{l s='File fields:'}</td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
@@ -75,4 +76,5 @@
{/if} {/if}
</td> </td>
</tr> </tr>
</table> </table>
{/if}
+48 -18
View File
@@ -1,23 +1,51 @@
<h4>{l s='Assign features to this product:'}</h4> {*
<div class="separation"></div> * 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if isset($product->id)}
<h4>{l s='Assign features to this product:'}</h4>
<div class="separation"></div>
<ul> <ul>
<li>{l s='You can specify a value for each relevant feature regarding this product, empty fields will not be displayed.'}</li> <li>{l s='You can specify a value for each relevant feature regarding this product, empty fields will not be displayed.'}</li>
<li>{l s='You can either set a specific value, or select among existing pre-defined values you added previously.'}</li> <li>{l s='You can either set a specific value, or select among existing pre-defined values you added previously.'}</li>
</ul> </ul>
</td> </td>
</tr> </tr>
</table> </table>
<br /> <br />
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:900px;"> <table border="0" cellpadding="0" cellspacing="0" class="table" style="width:900px;">
<tr> <tr>
<th>{l s='Feature'}</td> <th>{l s='Feature'}</td>
<th style="width:30%">{l s='Pre-defined value'}</td> <th style="width:30%">{l s='Pre-defined value'}</td>
<th style="width:40%"><u>{l s='or'}</u> {l s='Customized value'}</td> <th style="width:40%"><u>{l s='or'}</u> {l s='Customized value'}</td>
</tr> </tr>
</table> </table>
{foreach from=$available_features item=available_feature} {foreach from=$available_features item=available_feature}
<table cellpadding="5" style="width: 900px; margin-top: 10px"> <table cellpadding="5" style="width: 900px; margin-top: 10px">
<tr> <tr>
<td>{$available_feature.name}</td> <td>{$available_feature.name}</td>
<td style="width: 30%"> <td style="width: 30%">
{if sizeof($available_feature.featureValues)} {if sizeof($available_feature.featureValues)}
@@ -47,20 +75,22 @@
</div> </div>
{/foreach} {/foreach}
</td> </td>
</tr> </tr>
{foreachelse} {foreachelse}
<tr><td colspan="3" style="text-align:center;">{l s='No features defined'}</td></tr> <tr><td colspan="3" style="text-align:center;">{l s='No features defined'}</td></tr>
{/foreach} {/foreach}
</table> </table>
<div class="separation"></div> <div class="separation"></div>
<div style="text-align:center;"> <div style="text-align:center;">
<a href="{$link->getAdminLink('AdminFeatures')}&amp;addfeature" onclick="return confirm('{l s='You will lose all modifications not saved, you may want to save modifications first?' js=1}');"> <a href="{$link->getAdminLink('AdminFeatures')}&amp;addfeature" onclick="return confirm('{l s='You will lose all modifications not saved, you may want to save modifications first?' js=1}');">
<img src="../img/admin/add.gif" alt="new_features" title="{l s='Add a new feature'}" />&nbsp;{l s='Add a new feature'} <img src="../img/admin/add.gif" alt="new_features" title="{l s='Add a new feature'}" />&nbsp;{l s='Add a new feature'}
</a> </a>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
displayFlags(languages, id_language, allowEmployeeFormLang); displayFlags(languages, id_language, allowEmployeeFormLang);
</script> </script>
{/if}
+28 -63
View File
@@ -27,7 +27,7 @@
{extends file="helper/form/form.tpl"} {extends file="helper/form/form.tpl"}
{block name="defaultForm"} {block name="defaultForm"}
<div> <div>
<div class="productTabs"> <div class="productTabs">
<ul class="tab"> <ul class="tab">
{foreach $product_tabs key=numStep item=tab} {foreach $product_tabs key=numStep item=tab}
@@ -37,43 +37,19 @@
{/foreach} {/foreach}
</ul> </ul>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
function showSaveButtons() var toload = new Array();
{ var pos_select = {$pos_select};
$('#desc-product-save').show();
$('#desc-product-cancel').show();
$('#desc-product-duplicate').show();
$('#desc-product-delete').show();
$('#desc-product-save-and-stay').show();
}
function hideSaveButtons() $(document).ready(function(){
{
$('#desc-product-save').hide();
$('#desc-product-cancel').hide();
$('#desc-product-duplicate').hide();
$('#desc-product-delete').hide();
$('#desc-product-save-and-stay').hide();
}
var toload = new Array();
var pos_select = {$pos_select};
var tabs_toolbar_save_buttons = [];
{foreach $tabs_toolbar_save_buttons key=key item=value}
{if $value == true}
tabs_toolbar_save_buttons.push('{$key}');
{/if}
{/foreach}
$(document).ready(function(){
$('#desc-product-newCombination').hide(); $('#desc-product-newCombination').hide();
{* submenu binding *} {* submenu binding *}
$(".tab-page").click(function(e){ $(".tab-page").click(function(e){
e.preventDefault(); e.preventDefault();
// currentId is the current producttab id // currentId is the current product tab id
currentId = $(".productTabs a.selected").attr('id').substr(5); currentId = $(".productTabs a.selected").attr('id').substr(5);
// id is the wanted producttab id // id is the wanted producttab id
id = $(this).attr('id').substr(5); id = $(this).attr('id').substr(5);
@@ -83,12 +59,6 @@ $(document).ready(function(){
var btn_name = id.substr(split_position); var btn_name = id.substr(split_position);
$("#product_form_submit_btn").attr('name', 'submit'+btn_name); $("#product_form_submit_btn").attr('name', 'submit'+btn_name);
// Show/hide save buttons
if (jQuery.inArray(btn_name, tabs_toolbar_save_buttons) != -1)
showSaveButtons();
else
hideSaveButtons();
if ($(this).attr("id") != $(".productTabs a.selected").attr('id')) if ($(this).attr("id") != $(".productTabs a.selected").attr('id'))
{ {
$(".tab-page").removeClass('selected'); $(".tab-page").removeClass('selected');
@@ -153,12 +123,12 @@ $(document).ready(function(){
{if $show_product_tab_content} {if $show_product_tab_content}
$("div.productTabs a[id$=-{$show_product_tab_content}]").click(); $("div.productTabs a[id$=-{$show_product_tab_content}]").click();
{/if} {/if}
}); });
</script>
</script> {***********************************************}
{***********************************************} {********** TO CHECK !!!!!!!!!!!!!!! ***********}
{********** TO CHECK !!!!!!!!!!!!!!! ***********} <script type="text/javascript">
<script type="text/javascript">
// <![CDATA[ // <![CDATA[
ThickboxI18nImage = "{l s='Image'}"; ThickboxI18nImage = "{l s='Image'}";
ThickboxI18nOf = "{l s='of'}"; ThickboxI18nOf = "{l s='of'}";
@@ -168,8 +138,9 @@ $(document).ready(function(){
ThickboxI18nPrev = "{l s='< Previous'}"; ThickboxI18nPrev = "{l s='< Previous'}";
tb_pathToImage = "../img/loadingAnimation.gif"; tb_pathToImage = "../img/loadingAnimation.gif";
//]]> //]]>
</script> </script>
<script type="text/javascript">
<script type="text/javascript">
//<![CDATA[ //<![CDATA[
function toggleVirtualProduct(elt) function toggleVirtualProduct(elt)
{ {
@@ -265,13 +236,13 @@ $(document).ready(function(){
); );
} }
//]]> //]]>
</script> </script>
<form id="product_form" action="{$form_action}" method="post" enctype="multipart/form-data" name="product"> <form id="product_form" action="{$form_action}" method="post" enctype="multipart/form-data" name="product">
<input type="hidden" name="id_product" value="{$id_product}" /> <input type="hidden" name="id_product" value="{$id_product}" />
<input type="hidden" name="tabs" id="tabs" value="0" /> <input type="hidden" name="tabs" id="tabs" value="0" />
<div class="tab-pane" id="tabPane1"> <div class="tab-pane" id="tabPane1">
{if !$product->active} {if !$product->active}
<div class="warn draft" > <div class="warn draft" >
<p> <p>
<span style="float: left"> <span style="float: left">
@@ -281,25 +252,19 @@ $(document).ready(function(){
<br /> <br />
</p> </p>
</div> </div>
{/if} {/if}
{* all input are here *} {* all input are here *}
<div id="product-tab-content-wait" style="display:none" >{l s='loading ...'}</div> <div id="product-tab-content-wait" style="display:none" >{l s='loading ...'}</div>
{if !$newproduct}
{foreach $product_tabs key=numStep item=tab} {foreach $product_tabs key=numStep item=tab}
<div id="product-tab-content-{$tab.id}" class="{if !$tab.selected}not-loaded{/if} product-tab-content" {if !$tab.selected}style="display:none"{/if}> <div id="product-tab-content-{$tab.id}" class="{if !$tab.selected}not-loaded{/if} product-tab-content" {if !$tab.selected}style="display:none"{/if}>
{if $tab.selected}{$custom_form}{/if} {if $tab.selected}{$custom_form}{/if}
</div> </div>
{/foreach} {/foreach}
{else} </div>
<div id="product-tab-content-1" class="product-tab-content">{$custom_form}</div> <input type="hidden" name="id_product_attribute" id="id_product_attribute" value="0" />
{/if} <input id="product_form_submit_btn" type="submit" value="{l s='Save'}" name="submitAddproduct" class="button" />
</div> </form>
<input type="hidden" name="id_product_attribute" id="id_product_attribute" value="0" />
<input id="product_form_submit_btn" type="submit" value="{l s='Save'}" name="submitAddproduct" class="button" /> <br/>
</form> {/block}
</div>
<br/>
{/block}
{*a href="{$link->getAdminLink('AdminCatalog')}"><img src="../img/admin/arrow2.gif" />{l s='Back to list'}</a><br/>
*}
+35 -6
View File
@@ -1,6 +1,33 @@
<div class="tab-page" id="step2"> {*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if isset($id_product) && isset($product)}
<h4 class="tab" >2. {l s='Images'} (<span id="countImage">{$countImages}</span>)</h4> <h4 class="tab" >2. {l s='Images'} (<span id="countImage">{$countImages}</span>)</h4>
<h4>{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}</h4> <div class="separation"></div><br /> <h4>{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}</h4> <div class="separation"></div><br />
<table cellpadding="5" style="width:100%"> <table cellpadding="5" style="width:100%">
<tr> <tr>
<td class="col-left"><label>{l s='File:'}</label></td> <td class="col-left"><label>{l s='File:'}</label></td>
@@ -46,8 +73,8 @@
</td> </td>
</tr> </tr>
</table> </table>
</div>
<table id="lineType" style="display:none;"> <table id="lineType" style="display:none;">
<tr id="image_id"> <tr id="image_id">
<td style="padding: 4px;"> <td style="padding: 4px;">
<a href="image_path.jpg" target="_blank"> <a href="image_path.jpg" target="_blank">
@@ -73,8 +100,9 @@
</a> </a>
</td> </td>
</tr> </tr>
</table> </table>
<script type="text/javascript">
<script type="text/javascript">
var upbutton = '{l s='Upload a file'}'; var upbutton = '{l s='Upload a file'}';
var token = '{$token}'; var token = '{$token}';
var come_from = '{$table}'; var come_from = '{$table}';
@@ -295,4 +323,5 @@
} }
}); });
{/literal} {/literal}
</script> </script>
{/if}
@@ -1,3 +1,29 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div id="step1"> <div id="step1">
<h4 class="tab">1. {l s='Info.'}</h4> <h4 class="tab">1. {l s='Info.'}</h4>
<h4>{l s='Product global information'}</h4> <h4>{l s='Product global information'}</h4>
@@ -1,3 +1,29 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="translatable"> <div class="translatable">
{foreach from=$languages item=language} {foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display:none;{/if}float: left;"> <div class="lang_{$language.id_lang}" style="{if !$language.is_default}display:none;{/if}float: left;">
+56 -18
View File
@@ -1,14 +1,33 @@
<script type="text/javascript" src="{$smarty.const._PS_JS_DIR_}price.js"></script> {*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="block_specific_prices_modifications"> <div class="block_specific_prices_modifications">
<h4>{l s='Product price'}</h4> <h4>{l s='Product price'}</h4>
<div class="separation"></div> <div class="separation"></div>
<script type="text/javascript"> <table>
var product_prices = new Array();
{foreach from=$combinations item='combination'}
product_prices['{$combination.id_product_attribute}'] = '{$combination.price}';
{/foreach}
</script>
<table>
<tr> <tr>
<td class="col-left"><label>{l s='Pre-tax wholesale price:'}</label></td> <td class="col-left"><label>{l s='Pre-tax wholesale price:'}</label></td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
@@ -116,13 +135,20 @@ var product_prices = new Array();
<div class="hint clear" style="display: block;width: 70%;">{l s='You can define many discounts and specific price rules in the Prices tab'}</div> <div class="hint clear" style="display: block;width: 70%;">{l s='You can define many discounts and specific price rules in the Prices tab'}</div>
</td> </td>
</tr> </tr>
{* [end] prices *} </table>
</table> <div class="separation"></div>
<div class="separation"></div>
<h4>{l s='Current specific prices'}</h4> {if isset($specificPriceModificationForm)}
<a class="button bt-icon" href="#" onclick="$('#add_specific_price').slideToggle();return false;"><img src="../img/admin/add.gif" alt="" /><span>{l s='Add a new specific price'}</span></a> <h4>{l s='Current specific prices'}</h4>
<br/> <a class="button bt-icon" href="#" onclick="$('#add_specific_price').slideToggle();return false;"><img src="../img/admin/add.gif" alt="" /><span>{l s='Add a new specific price'}</span></a>
<div id="add_specific_price" style="display: none;"> <br/>
<script type="text/javascript">
var product_prices = new Array();
{foreach from=$combinations item='combination'}
product_prices['{$combination.id_product_attribute}'] = '{$combination.price}';
{/foreach}
</script>
<div id="add_specific_price" style="display: none;">
<input type="hidden" name="sp_id_shop" value="0" /> <input type="hidden" name="sp_id_shop" value="0" />
<label>{l s='For:'}</label> <label>{l s='For:'}</label>
<div class="margin-form"> <div class="margin-form">
@@ -195,10 +221,19 @@ var product_prices = new Array();
{/if} {/if}
</label> </label>
<div class="margin-form"> <div class="margin-form">
<span id="spm_currency_sign_pre_0" style="font-weight:bold; color:#000000; font-size:12px">{$currency->prefix}</span> <span id="spm_currency_sign_pre_0" style="font-weight:bold; color:#000000; font-size:12px">
{$currency->prefix}
</span>
<input type="text" name="sp_price" value="0" size="11" /> <input type="text" name="sp_price" value="0" size="11" />
<span id="spm_currency_sign_post_0" style="font-weight:bold; color:#000000; font-size:12px">{$currency->suffix}</span> <span id="spm_currency_sign_post_0" style="font-weight:bold; color:#000000; font-size:12px">
<span>({l s='Current:'} </span><span id="sp_current_ht_price">{displayWtPrice p=$product->price}</span> )</span> {$currency->suffix}
</span>
<span>
(
{l s='Current:'}
<span id="sp_current_ht_price">{displayWtPrice p=$product->price}</span>
)
</span>
<div class="hint" style="display:block;"> <div class="hint" style="display:block;">
{l s='You can set this value at 0 in order to apply the default price'} {l s='You can set this value at 0 in order to apply the default price'}
</div> </div>
@@ -219,6 +254,7 @@ var product_prices = new Array();
<input type="submit" name="submitPriceAddition" value="{l s='Add'}" class="button" /> <input type="submit" name="submitPriceAddition" value="{l s='Add'}" class="button" />
</div> </div>
</div> </div>
<table style="text-align: center;width:100%" class="table" cellpadding="0" cellspacing="0"> <table style="text-align: center;width:100%" class="table" cellpadding="0" cellspacing="0">
<thead> <thead>
<tr> <tr>
@@ -242,3 +278,5 @@ var product_prices = new Array();
calcPriceTI(); calcPriceTI();
unitPriceWithTax('unit'); unitPriceWithTax('unit');
</script> </script>
{/if}
@@ -1,4 +1,32 @@
<h4>{l s='Available quantities for sale'}</h4> {*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 11069 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if isset($product->id)}
<h4>{l s='Available quantities for sale'}</h4>
<div class="separation"></div> <div class="separation"></div>
<div class="hint" style="display:block; position:'auto';"> <div class="hint" style="display:block; position:'auto';">
<p>{l s='This interface allows you to manage the available quantities for sale of the current product and its combinations on the current shop.'}</p> <p>{l s='This interface allows you to manage the available quantities for sale of the current product and its combinations on the current shop.'}</p>
@@ -100,7 +128,7 @@
</div> </div>
{/if} {/if}
<script type="text/javascript"> <script type="text/javascript">
var showAjaxError = function(msg) var showAjaxError = function(msg)
{ {
$('#available_quantity_ajax_error_msg').html(msg); $('#available_quantity_ajax_error_msg').html(msg);
@@ -214,4 +242,6 @@
}); });
refreshQtyAvaibilityForm(); refreshQtyAvaibilityForm();
</script> </script>
{/if}
@@ -1,15 +1,43 @@
<h4>{l s='Suppliers of the current product'}</h4> {*
<div class="separation"></div> * 2007-2011 PrestaShop
<div class="hint" style="display:block; position:'auto';"> *
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 11069 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if isset($product->id)}
<h4>{l s='Suppliers of the current product'}</h4>
<div class="separation"></div>
<div class="hint" style="display:block; position:'auto';">
<p>{l s='This interface allows you to specify the suppliers of the current product and eventually its combinations.'}</p> <p>{l s='This interface allows you to specify the suppliers of the current product and eventually its combinations.'}</p>
<p>{l s='It is also possible to specify for each product/product combinations the supplier reference according to previously associated suppliers.'}</p> <p>{l s='It is also possible to specify for each product/product combinations the supplier reference according to previously associated suppliers.'}</p>
</div> </div>
<p>{l s='Please choose the suppliers associated to this product, and the default one.'}</p> <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?"} {assign var=confirm value="Are you sure you want to delete entered product information?"}
<a class="button bt-icon" href="{$link->getAdminLink('AdminSuppliers')}&addsupplier" onclick="return confirm(' {$confirm} ')"> <a class="button bt-icon" href="{$link->getAdminLink('AdminSuppliers')}&addsupplier" onclick="return confirm(' {$confirm} ')">
<img src="../img/admin/add.gif" alt="{l s='Create new supplier'}" title="{l s='Create new supplier'}" /><span>{l s='Create new supplier'}</span> <img src="../img/admin/add.gif" alt="{l s='Create new supplier'}" title="{l s='Create new supplier'}" /><span>{l s='Create new supplier'}</span>
</a> </a>
<table cellpadding="5" style="width:100%"> <table cellpadding="5" style="width:100%">
<tbody> <tbody>
<tr> <tr>
<td valign="top" style="text-align:left;vertical-align:top;"> <td valign="top" style="text-align:left;vertical-align:top;">
@@ -34,13 +62,13 @@
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>&nbsp;</p> <p>&nbsp;</p>
<h4>{l s='Product reference(s)'}</h4> <h4>{l s='Product reference(s)'}</h4>
<div class="separation"></div> <div class="separation"></div>
<p>{l s='You can specify product reference(s) for each supplier associated.'}</p> <p>{l s='You can specify product reference(s) for each supplier associated.'}</p>
<div id="suppliers_accordion" style="margin-top:10px; display:block;"> <div id="suppliers_accordion" style="margin-top:10px; display:block;">
{foreach from=$associated_suppliers item=supplier} {foreach from=$associated_suppliers item=supplier}
<h3 style="margin-bottom:0;"><a href="#">{$supplier->name}</a></h3> <h3 style="margin-bottom:0;"><a href="#">{$supplier->name}</a></h3>
<div style="display:block;"> <div style="display:block;">
@@ -90,9 +118,9 @@
</table> </table>
</div> </div>
{/foreach} {/foreach}
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
var default_is_ok = false; var default_is_ok = false;
@@ -162,4 +190,6 @@
$('#suppliers_accordion').accordion(); $('#suppliers_accordion').accordion();
}, 500); }, 500);
}); });
</script> </script>
{/if}
@@ -1,3 +1,29 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="translatable"> <div class="translatable">
{foreach from=$languages item=language} {foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display:none;{/if}float: left;"> <div class="lang_{$language.id_lang}" style="{if !$language.is_default}display:none;{/if}float: left;">
@@ -1,18 +1,46 @@
<h4>{l s='Product location in warehouses'}</h4> {*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 11069 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if isset($product->id)}
<h4>{l s='Product location in warehouses'}</h4>
<div class="separation"></div> <div class="separation"></div>
<div class="hint" style="display:block; position:'auto';"> <div class="hint" style="display:block; position:'auto';">
<p>{l s='This interface allows you to specify in which warehouses the product is stocked.'}</p> <p>{l s='This interface allows you to specify in which warehouses the product is stocked.'}</p>
<p>{l s='It is also possible to specify for each product/product combinations its location in each warehouse.'}</p> <p>{l s='It is also possible to specify for each product/product combinations its location in each warehouse.'}</p>
</div> </div>
<p>{l s='Please choose the warehouses associated to this product, and the default one.'}</p> <p>{l s='Please choose the warehouses associated to this product, and the default one.'}</p>
{assign var=confirm value="Are you sure you want to delete entered product information?"} {assign var=confirm value="Are you sure you want to delete entered product information?"}
<a class="button bt-icon" href="{$link->getAdminLink('AdminWarehouses')}&addwarehouse" onclick="return confirm(' {$confirm} ')"> <a class="button bt-icon" href="{$link->getAdminLink('AdminWarehouses')}&addwarehouse" onclick="return confirm(' {$confirm} ')">
<img src="../img/admin/add.gif" alt="{l s='Create new warehouse'}" title="{l s='Create new warehouse'}" /><span>{l s='Create new warehouse'}</span> <img src="../img/admin/add.gif" alt="{l s='Create new warehouse'}" title="{l s='Create new warehouse'}" /><span>{l s='Create new warehouse'}</span>
</a> </a>
<div id="warehouse_accordion" style="margin-top:10px; display:block;"> <div id="warehouse_accordion" style="margin-top:10px; display:block;">
{foreach from=$warehouses item=warehouse} {foreach from=$warehouses item=warehouse}
<h3 style="margin-bottom:0;"><a href="#">{$warehouse['name']}</a></h3> <h3 style="margin-bottom:0;"><a href="#">{$warehouse['name']}</a></h3>
<div style="display:block;"> <div style="display:block;">
@@ -55,10 +83,10 @@
</table> </table>
</div> </div>
{/foreach} {/foreach}
</div> </div>
<p>&nbsp;</p> <p>&nbsp;</p>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('#check_all_suppliers').click(function() { $('#check_all_suppliers').click(function() {
var check = $(this); var check = $(this);
@@ -85,4 +113,6 @@
$('#warehouse_accordion').accordion(); $('#warehouse_accordion').accordion();
}, 500); }, 500);
}); });
</script> </script>
{/if}
+2 -1
View File
@@ -33,6 +33,7 @@
<div>{$btn.desc}</div> <div>{$btn.desc}</div>
</a> </a>
</li> </li>
{/foreach}
{if isset($ps_help_context) && $ps_help_context} {if isset($ps_help_context) && $ps_help_context}
<li class="help-context" style="display:none"> <li class="help-context" style="display:none">
<a id="desc-{$table}-help" class="toolbar_btn" href="#" title="{l s='Help'}"> <a id="desc-{$table}-help" class="toolbar_btn" href="#" title="{l s='Help'}">
@@ -41,8 +42,8 @@
</a> </a>
</li> </li>
{/if} {/if}
{/foreach}
</ul> </ul>
<script language="javascript"> <script language="javascript">
$(function() { $(function() {
//get reference on save link //get reference on save link
+13 -6
View File
@@ -361,16 +361,21 @@ class SearchCore
{ {
// Adjust the limit to get only "whole" products, in every languages (and at least one) // Adjust the limit to get only "whole" products, in every languages (and at least one)
$limit = max(1, round($limit / $total_languages) * $total_languages); $limit = max(1, round($limit / $total_languages) * $total_languages);
return Db::getInstance()->executeS(' return Db::getInstance()->executeS('
SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc, SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc,
pl.description_short, pl.description, cl.name cname, m.name mname pl.description_short, pl.description, cl.name cname, m.name mname
FROM '._DB_PREFIX_.'product p FROM '._DB_PREFIX_.'product p
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON p.id_product = pl.id_product LEFT JOIN '._DB_PREFIX_.'product_lang pl
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default AND pl.id_lang = cl.id_lang) ON p.id_product = pl.id_product
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON m.id_manufacturer = p.id_manufacturer LEFT JOIN '._DB_PREFIX_.'category_lang cl
ON (cl.id_category = p.id_category_default AND pl.id_lang = cl.id_lang)
LEFT JOIN '._DB_PREFIX_.'manufacturer m
ON m.id_manufacturer = p.id_manufacturer
WHERE p.indexed = 0 WHERE p.indexed = 0
'.($id_product ? 'AND p.id_product = '.(int)$id_product : '').' '.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
LIMIT '.(int)$limit); LIMIT '.(int)$limit
);
} }
public static function indexation($full = false, $id_product = false) public static function indexation($full = false, $id_product = false)
@@ -392,7 +397,8 @@ class SearchCore
$products = $db->executeS(' $products = $db->executeS('
SELECT id_product SELECT id_product
FROM '._DB_PREFIX_.'product FROM '._DB_PREFIX_.'product
WHERE '.($id_product ? 'id_product = '.(int)$id_product : 'indexed = 0')); WHERE '.($id_product ? 'id_product = '.(int)$id_product : 'indexed = 0')
);
$ids = array(); $ids = array();
if ($products) if ($products)
@@ -440,7 +446,8 @@ class SearchCore
// Products are processed 50 by 50 in order to avoid overloading MySQL // Products are processed 50 by 50 in order to avoid overloading MySQL
$count = count($products); $count = count($products);
while ($products = Search::getProductsToIndex($total_languages, $id_product, 50) && $count > 0) $products = Search::getProductsToIndex($total_languages, $id_product, 50);
while ($products && $count > 0)
{ {
// Now each non-indexed product is processed one by one, langage by langage // Now each non-indexed product is processed one by one, langage by langage
foreach ($products as $product) foreach ($products as $product)
+115 -110
View File
@@ -38,8 +38,8 @@ class AdminProductsControllerCore extends AdminController
protected $available_tabs = array( protected $available_tabs = array(
'Informations', 'Informations',
'Images',
'Prices', 'Prices',
'Images',
'Combinations', 'Combinations',
'Features', 'Features',
'Customization', 'Customization',
@@ -52,20 +52,6 @@ class AdminProductsControllerCore extends AdminController
protected $available_tabs_lang = array (); protected $available_tabs_lang = array ();
protected $tabs_toolbar_save_buttons = array(
'Informations' => true,
'Images' => false,
'Prices' => false,
'Combinations' => false,
'Features' => true,
'Customization' => false,
'Attachments' => true,
'Quantities' => false,
'Suppliers' => true,
'Warehouses' => true,
'Accounting' => true
);
public function __construct() public function __construct()
{ {
$this->table = 'product'; $this->table = 'product';
@@ -97,8 +83,8 @@ class AdminProductsControllerCore extends AdminController
// @since 1.5 : translations for tabs // @since 1.5 : translations for tabs
$this->available_tabs_lang = array ( $this->available_tabs_lang = array (
'Informations' => $this->l('Informations'), 'Informations' => $this->l('Informations'),
'Images' => $this->l('Images'),
'Prices' => $this->l('Prices'), 'Prices' => $this->l('Prices'),
'Images' => $this->l('Images'),
'Combinations' => $this->l('Combinations'), 'Combinations' => $this->l('Combinations'),
'Features' => $this->l('Features'), 'Features' => $this->l('Features'),
'Customization' => $this->l('Customization'), 'Customization' => $this->l('Customization'),
@@ -1146,7 +1132,7 @@ class AdminProductsControllerCore extends AdminController
public function addProductImage($product, $method = 'auto') public function addProductImage($product, $method = 'auto')
{ {
/* Updating an existing product image */ /* Updating an existing product image */
if ($id_image = ((int)(Tools::getValue('id_image')))) if ($id_image = (int)Tools::getValue('id_image'))
{ {
$image = new Image($id_image); $image = new Image($id_image);
if (!Validate::isLoadedObject($image)) if (!Validate::isLoadedObject($image))
@@ -1170,7 +1156,7 @@ class AdminProductsControllerCore extends AdminController
return false; return false;
@unlink(_PS_TMP_IMG_DIR_.'/product_'.$product->id.'.jpg'); @unlink(_PS_TMP_IMG_DIR_.'/product_'.$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'/product_mini_'.$product->id.'.jpg'); @unlink(_PS_TMP_IMG_DIR_.'/product_mini_'.$product->id.'.jpg');
return ((isset($id_image) && is_int($id_image) && $id_image) ? $id_image : true); return ((isset($id_image) && is_int($id_image) && $id_image) ? $id_image : false);
} }
/** /**
* Copy a product image * Copy a product image
@@ -1381,7 +1367,7 @@ class AdminProductsControllerCore extends AdminController
{ {
Hook::exec('addProduct', array('product' => $object)); Hook::exec('addProduct', array('product' => $object));
Search::indexation(false, $object->id); Search::indexation(false, $object->id);
}
// Save and preview // Save and preview
if (Tools::isSubmit('submitAddProductAndPreview')) if (Tools::isSubmit('submitAddProductAndPreview'))
{ {
@@ -1406,7 +1392,6 @@ class AdminProductsControllerCore extends AdminController
// Default behavior (save and back) // Default behavior (save and back)
$this->redirect_after = self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=3&token='.($token ? $token : $this->token); $this->redirect_after = self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=3&token='.($token ? $token : $this->token);
} }
}
else else
$object->delete(); $object->delete();
} }
@@ -1681,8 +1666,7 @@ class AdminProductsControllerCore extends AdminController
$action = $this->action; $action = $this->action;
if (empty($action) || !method_exists($this, 'initForm'.$action)) if (empty($action) || !method_exists($this, 'initForm'.$action))
$action = 'Informations'; $action = 'Informations';
if (Tools::getValue('id_product'))
{
// i is used as product_tab id // i is used as product_tab id
$i = 0; $i = 0;
$advanced_stock_management_active = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'); $advanced_stock_management_active = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
@@ -1705,13 +1689,8 @@ class AdminProductsControllerCore extends AdminController
'href' => $this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.Tools::getValue('id_product').'&amp;action='.$product_tab, 'href' => $this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.Tools::getValue('id_product').'&amp;action='.$product_tab,
); );
} }
$this->tpl_form_vars['newproduct'] = 0;
}
else
$this->tpl_form_vars['newproduct'] = 1;
$this->tpl_form_vars['product_tabs'] = $product_tabs; $this->tpl_form_vars['product_tabs'] = $product_tabs;
$this->tpl_form_vars['tabs_toolbar_save_buttons'] = $this->tabs_toolbar_save_buttons;
} }
$languages = Language::getLanguages(false); $languages = Language::getLanguages(false);
@@ -1851,8 +1830,12 @@ class AdminProductsControllerCore extends AdminController
public function initToolbar() public function initToolbar()
{ {
if ($this->display == 'edit' || $this->display == 'add') if ($this->display == 'edit' || $this->display == 'add')
{
if ($product = $this->loadObject(true)) if ($product = $this->loadObject(true))
{ {
if ((bool)$product->id)
{
// adding button for delete this product
if ($this->tabAccess['delete'] && $this->display != 'add') if ($this->tabAccess['delete'] && $this->display != 'add')
$this->toolbar_btn['delete'] = array( $this->toolbar_btn['delete'] = array(
'short' => 'Delete', 'short' => 'Delete',
@@ -1860,6 +1843,7 @@ class AdminProductsControllerCore extends AdminController
'desc' => $this->l('Delete this product'), 'desc' => $this->l('Delete this product'),
'confirm' => 1); 'confirm' => 1);
// adding button for duplicate this product
if ($this->tabAccess['add'] && $this->display != 'add') if ($this->tabAccess['add'] && $this->display != 'add')
$this->toolbar_btn['duplicate'] = array( $this->toolbar_btn['duplicate'] = array(
'short' => 'Duplicate', 'short' => 'Duplicate',
@@ -1868,7 +1852,7 @@ class AdminProductsControllerCore extends AdminController
'confirm' => 1 'confirm' => 1
); );
// @TODO navigation // adding button for preview this product
if ($url_preview = $this->getPreviewUrl($product)) if ($url_preview = $this->getPreviewUrl($product))
$this->toolbar_btn['preview'] = array( $this->toolbar_btn['preview'] = array(
'short' => 'Preview', 'short' => 'Preview',
@@ -1878,6 +1862,7 @@ class AdminProductsControllerCore extends AdminController
'class' => 'previewUrl' 'class' => 'previewUrl'
); );
// adding button for preview this product statistics
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php') && $this->display != 'add') if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php') && $this->display != 'add')
$this->toolbar_btn['stats'] = array( $this->toolbar_btn['stats'] = array(
'short' => 'Statistics', 'short' => 'Statistics',
@@ -1885,6 +1870,14 @@ class AdminProductsControllerCore extends AdminController
'desc' => $this->l('View product sales'), 'desc' => $this->l('View product sales'),
); );
// adding button for adding a new combination in Combinaition tab
$this->toolbar_btn['newCombination'] = array(
'short' => 'Add a new combination',
'desc' => $this->l('Add a new combination'),
'class' => 'toolbar-new'
);
}
$this->toolbar_btn['cancel'] = array( $this->toolbar_btn['cancel'] = array(
'short' => 'Close', 'short' => 'Close',
'href' => '#todo'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id, 'href' => '#todo'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id,
@@ -1892,21 +1885,6 @@ class AdminProductsControllerCore extends AdminController
'confirm' => 1 'confirm' => 1
); );
if ($this->tabAccess['add'] && !($this->display == 'add' || $this->display == 'edit'))
{
$this->toolbar_btn['new'] = array(
'short' => 'Create',
'href' => '#todo'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id,
'desc' => $this->l('Create'),
);
}
$this->toolbar_btn['newCombination'] = array(
'short' => 'Add a new combination',
'desc' => $this->l('Add a new combination'),
'class' => 'toolbar-new'
);
if ($this->tabAccess['edit']) if ($this->tabAccess['edit'])
{ {
$this->toolbar_btn['save'] = array( $this->toolbar_btn['save'] = array(
@@ -1921,8 +1899,9 @@ class AdminProductsControllerCore extends AdminController
'desc' => $this->l('Save and stay'), 'desc' => $this->l('Save and stay'),
); );
} }
} }
}
parent::initToolbar(); parent::initToolbar();
$this->context->smarty->assign('toolbar_fix', 1); $this->context->smarty->assign('toolbar_fix', 1);
$this->context->smarty->assign('show_toolbar', 1); $this->context->smarty->assign('show_toolbar', 1);
@@ -2300,6 +2279,10 @@ class AdminProductsControllerCore extends AdminController
* Init data for accounting * Init data for accounting
*/ */
public function initFormAccounting($obj) public function initFormAccounting($obj)
{
$data = $this->context->smarty->createData();
if ($obj->id)
{ {
$error = ''; $error = '';
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token; $token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
@@ -2325,21 +2308,57 @@ class AdminProductsControllerCore extends AdminController
$detail['zones'][$zone['id_zone']]['account_number'] = $zone['account_number']; $detail['zones'][$zone['id_zone']]['account_number'] = $zone['account_number'];
} }
$this->context->smarty->assign(array( $data->assign(array(
'productAccountNumberList' => $detail, 'productAccountNumberList' => $detail,
'shopName' => $this->context->shop->name, 'shopName' => $this->context->shop->name,
'error' => $error, 'error' => $error,
'product' => $obj
)); ));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->fetch('products/accounting.tpl'); }
else
$this->displayWarning($this->l('You must save this product before manage accounting.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }
public function initFormPrices($obj, $languages, $default_language) public function initFormPrices($obj, $languages, $default_language)
{ {
$data = $this->context->smarty->createData(); $data = $this->context->smarty->createData();
$product = $obj;
if ($this->object->id) if ($obj->id)
{ {
$product = $this->object; $shops = Shop::getShops();
$countries = Country::getCountries($this->context->language->id);
$groups = Group::getGroups($this->context->language->id);
$currencies = Currency::getCurrencies();
$currency =
$attributes = $obj->getAttributesGroups((int)$this->context->language->id);
$combinations = array();
foreach($attributes as $attribute)
{
$combinations[$attribute['id_product_attribute']]['id_product_attribute'] = $attribute['id_product_attribute'];
if (!isset($combinations[$attribute['id_product_attribute']]['attributes']))
$combinations[$attribute['id_product_attribute']]['attributes'] = '';
$combinations[$attribute['id_product_attribute']]['attributes'] .= $attribute['attribute_name'].' - ';
$combinations[$attribute['id_product_attribute']]['price'] = Tools::displayPrice(Tools::convertPrice(Product::getPriceStatic((int)$obj->id, false, $attribute['id_product_attribute']), $this->context->currency), $this->context->currency);
}
foreach ($combinations as &$combination)
$combination['attributes'] = rtrim($combination['attributes'], ' - ');
$data->assign(array(
'shops' => $shops,
'currencies' => $currencies,
'countries' => $countries,
'groups' => $groups,
'combinations' => $combinations,
'product' => $product
));
$data->assign('specificPriceModificationForm', $this->_displaySpecificPriceModificationForm($this->context->currency, $shops, $currencies, $countries, $groups));
}
else
$this->displayWarning($this->l('You must save this product before adding specific prices'));
// prices part // prices part
$data->assign('link', $this->context->link); $data->assign('link', $this->context->link);
$data->assign('currency', $currency = $this->context->currency); $data->assign('currency', $currency = $this->context->currency);
@@ -2356,42 +2375,13 @@ class AdminProductsControllerCore extends AdminController
$data->assign('ps_tax', Configuration::get('PS_TAX')); $data->assign('ps_tax', Configuration::get('PS_TAX'));
$shops = Shop::getShops(); $data->assign('country_display_tax_label', $this->context->country->display_tax_label);
$countries = Country::getCountries($this->context->language->id);
$groups = Group::getGroups($this->context->language->id);
$currencies = Currency::getCurrencies();
$currency =
$attributes = $this->object->getAttributesGroups((int)$this->context->language->id);
$combinations = array();
foreach($attributes as $attribute)
{
$combinations[$attribute['id_product_attribute']]['id_product_attribute'] = $attribute['id_product_attribute'];
if (!isset($combinations[$attribute['id_product_attribute']]['attributes']))
$combinations[$attribute['id_product_attribute']]['attributes'] = '';
$combinations[$attribute['id_product_attribute']]['attributes'] .= $attribute['attribute_name'].' - ';
$combinations[$attribute['id_product_attribute']]['price'] = Tools::displayPrice(Tools::convertPrice(Product::getPriceStatic((int)$this->object->id, false, $attribute['id_product_attribute']), $this->context->currency), $this->context->currency);
}
foreach ($combinations as &$combination)
$combination['attributes'] = rtrim($combination['attributes'], ' - ');
$data->assign(array( $data->assign(array(
'shops' => $shops, 'currency', $this->context->currency,
'currencies' => $currencies, 'product' => $product
'countries' => $countries,
'groups' => $groups,
'combinations' => $combinations,
'product' => $this->object
)); ));
$data->assign('country_display_tax_label', $this->context->country->display_tax_label);
$data->assign('specificPriceModificationForm', $this->_displaySpecificPriceModificationForm($this->context->currency, $shops, $currencies, $countries, $groups));
}
else
$data->assign('content', '<b>'.$this->l('You must save this product before adding specific prices').'.</b>');
$data->assign('currency', $this->context->currency);
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }
@@ -2408,8 +2398,8 @@ class AdminProductsControllerCore extends AdminController
$content = ''; $content = '';
if (!($obj = $this->loadObject())) if (!($obj = $this->loadObject()))
return; return;
$specificPrices = SpecificPrice::getByProductId((int)($obj->id)); $specificPrices = SpecificPrice::getByProductId((int)$obj->id);
$specificPricePriorities = SpecificPrice::getPriority((int)($obj->id)); $specificPricePriorities = SpecificPrice::getPriority((int)$obj->id);
$taxRate = $obj->getTaxesRate(Address::initialize()); $taxRate = $obj->getTaxesRate(Address::initialize());
@@ -2614,6 +2604,8 @@ class AdminProductsControllerCore extends AdminController
{ {
$data = $this->context->smarty->createData(); $data = $this->context->smarty->createData();
if ((bool)$obj->id)
{
$labels = $obj->getCustomizationFields(); $labels = $obj->getCustomizationFields();
$has_file_labels = (int)$this->getFieldValue($obj, 'uploadable_files'); $has_file_labels = (int)$this->getFieldValue($obj, 'uploadable_files');
@@ -2630,6 +2622,9 @@ class AdminProductsControllerCore extends AdminController
'uploadable_files' => (int)($this->getFieldValue($obj, 'uploadable_files') ? (int)$this->getFieldValue($obj, 'uploadable_files') : '0'), 'uploadable_files' => (int)($this->getFieldValue($obj, 'uploadable_files') ? (int)$this->getFieldValue($obj, 'uploadable_files') : '0'),
'text_fields' => (int)($this->getFieldValue($obj, 'text_fields') ? (int)$this->getFieldValue($obj, 'text_fields') : '0'), 'text_fields' => (int)($this->getFieldValue($obj, 'text_fields') ? (int)$this->getFieldValue($obj, 'text_fields') : '0'),
)); ));
}
else
$this->displayWarning($this->l('You must save this product before adding customization.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }
@@ -2638,11 +2633,8 @@ class AdminProductsControllerCore extends AdminController
{ {
$data = $this->context->smarty->createData(); $data = $this->context->smarty->createData();
if (!($obj = $this->loadObject(true))) if ((bool)$obj->id)
return; {
$languages = Language::getLanguages(false);
$attachment_name = array(); $attachment_name = array();
$attachment_description = array(); $attachment_description = array();
foreach ($languages as $language) foreach ($languages as $language)
@@ -2661,6 +2653,9 @@ class AdminProductsControllerCore extends AdminController
'attachment_name' => $attachment_name, 'attachment_name' => $attachment_name,
'attachment_description' => $attachment_description 'attachment_description' => $attachment_description
)); ));
}
else
$this->displayWarning($this->l('You must save this product before adding attachements.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }
@@ -2901,15 +2896,15 @@ class AdminProductsControllerCore extends AdminController
{ {
$data = $this->context->smarty->createData(); $data = $this->context->smarty->createData();
if ((bool)$obj->id)
{
$data->assign('product', $this->loadObject()); $data->assign('product', $this->loadObject());
if (!Tools::getValue('id_product'))
return; // TEMPO
$shops = false; $shops = false;
if (Shop::isFeatureActive()) if (Shop::isFeatureActive())
$shops = Shop::getShops(); $shops = Shop::getShops();
$data->assign('shops', $shops); $data->assign('shops', $shops);
$count_images = Db::getInstance()->getValue(' $count_images = Db::getInstance()->getValue('
SELECT COUNT(id_product) SELECT COUNT(id_product)
FROM '._DB_PREFIX_.'image FROM '._DB_PREFIX_.'image
@@ -2925,12 +2920,16 @@ class AdminProductsControllerCore extends AdminController
$images[$k] = new Image($image['id_image']); $images[$k] = new Image($image['id_image']);
$data->assign('images', $images); $data->assign('images', $images);
$data->assign('token', $this->token); $data->assign('token', $this->token);
$data->assign('table', $this->table); $data->assign('table', $this->table);
$data->assign('max_image_size', $this->max_image_size); $data->assign('max_image_size', $this->max_image_size);
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute'))); $data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute')));
$data->assign('currency', $this->context->currency); $data->assign('currency', $this->context->currency);
}
else
$this->displayWarning($this->l('You must save this product before adding images.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }
@@ -2949,7 +2948,8 @@ class AdminProductsControllerCore extends AdminController
} }
$data = $this->context->smarty->createData(); $data = $this->context->smarty->createData();
if ((bool)$product->id)
{
$attribute_js = array(); $attribute_js = array();
$attributes = Attribute::getAttributes($this->context->language->id, true); $attributes = Attribute::getAttributes($this->context->language->id, true);
foreach ($attributes as $k => $attribute) foreach ($attributes as $k => $attribute)
@@ -2980,8 +2980,6 @@ class AdminProductsControllerCore extends AdminController
$data->assign('ps_stock_mvt_reason_default', $ps_stock_mvt_reason_default = Configuration::get('PS_STOCK_MVT_REASON_DEFAULT')); $data->assign('ps_stock_mvt_reason_default', $ps_stock_mvt_reason_default = Configuration::get('PS_STOCK_MVT_REASON_DEFAULT'));
$data->assign('minimal_quantity', $this->getFieldValue($product, 'minimal_quantity') ? $this->getFieldValue($product, 'minimal_quantity') : 1); $data->assign('minimal_quantity', $this->getFieldValue($product, 'minimal_quantity') ? $this->getFieldValue($product, 'minimal_quantity') : 1);
$data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $language['id_lang']))) : '0000-00-00'); $data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $language['id_lang']))) : '0000-00-00');
// date picker include
$i = 0; $i = 0;
$data->assign('imageType', ImageType::getByNameNType('small', 'products')); $data->assign('imageType', ImageType::getByNameNType('small', 'products'));
@@ -3005,6 +3003,10 @@ class AdminProductsControllerCore extends AdminController
'id_category' => $product->id_category_default, 'id_category' => $product->id_category_default,
'token_generator' => Tools::getAdminTokenLite('AdminAttributeGenerator') 'token_generator' => Tools::getAdminTokenLite('AdminAttributeGenerator')
)); ));
}
else
$this->displayWarning($this->l('You must save this product before adding combinations.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }
@@ -3157,7 +3159,7 @@ class AdminProductsControllerCore extends AdminController
{ {
$data = $this->context->smarty->createData(); $data = $this->context->smarty->createData();
if ($this->object->id) if ($obj->id)
{ {
// Get all id_product_attribute // Get all id_product_attribute
$attributes = $obj->getAttributesResume($this->context->language->id); $attributes = $obj->getAttributesResume($this->context->language->id);
@@ -3210,14 +3212,14 @@ class AdminProductsControllerCore extends AdminController
'available_quantity' => $available_quantity, 'available_quantity' => $available_quantity,
'stock_management_active' => Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'), 'stock_management_active' => Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'),
'product_designation' => $product_designation, 'product_designation' => $product_designation,
'product' => $this->object, 'product' => $obj,
'show_quantities' => $show_quantities, 'show_quantities' => $show_quantities,
'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'), 'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'),
'token' => $this->token 'token' => $this->token
)); ));
} }
else else
$data->assign('content', '<b>'.$this->l('You must save this product before manage quantities').'.</b>'); $this->displayWarning($this->l('You must save this product before manage quantities.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }
@@ -3226,13 +3228,13 @@ class AdminProductsControllerCore extends AdminController
{ {
$data = $this->context->smarty->createData(); $data = $this->context->smarty->createData();
if ($this->object->id) if ($obj->id)
{ {
// Get all id_product_attribute // Get all id_product_attribute
$attributes = $obj->getAttributesResume($this->context->language->id); $attributes = $obj->getAttributesResume($this->context->language->id);
if (empty($attributes)) if (empty($attributes))
$attributes[] = array( $attributes[] = array(
'id_product' => $this->object->id, 'id_product' => $obj->id,
'id_product_attribute' => 0, 'id_product_attribute' => 0,
'attribute_designation' => '' 'attribute_designation' => ''
); );
@@ -3249,10 +3251,10 @@ class AdminProductsControllerCore extends AdminController
$suppliers = Supplier::getSuppliers(); $suppliers = Supplier::getSuppliers();
// Get already associated suppliers // Get already associated suppliers
$associated_suppliers = ProductSupplier::getSupplierCollection($this->object->id); $associated_suppliers = ProductSupplier::getSupplierCollection($obj->id);
// Get already associated suppliers and force to retreive product declinaisons // Get already associated suppliers and force to retreive product declinaisons
$product_supplier_collection = ProductSupplier::getSupplierCollection($this->object->id, false); $product_supplier_collection = ProductSupplier::getSupplierCollection($obj->id, false);
$default_supplier = 0; $default_supplier = 0;
@@ -3267,7 +3269,7 @@ class AdminProductsControllerCore extends AdminController
$associated_supplier->name = $supplier['name']; $associated_supplier->name = $supplier['name'];
$supplier['is_selected'] = true; $supplier['is_selected'] = true;
if ($this->object->id_supplier == $supplier['id_supplier']) if ($obj->id_supplier == $supplier['id_supplier'])
{ {
$supplier['is_default'] = true; $supplier['is_default'] = true;
$default_supplier = $supplier['id_supplier']; $default_supplier = $supplier['id_supplier'];
@@ -3283,13 +3285,13 @@ class AdminProductsControllerCore extends AdminController
'associated_suppliers_collection' => $product_supplier_collection, 'associated_suppliers_collection' => $product_supplier_collection,
'product_designation' => $product_designation, 'product_designation' => $product_designation,
'currencies' => Currency::getCurrencies(), 'currencies' => Currency::getCurrencies(),
'product' => $this->object, 'product' => $obj,
'link' => $this->context->link, 'link' => $this->context->link,
'token' => $this->token 'token' => $this->token
)); ));
} }
else else
$data->assign('content', '<b>'.$this->l('You must save this product before manage suppliers').'.</b>'); $this->displayWarning($this->l('You must save this product before manage suppliers'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }
@@ -3298,7 +3300,7 @@ class AdminProductsControllerCore extends AdminController
{ {
$data = $this->context->smarty->createData(); $data = $this->context->smarty->createData();
if ($this->object->id) if ($obj->id)
{ {
// Get all id_product_attribute // Get all id_product_attribute
$attributes = $obj->getAttributesResume($this->context->language->id); $attributes = $obj->getAttributesResume($this->context->language->id);
@@ -3320,20 +3322,20 @@ class AdminProductsControllerCore extends AdminController
$warehouses = Warehouse::getWarehouses(true); $warehouses = Warehouse::getWarehouses(true);
// Get already associated warehouses // Get already associated warehouses
$associated_warehouses_collection = WarehouseProductLocation::getCollection($this->object->id); $associated_warehouses_collection = WarehouseProductLocation::getCollection($obj->id);
$data->assign(array( $data->assign(array(
'attributes' => $attributes, 'attributes' => $attributes,
'warehouses' => $warehouses, 'warehouses' => $warehouses,
'associated_warehouses' => $associated_warehouses_collection, 'associated_warehouses' => $associated_warehouses_collection,
'product_designation' => $product_designation, 'product_designation' => $product_designation,
'product' => $this->object, 'product' => $obj,
'link' => $this->context->link, 'link' => $this->context->link,
'token' => $this->token 'token' => $this->token
)); ));
} }
else else
$data->assign('content', '<b>'.$this->l('You must save this product before manage warehouses').'.</b>'); $this->displayWarning($this->l('You must save this product before manage warehouses'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }
@@ -3357,7 +3359,7 @@ class AdminProductsControllerCore extends AdminController
$features[$k]['val'] = array(); $features[$k]['val'] = array();
$custom = true; $custom = true;
foreach ($this->object->getFeatures() as $tab_products) foreach ($obj->getFeatures() as $tab_products)
if ($tab_products['id_feature'] == $tab_features['id_feature']) if ($tab_products['id_feature'] == $tab_features['id_feature'])
$features[$k]['current_item'] = $tab_products['id_feature_value']; $features[$k]['current_item'] = $tab_products['id_feature_value'];
@@ -3370,7 +3372,6 @@ class AdminProductsControllerCore extends AdminController
if ($custom) if ($custom)
$features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item']); $features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item']);
} }
}
$data->assign('available_features', $features); $data->assign('available_features', $features);
@@ -3378,6 +3379,10 @@ class AdminProductsControllerCore extends AdminController
$data->assign('link', $this->context->link); $data->assign('link', $this->context->link);
$data->assign('languages', $this->_languages); $data->assign('languages', $this->_languages);
$data->assign('default_form_language', $this->default_form_language); $data->assign('default_form_language', $this->default_form_language);
}
else
$this->displayWarning($this->l('You must save this product before adding features.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
} }