// update tab "attributes" in smarty template + update action in list in ajax

This commit is contained in:
lLefevre
2011-12-04 10:42:05 +00:00
parent e1b7cd86af
commit 570ecde717
28 changed files with 1110 additions and 494 deletions
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}">
<img src="../img/admin/add_stock.png" alt="{$action}" title="{$action}" /></a>
<a href="{$href}" title="{$action}">
<img src="../img/admin/add_stock.png" alt="{$action}" />
</a>
@@ -0,0 +1,28 @@
{*
* 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: 9197 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" title="{$action}">
<img src="../img/admin/asterisk.gif" alt="{$action}" />
</a>
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" onclick="return confirm('{$confirm}');">
<img src="../img/admin/delete.gif" alt="{$action}" title="{$action}" /></a>
<a href="{$href}" onclick="return confirm('{$confirm}');" title="{$action}">
<img src="../img/admin/delete.gif" alt="{$action}" />
</a>
@@ -123,6 +123,6 @@ $(document).ready(function() {
});
});
</script>
<a href="#" id="details_{$id}">
<img src="../img/admin/more.png" alt="{$action}" title="{$action}" />
<a class="pointer" id="details_{$id}" title="{$action}">
<img src="../img/admin/more.png" alt="{$action}" />
</a>
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a class="pointer" onclick="if (confirm('{$confirm}')) document.location = '{$location_ok}'; else document.location = '{$location_ko}';">
<img src="../img/admin/duplicate.png" alt="{$action}" title="{$action}" /></a>
<a class="pointer" title="{$action}" onclick="if (confirm('{$confirm}')) document.location = '{$location_ok}'; else document.location = '{$location_ko}';">
<img src="../img/admin/duplicate.png" alt="{$action}" />
</a>
@@ -23,6 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" class="edit">
<img src="../img/admin/edit.gif" alt="{$action}" title="{$action}" />
<a href="{$href}" class="edit" title="{$action}">
<img src="../img/admin/edit.gif" alt="{$action}" />
</a>
@@ -24,7 +24,6 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$url_enable}" {if isset($confirm)}onclick="return confirm('{$confirm}');"{/if}>
<img src="../img/admin/{if $enabled}enabled.gif{else}disabled.gif{/if}"
alt="{if $enabled}{l s='Enabled'}{else}{l s='Disabled'}{/if}" title="{if $enabled}{l s='Enabled'}{else}{l s='Disabled'}{/if}" />
<a href="{$url_enable}" {if isset($confirm)}onclick="return confirm('{$confirm}');"{/if} title="{if $enabled}{l s='Enabled'}{else}{l s='Disabled'}{/if}">
<img src="../img/admin/{if $enabled}enabled.gif{else}disabled.gif{/if}" alt="{if $enabled}{l s='Enabled'}{else}{l s='Disabled'}{/if}" />
</a>
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}">
<img src="../img/admin/remove_stock.png" alt="{$action}" title="{$action}" /></a>
<a href="{$href}" title="{$action}">
<img src="../img/admin/remove_stock.png" alt="{$action}" />
</a>
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}">
<img src="../img/admin/delivery.gif" alt="{$action}" title="{$action}" /></a>
<a href="{$href}" title="{$action}">
<img src="../img/admin/delivery.gif" alt="{$action}" />
</a>
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}">
<img src="../img/admin/cms.gif" alt="{$action}" title="{$action}" /></a>
<a href="{$href}" title="{$action}">
<img src="../img/admin/cms.gif" alt="{$action}" />
</a>
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" onclick="return confirm('{$confirm}');">
<img src="../img/admin/copy_files.gif" alt="{$action}" title="{$action}" /></a>
<a href="{$href}" onclick="return confirm('{$confirm}');" title="{$action}">
<img src="../img/admin/copy_files.gif" alt="{$action}" />
</a>
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}">
<img src="../img/admin/delivery.gif" alt="{$action}" title="{$action}" /></a>
<a href="{$href}" title="{$action}">
<img src="../img/admin/delivery.gif" alt="{$action}" />
</a>
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}">
<img src="../img/admin/transfer_stock.png" alt="{$action}" title="{$action}" /></a>
<a href="{$href}" title="{$action}">
<img src="../img/admin/transfer_stock.png" alt="{$action}" />
</a>
@@ -23,5 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}">
<img src="../img/admin/details.gif" alt="{$action}" title="{$action}" /></a>
<a href="{$href}" title="{$action}" >
<img src="../img/admin/details.gif" alt="{$action}" />
</a>
@@ -36,4 +36,6 @@
</tr>
</table>
<input type="hidden" name="token" value="{$token}" />
</form>
</form>
{block name="after"}{/block}
@@ -0,0 +1,28 @@
{*
* 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: 9197 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a class="pointer default" onclick="javascript:defaultProductAttribute('{$id}', '{getAdminToken tab='AdminProducts'}', $(this).parent('td').parent('tr'));" title="{$action}" >
<img src="../img/admin/asterisk.gif" alt="{$action}" />
</a>
@@ -0,0 +1,28 @@
{*
* 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: 9197 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a class="pointer delete" onclick="javascript:deleteProductAttribute('{$id}', '{getAdminToken tab='AdminProducts'}', $(this).parent('td').parent('tr'));" title="{$action}" >
<img src="../img/admin/delete.gif" alt="{$action}" />
</a>
@@ -0,0 +1,28 @@
{*
* 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: 9197 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a class="pointer edit" onclick="javascript:editProductAttribute('{$id}', '{getAdminToken tab='AdminProducts'}');" title="{l s='Modify this combination'}">
<img src="../img/admin/edit.gif" alt="{l s='Modify this combination'}" />
</a>
@@ -0,0 +1,50 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 10634 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helper/list/list_footer.tpl"}
{block name="after"}
<div class="hint clear" style="display:block">
<ul>
<li>{l s='The row in blue is the default combination.'}</li>
<li>{l s='A default combination must be designated for each product.'}</li>
</ul>
</div>
<script type="text/javascript">
var impact = getE('attribute_price_impact');
var impact2 = getE('attribute_weight_impact');
var s_attr_group = $('#span_new_group');
var s_attr_name = $('#span_new_attr');
var s_impact = $('#span_impact');
var s_impact2 = $('#span_weight_impact');
init_elems();
</script>
{/block}
@@ -1,6 +1,32 @@
{*
* 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
*}
<script type="text/javascript">
$(document).ready(function(){
$(\'#id_mvt_reason\').change(function(){
$('#id_mvt_reason').change(function(){
updateMvtStatus($(this).val());
});
updateMvtStatus($(this).val());
@@ -52,229 +78,261 @@
</a>
<div id="add_new_combination" style="display: none;">
<table cellpadding="5" style="width:100%">
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">{l s='Group:'}</td>
<td style="padding-bottom:5px;"><select name="attribute_group" id="attribute_group" style="width: 200px;" onchange="populate_attrs();">
{if isset($attributes_groups)}
{foreach from=$attributes_groups key=k item=attribute_group}
<option value="{$attribute_group.id_attribute_group}">{$attribute_group.name|htmlentitiesUTF8}&nbsp;&nbsp;</option>
{/foreach}
{/if}
</select></td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">{l s='Attribute:'}
</td>
<td style="padding-bottom:5px;">
<select name="attribute" id="attribute" style="width: 200px;">
<option value="0">---</option>
</select>
<script type="text/javascript">
$(document).ready(function()
{
populate_attrs();
});
</script>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
<input style="width: 140px; margin-bottom: 10px;" type="button" value="{l s='Add'}" class="button" onclick="add_attr();"/><br />
<input style="width: 140px;" type="button" value="{l s='Delete'}" class="button" onclick="del_attr()"/></td>
<td align="left">
<select id="product_att_list" name="attribute_combinaison_list[]" multiple="multiple" size="4" style="width: 320px;"></select>
</td>
</tr>
<tr><td colspan="2"><div class="separation"></div></td></tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Reference:'}</td>
<td style="padding-bottom:5px;">
<input size="55" type="text" id="attribute_reference" name="attribute_reference" value="" style="width: 130px; margin-right: 44px;" />
{l s='EAN13:'}<input size="55" maxlength="13" type="text" id="attribute_ean13" name="attribute_ean13" value="" style="width: 110px; margin-left: 10px; margin-right: 44px;" />
{l s='UPC:'}<input size="55" maxlength="12" type="text" id="attribute_upc" name="attribute_upc" value="" style="width: 110px; margin-left: 10px; margin-right: 44px;" />
<span class="hint" name="help_box">{l s='Special characters allowed:'} .-_#<span class="hint-pointer">&nbsp;</span></span>
</td>
</tr>
<tr><td colspan="2"><div class="separation"></div></td></tr>
<table cellpadding="5" id="virtual_good_attributes" style="width:100%;display:none;">
<tr>
<td colspan="2">
<div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #E0D0B1">
<p>{l s='Your server\'s maximum upload file size is'}:&nbsp;{$upload_max_filesize}</p>
<label id="virtual_product_file_attribute_label" for="virtual_product_file_attribute" class="t">{l s='Upload a file'}</label>
<p><input id="virtual_product_file_attribute" name="virtual_product_file_attribute" onchange="uploadFile2();" maxlength="'.$this->maxFileSize.'" type="file"></p>
<div id="upload-confirmation2">
<p id="gethtmlink" style="display: none;">{l s='This is the link'} :&nbsp;{$product->productDownload->getHtmlLink(false, true)}
<a id="make_downloadable_product_attribute" onclick="return confirm('{l s='Delete this file' slashes=1 js=1}')" href="index.php?tab=AdminProducts&id_product={$product->productDownload->id_product}&id_category={$id_category}&token={$token}&deleteVirtualProductAttribute=true" class="red">{l s='Delete this file'}</a>
</p>
</div>
<a id="delete_downloadable_product_attribute" style="display:none;" onclick="return confirm('{l s='Delete this file' slashes=1 js=1}')" href="index.php?tab=AdminProducts&id_product={$product->id}&id_category={$id_category}&token={$token}&deleteVirtualProductAttribute=true" class="red">{l s='Delete this file'}</a>
{if $up_filename}
<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="{$up_filename}" />
{/if}
<p class="block">
<label for="virtual_product_name" class="t">{l s='Filename'}</label>
<input id="virtual_product_name_attribute" name="virtual_product_name_attribute" style="width:200px" value="" type="text">
<span class="hint" name="help_box" style="display:none;">{l s='The full filename with its extension (e.g., Book.pdf)'}</span>
</p>
</div>
<div id="virtual_good_more_attribute" style="padding:5px;width:40%;float:left;margin-left:10px">
<p class="block">
<label for="virtual_product_nb_downloable" class="t">{l s='Number of downloads'}</label>
<input type="text" id="virtual_product_nb_downloable_attribute" name="virtual_product_nb_downloable_attribute" value="" class="" size="6" />
<span class="hint" name="help_box" style="display:none">{l s='Number of authorized downloads per customer'}</span>
</p>
<p class="block">
<label for="virtual_product_expiration_date_attribute" class="t">{l s='Expiration date'}</label>
<input type="text" id="virtual_product_expiration_date_attribute" name="virtual_product_expiration_date_attribute" value="" size="11" maxlength="10" autocomplete="off" /> {l s='Format: YYYY-MM-DD'}
<span class="hint" name="help_box" style="display:none">{l s='No expiration date if you leave this blank'}</span>
</p>
<p class="block">
<label for="virtual_product_nb_days" class="t">{l s='Number of days'}</label>
<input type="text" id="virtual_product_nb_days_attribute" name="virtual_product_nb_days_attribute" value="" class="" size="4" /><sup> *</sup>
<span class="hint" name="help_box" style="display:none">{l s='How many days this file can be accessed by customers'} - <em>({l s='set to zero for unlimited access'} ) </em></span>
</p>
<p class="block">
<label for="virtual_product_is_shareable_attribute" class="t">{l s='is shareable'}</label>
<input type="checkbox" id="virtual_product_is_shareable_attribute" name="virtual_product_is_shareable" value="1" />
<span class="hint" name="help_box" style="display:none">{l s='Specify if the file can be shared'}</span>
</p>
</div>
</td>
</tr>
<tr><td colspan="2"><div class="separation"></div></td></tr>
</table>
<table>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Wholesale price:'}</td>
<td style="padding-bottom:5px;">
<table cellpadding="5" style="width:100%">
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
{l s='Group:'}
</td>
<td style="padding-bottom:5px;">
<select name="attribute_group" id="attribute_group" style="width: 200px;" onchange="populate_attrs();">
{if isset($attributes_groups)}
{foreach from=$attributes_groups key=k item=attribute_group}
<option value="{$attribute_group.id_attribute_group}">{$attribute_group.name|htmlentitiesUTF8}&nbsp;&nbsp;</option>
{/foreach}
{/if}
</select>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
{l s='Attribute:'}
</td>
<td style="padding-bottom:5px;">
<select name="attribute" id="attribute" style="width: 200px;">
<option value="0">---</option>
</select>
<script type="text/javascript">
$(document).ready(function(){
populate_attrs();
});
</script>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
<input style="width: 140px; margin-bottom: 10px;" type="button" value="{l s='Add'}" class="button" onclick="add_attr();"/><br />
<input style="width: 140px;" type="button" value="{l s='Delete'}" class="button" onclick="del_attr()"/></td>
<td align="left">
<select id="product_att_list" name="attribute_combinaison_list[]" multiple="multiple" size="4" style="width: 320px;"></select>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Reference:'}</td>
<td style="padding-bottom:5px;">
<input size="55" type="text" id="attribute_reference" name="attribute_reference" value="" style="width: 130px; margin-right: 44px;" />
{l s='EAN13:'}<input size="55" maxlength="13" type="text" id="attribute_ean13" name="attribute_ean13" value="" style="width: 110px; margin-left: 10px; margin-right: 44px;" />
{l s='UPC:'}<input size="55" maxlength="12" type="text" id="attribute_upc" name="attribute_upc" value="" style="width: 110px; margin-left: 10px; margin-right: 44px;" />
<span class="hint" name="help_box">{l s='Special characters allowed:'} .-_#<span class="hint-pointer">&nbsp;</span></span>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
</table>
<table cellpadding="5" id="virtual_good_attributes" style="width:100%;display:none;">
<tr>
<td colspan="2">
<div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #E0D0B1">
<p>{l s='Your server\'s maximum upload file size is'}:&nbsp;{$upload_max_filesize}</p>
<label id="virtual_product_file_attribute_label" for="virtual_product_file_attribute" class="t">{l s='Upload a file'}</label>
<p><input id="virtual_product_file_attribute" name="virtual_product_file_attribute" onchange="uploadFile2();" maxlength="'.$this->maxFileSize.'" type="file"></p>
<div id="upload-confirmation2">
<p id="gethtmlink" style="display: none;">{l s='This is the link'} :&nbsp;{$product->productDownload->getHtmlLink(false, true)}
<a id="make_downloadable_product_attribute" onclick="return confirm('{l s='Delete this file' slashes=1 js=1}')" href="index.php?tab=AdminProducts&id_product={$product->productDownload->id_product}&id_category={$id_category}&token={$token}&deleteVirtualProductAttribute=true" class="red">{l s='Delete this file'}</a>
</p>
</div>
<a id="delete_downloadable_product_attribute" style="display:none;" onclick="return confirm('{l s='Delete this file' slashes=1 js=1}')" href="index.php?tab=AdminProducts&id_product={$product->id}&id_category={$id_category}&token={$token}&deleteVirtualProductAttribute=true" class="red">{l s='Delete this file'}</a>
{if $up_filename}
<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="{$up_filename}" />
{/if}
<p class="block">
<label for="virtual_product_name" class="t">{l s='Filename'}</label>
<input id="virtual_product_name_attribute" name="virtual_product_name_attribute" style="width:200px" value="" type="text">
<span class="hint" name="help_box" style="display:none;">{l s='The full filename with its extension (e.g., Book.pdf)'}</span>
</p>
</div>
<div id="virtual_good_more_attribute" style="padding:5px;width:40%;float:left;margin-left:10px">
<p class="block">
<label for="virtual_product_nb_downloable" class="t">{l s='Number of downloads'}</label>
<input type="text" id="virtual_product_nb_downloable_attribute" name="virtual_product_nb_downloable_attribute" value="" class="" size="6" />
<span class="hint" name="help_box" style="display:none">{l s='Number of authorized downloads per customer'}</span>
</p>
<p class="block">
<label for="virtual_product_expiration_date_attribute" class="t">{l s='Expiration date'}</label>
<input type="text" id="virtual_product_expiration_date_attribute" name="virtual_product_expiration_date_attribute" value="" size="11" maxlength="10" autocomplete="off" /> {l s='Format: YYYY-MM-DD'}
<span class="hint" name="help_box" style="display:none">{l s='No expiration date if you leave this blank'}</span>
</p>
<p class="block">
<label for="virtual_product_nb_days" class="t">{l s='Number of days'}</label>
<input type="text" id="virtual_product_nb_days_attribute" name="virtual_product_nb_days_attribute" value="" class="" size="4" /><sup> *</sup>
<span class="hint" name="help_box" style="display:none">{l s='How many days this file can be accessed by customers'} - <em>({l s='set to zero for unlimited access'} ) </em></span>
</p>
<p class="block">
<label for="virtual_product_is_shareable_attribute" class="t">{l s='is shareable'}</label>
<input type="checkbox" id="virtual_product_is_shareable_attribute" name="virtual_product_is_shareable" value="1" />
<span class="hint" name="help_box" style="display:none">{l s='Specify if the file can be shared'}</span>
</p>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
</table>
<table>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">
{l s='Wholesale price:'}
</td>
<td style="padding-bottom:5px;">
{if $currency->format % 2 != 0}{$currency->sign}{/if}
<input type="text" size="6" name="attribute_wholesale_price" id="attribute_wholesale_price" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
{if $currency->format % 2 == 0} {$currency->sign} {/if}({l s='overrides Wholesale price on Information tab'})</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on price:'}</td>
<td colspan="2" style="padding-bottom:5px;">
{if $currency->format % 2 == 0} {$currency->sign} {/if}({l s='overrides Wholesale price on Information tab'})
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on price:'}</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_price_impact" id="attribute_price_impact" style="width: 140px;" onchange="check_impact(); calcImpactPriceTI();">
<option value="0">{l s='None'}</option>
<option value="1">{l s='Increase'}</option>
<option value="-1">{l s='Reduction'}</option>
<option value="0">{l s='None'}</option>
<option value="1">{l s='Increase'}</option>
<option value="-1">{l s='Reduction'}</option>
</select>
<span id="span_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;{if $currency->format % 2 != 0}{$currency->sign} {/if}
<input type="text" size="6" name="attribute_price" id="attribute_price" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); calcImpactPriceTI();"/>{if $currency->format % 2 == 0} {$currency->sign}{/if}
{if $country_display_tax_label}
{l s='(tax excl.)'}
<span {if $tax_exclude_option}style="display:none"{/if}> {l s='or'} {if $currency->format % 2 != 0}{$currency->sign} {/if}
<input type="text" size="6" name="attribute_priceTI" id="attribute_priceTI" value="0.00"
onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); calcImpactPriceTE();"/>
{if $currency->format % 2 == 0} {$currency->sign}{/if} {l s='(tax incl.)'}
</span> {l s='final product price will be set to'}
{if $currency->format % 2 != 0}{$currency->sign} {/if}
<span id="attribute_new_total_price">0.00</span>
{if $currency->format % 2 == 0}{$currency->sign} {/if}
{/if}
{if $country_display_tax_label}
{l s='(tax excl.)'}
<span {if $tax_exclude_option}style="display:none"{/if}> {l s='or'}
{if $currency->format % 2 != 0}{$currency->sign} {/if}
<input type="text" size="6" name="attribute_priceTI" id="attribute_priceTI" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); calcImpactPriceTE();"/>
{if $currency->format % 2 == 0} {$currency->sign}{/if} {l s='(tax incl.)'}
</span> {l s='final product price will be set to'}
{if $currency->format % 2 != 0}{$currency->sign} {/if}
<span id="attribute_new_total_price">0.00</span>
{if $currency->format % 2 == 0}{$currency->sign} {/if}
{/if}
</span>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on weight:'}</td>
<td colspan="2" style="padding-bottom:5px;"><select name="attribute_weight_impact" id="attribute_weight_impact" style="width: 140px;" onchange="check_weight_impact();">
<option value="0">{l s='None'}</option>
<option value="1">{l s='Increase'}</option>
<option value="-1">{l s='Reduction'}</option>
</select>
<span id="span_weight_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;
<input type="text" size="6" name="attribute_weight" id="attribute_weight" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" /> {$ps_weight_unit}</span></td>
</tr>
<tr id="tr_unit_impact">
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on unit price :'}</td>
<td colspan="2" style="padding-bottom:5px;"><select name="attribute_unit_impact" id="attribute_unit_impact" style="width: 140px;" onchange="check_unit_impact();">
<option value="0">{l s='None'}</option>
<option value="1">{l s='Increase'}</option>
<option value="-1">{l s='Reduction'}</option>
</select>
<span id="span_weight_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;
&nbsp;&nbsp;{if $currency->format % 2 != 0} {$currency->sign} {/if}
<input type="text" size="6" name="attribute_unity" id="attribute_unity" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />{if $currency->format % 2 == 0} {$currency->sign}{/if} / <span id="unity_third">{$field_value_unity}</span>
</span></td>
</tr>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on weight:'}</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_weight_impact" id="attribute_weight_impact" style="width: 140px;" onchange="check_weight_impact();">
<option value="0">{l s='None'}</option>
<option value="1">{l s='Increase'}</option>
<option value="-1">{l s='Reduction'}</option>
</select>
<span id="span_weight_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;
<input type="text" size="6" name="attribute_weight" id="attribute_weight" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
{$ps_weight_unit}
</span>
</td>
</tr>
<tr id="tr_unit_impact">
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">{l s='Impact on unit price :'}</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_unit_impact" id="attribute_unit_impact" style="width: 140px;" onchange="check_unit_impact();">
<option value="0">{l s='None'}</option>
<option value="1">{l s='Increase'}</option>
<option value="-1">{l s='Reduction'}</option>
</select>
<span id="span_weight_impact">&nbsp;&nbsp;{l s='of'}&nbsp;&nbsp;&nbsp;&nbsp;
{if $currency->format % 2 != 0} {$currency->sign} {/if}
<input type="text" size="6" name="attribute_unity" id="attribute_unity" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />{if $currency->format % 2 == 0} {$currency->sign}{/if} / <span id="unity_third">{$field_value_unity}</span>
</span>
</td>
</tr>
{if $ps_use_ecotax}
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">
{l s='Eco-tax:'}
</td>
<td style="padding-bottom:5px;">{if $currency->format % 2 != 0}{$currency->sign}{/if}
<input type="text" size="3" name="attribute_ecotax" id="attribute_ecotax" value="0.00"
onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
{if $currency->format % 2 == 0} {$currency->sign}{/if}
({l s='overrides Eco-tax on Information tab'})
</td>
</tr>
{/if}
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" class="col-left"><label>{l s='Minimum quantity:'}</label>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">
{l s='Eco-tax:'}
</td>
<td style="padding-bottom:5px;">{if $currency->format % 2 != 0}{$currency->sign}{/if}
<input type="text" size="3" name="attribute_ecotax" id="attribute_ecotax" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" />
{if $currency->format % 2 == 0} {$currency->sign}{/if}
({l s='overrides Eco-tax on Information tab'})
</td>
</tr>
{/if}
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" class="col-left">
<label>{l s='Minimum quantity:'}</label>
</td>
<td style="padding-bottom:5px;">
<input size="3" maxlength="6" name="minimal_quantity" id="minimal_quantity" type="text" value="{$minimal_quantity}" />
<p>{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" class="col-left" style="width:150px"><label>{l s='Available date:'}</label></td>
<td style="padding-bottom:5px;"><input class="datepicker" id="available_date" name="available_date" value="{$available_date}" style="text-align: center;" type="text" />
<p>{l s='The available date when this product is out of stock'}</p>
<script type="text/javascript">
$(document).ready(function(){
$(".datepicker").datepicker({
prevText: '',
nextText: ''
});
});
</script>
</td>
</tr>
<tr><td colspan="2"><div class="separation"></div></td></tr>
<tr>
<td style="width:150px">{l s='Image:'}</td>
<td style="padding-bottom:5px;">
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" class="col-left" style="width:150px">
<label>{l s='Available date:'}</label>
</td>
<td style="padding-bottom:5px;">
<input class="datepicker" id="available_date" name="available_date" value="{$available_date}" style="text-align: center;" type="text" />
<p>{l s='The available date when this product is out of stock'}</p>
<script type="text/javascript">
$(document).ready(function(){
$(".datepicker").datepicker({
prevText: '',
nextText: ''
});
});
</script>
</td>
</tr>
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
<tr>
<td style="width:150px">{l s='Image:'}</td>
<td style="padding-bottom:5px;">
<ul id="id_image_attr">
{foreach from=$images key=k item=image}
<li style="float: left; width: {$imageWidth}px;">
<input type="checkbox" name="id_image_attr[]" value="{$image.id_image}" id="id_image_attr_{$image.id_image}" />
<label for="id_image_attr_{$image.id_image}" style="float: none;">
<img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-small.jpg"
alt="{$image.legend|htmlentitiesUTF8}"
title="{$image.legend|htmlentitiesUTF8}" />
</label>
</li>
<li style="float: left; width: {$imageWidth}px;">
<input type="checkbox" name="id_image_attr[]" value="{$image.id_image}" id="id_image_attr_{$image.id_image}" />
<label for="id_image_attr_{$image.id_image}" style="float: none;">
<img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-small.jpg" alt="{$image.legend|htmlentitiesUTF8}" title="{$image.legend|htmlentitiesUTF8}" />
</label>
</li>
{/foreach}
</ul>
<img id="pic" alt="" title="" style="display: none; width: 100px; height: 100px; float: left; border: 1px dashed #BBB; margin-left: 20px;" />
</td>
</tr>
<tr>
<td style="width:150px">{l s='Default:'}<br /><br /></td>
<td style="padding-bottom:5px;">
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" />&nbsp;{l s='Make this the default combination for this product'}<br /><br />
</td>
</tr>
<tr>
<td style="width:150px">&nbsp;</td>
<td style="padding-bottom:5px;">
<span style="float: left;"><input type="submit" name="submitProductAttribute" id="submitProductAttribute" value="{l s='Add this combination'}" class="button" onclick="attr_selectall(); this.form.action += '&addproduct&tabs=3';" /> </span>
</td>
</tr>
<tr>
<td style="width:150px">{l s='Default:'}<br /><br /></td>
<td style="padding-bottom:5px;">
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" />
&nbsp;{l s='Make this the default combination for this product'}<br /><br />
</td>
</tr>
<tr>
<td style="width:150px">&nbsp;</td>
<td style="padding-bottom:5px;">
<span style="float: left;">
<input type="submit" name="submitProductAttribute" id="submitProductAttribute" value="{l s='Add this combination'}" class="button" onclick="attr_selectall(); this.form.action += '&addproduct&tabs=3';" />
</span>
<span id="ResetSpan" style="float: left; margin-left: 8px; display: none;">
<input type="reset" name="ResetBtn" id="ResetBtn" onclick="init_elems(); getE('submitProductAttribute').value ='{l s='Add this attributes group'}';
getE('id_product_attribute').value = 0; $('#ResetSpan').slideToggle();" class="button" value="{l s='Cancel modification'}" /></span><span class="clear"></span>
</td>
</tr>
</table>
</div>
</div>
{$content}
<input type="reset" name="ResetBtn" id="ResetBtn" onclick="init_elems(); getE('submitProductAttribute').value ='{l s='Add this attributes group'}';getE('id_product_attribute').value = 0; $('#ResetSpan').slideToggle();" class="button" value="{l s='Cancel modification'}" />
</span>
<span class="clear"></span>
</td>
</tr>
</table>
</div>
{$list}
+1 -10
View File
@@ -23,17 +23,8 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helper/form/form.tpl"}
{block name="script"}</script>
<link href="../css/fileuploader.css" rel="stylesheet" type="text/css">
<script src="../js/fileuploader.js" type="text/javascript"></script>
<script src="../js/jquery/ui/jquery.ui.core.min.js" type="text/javascript"></script>
<script src="../js/jquery/ui/jquery.ui.widget.min.js" type="text/javascript"></script>
<script src="../js/jquery/ui/jquery.ui.progressbar.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../js/admin.js"></script>
<script type="text/javascript">
{/block}
{extends file="helper/form/form.tpl"}
{block name="defaultForm"}
<div>
@@ -1,24 +1,51 @@
{*
* 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
*}
{extends file="helper/list/list_header.tpl"}
{block name=leadin}
{if isset($category_tree)}
<script type="text/javascript">
$(document).ready(function(){
$('#go_to_categ').bind('change', function(){
var base_url = '{$base_url}';
if (this.value !== "")
location.href = base_url + '&id_category=' + parseInt(this.value);
else
location.href = base_url;
{if isset($category_tree)}
<script type="text/javascript">
$(document).ready(function(){
$('#go_to_categ').bind('change', function(){
var base_url = '{$base_url}';
if (this.value !== "")
location.href = base_url + '&id_category=' + parseInt(this.value);
else
location.href = base_url;
});
});
});
</script>
{l s='Go to category:'}
<select id="go_to_categ" name="go_to_categ">
{foreach from=$category_tree item=categ}
<option value="{$categ->id}" {if $categ->selected}selected="selected"{/if} >
{$categ->dashes}{$categ->name}
</option>
{/foreach}
</select>
{/if}
</script>
{l s='Go to category:'}
<select id="go_to_categ" name="go_to_categ">
{foreach from=$category_tree item=categ}
<option value="{$categ->id}" {if $categ->selected}selected="selected"{/if} >
{$categ->dashes}{$categ->name}
</option>
{/foreach}
</select>
{/if}
{/block}
+1 -2
View File
@@ -1503,8 +1503,7 @@ class AdminControllerCore extends Controller
$this->addCSS(_THEME_CSS_DIR_.'rtl.css');
$this->addJquery();
$this->addjQueryPlugin(array('cluetip', 'hoverIntent'));
$this->addJqueryPlugin('scrollTo');
$this->addjQueryPlugin(array('cluetip', 'hoverIntent', 'scrollTo'));
$this->addJS(array(
_PS_JS_DIR_.'admin.js',
+19 -1
View File
@@ -432,7 +432,7 @@ class HelperListCore extends Helper
$tpl->assign(array(
'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&update'.$this->table.'&token='.($token != null ? $token : $this->token),
'action' => self::$cache_lang['Edit'],
'id' => (int)$id
'id' => $id
));
return $tpl->fetch();
@@ -461,6 +461,24 @@ class HelperListCore extends Helper
return $tpl->fetch();
}
/**
* Display delete action link
*/
protected function displayDefaultLink($token = null, $id)
{
$tpl = $this->createTemplate('list_action_default.tpl');
if (!array_key_exists('Default', self::$cache_lang))
self::$cache_lang['Default'] = $this->l('Default');
$tpl->assign(array_merge($this->tpl_delete_link_vars, array(
'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token != null ? $token : $this->token),
'action' => self::$cache_lang['Default'],
'id' => $id,
)));
return $tpl->fetch();
}
/**
* Display list header (filtering, pagination and column names)
*/
+26
View File
@@ -1669,6 +1669,32 @@ class ProductCore extends ObjectModel
return Db::getInstance()->executeS($sql);
}
/**
* Get product attribute combinaison by id_product_attribute
*
* @param integer $id_product_attribute
* @param integer $id_lang Language id
* @return array Product attribute combinaison by id_product_attribute
*/
public function getAttributeCombinaisonsById($id_product_attribute, $id_lang)
{
if (!Combination::isFeatureActive())
return array();
$sql = 'SELECT pa.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name,
a.`id_attribute`, pa.`unit_price_impact`, IFNULL(stock.quantity, 0) as quantity
FROM `'._DB_PREFIX_.'product_attribute` pa
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
'.Product::sqlStock('pa', 'pa').'
WHERE pa.`id_product` = '.(int)$this->id.'
AND pa.`id_product_attribute` = '.(int)$id_product_attribute.'
ORDER BY pa.`id_product_attribute`';
return Db::getInstance()->executeS($sql);
}
public function getCombinationImages($id_lang)
{
if (!Combination::isFeatureActive())
+440 -225
View File
@@ -70,9 +70,6 @@ class AdminProductsControllerCore extends AdminController
$this->table = 'product';
$this->className = 'Product';
$this->lang = true;
$this->addRowAction('edit');
$this->addRowAction('duplicate');
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->imageType = 'jpg';
@@ -172,24 +169,24 @@ class AdminProductsControllerCore extends AdminController
$_POST['weight'] = empty($_POST['weight']) ? '0' : str_replace(',', '.', $_POST['weight']);
if ($_POST['unit_price'] != null)
$object->unit_price = str_replace(',', '.', $_POST['unit_price']);
if (array_key_exists('ecotax', $_POST) && $_POST['ecotax'] != null)
$object->ecotax = str_replace(',', '.', $_POST['ecotax']);
$object->available_for_order = (int)Tools::isSubmit('available_for_order');
$object->show_price = $object->available_for_order ? 1 : (int)Tools::isSubmit('show_price');
$object->on_sale = Tools::isSubmit('on_sale');
$object->online_only = Tools::isSubmit('online_only');
}
public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null)
{
$orderByPriceFinal = (empty($orderBy) ? ($this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : 'id_'.$this->table) : $orderBy);
$orderWayPriceFinal = (empty($orderWay) ? ($this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderby') : 'ASC') : $orderWay);
if ($orderByPriceFinal == 'price_final')
{
$orderBy = 'id_'.$this->table;
$orderWay = 'ASC';
if (array_key_exists('ecotax', $_POST) && $_POST['ecotax'] != null)
$object->ecotax = str_replace(',', '.', $_POST['ecotax']);
$object->available_for_order = (int)Tools::isSubmit('available_for_order');
$object->show_price = $object->available_for_order ? 1 : (int)Tools::isSubmit('show_price');
$object->on_sale = Tools::isSubmit('on_sale');
$object->online_only = Tools::isSubmit('online_only');
}
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $id_lang_shop);
public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null)
{
$orderByPriceFinal = (empty($orderBy) ? ($this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : 'id_'.$this->table) : $orderBy);
$orderWayPriceFinal = (empty($orderWay) ? ($this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderby') : 'ASC') : $orderWay);
if ($orderByPriceFinal == 'price_final')
{
$orderBy = 'id_'.$this->table;
$orderWay = 'ASC';
}
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $id_lang_shop);
/* update product quantity with attributes ...*/
$nb = count($this->_list);
@@ -650,41 +647,6 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
}
}
}
else if (Tools::isSubmit('deleteProductAttribute'))
{
if (!Combination::isFeatureActive())
return;
if ($this->tabAccess['delete'] === '1')
{
if (($id_product = (int)(Tools::getValue('id_product'))) && Validate::isUnsignedId($id_product) && Validate::isLoadedObject($product = new Product($id_product)))
{
$product->deleteAttributeCombinaison(Tools::getValue('id_product_attribute'));
$id_product_download = ProductDownload::getIdFromIdAttribute((int) $id_product, (int) Tools::getValue('id_product_attribute'));
if ($id_product_download)
{
$productDownload = new ProductDownload((int) $id_product_download);
$this->deleteDownloadProduct((int) $id_product_download);
$productDownload->deleteFile();
}
$product->checkDefaultAttributes();
$product->updateQuantityProductWithAttributeQuantity();
if (!$product->hasAttributes())
{
$product->cache_default_attribute = 0;
$product->update();
}
else
Product::updateDefaultAttribute($id_product);
$this->redirect_after = 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
$this->_errors[] = Tools::displayError('Cannot delete attribute');
}
else
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
else if (Tools::isSubmit('deleteAllProductAttributes'))
{
if (!Combination::isFeatureActive())
@@ -708,19 +670,6 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
else
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
else if (Tools::isSubmit('defaultProductAttribute'))
{
if (!Combination::isFeatureActive())
return;
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
{
$product->deleteDefaultAttributes();
$product->setDefaultAttribute((int)(Tools::getValue('id_product_attribute')));
$this->redirect_after = 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
$this->_errors[] = Tools::displayError('Cannot make default attribute');
}
/* Product features management */
else if (Tools::isSubmit('submitFeatures') || Tools::isSubmit('submitFeaturesAndStay'))
@@ -980,6 +929,96 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
die(Tools::jsonEncode($result));
}
public function ajaxProcessDeleteProductAttribute()
{
if (!Combination::isFeatureActive())
return;
if ($this->tabAccess['delete'] === '1')
{
$id_product = (int)Tools::getValue('id_product');
$id_product_attribute = (int)Tools::getValue('id_product_attribute');
if ($id_product && Validate::isUnsignedId($id_product) && Validate::isLoadedObject($product = new Product($id_product)))
{
$product->deleteAttributeCombinaison($id_product_attribute);
$id_product_download = (int)ProductDownload::getIdFromIdAttribute($id_product, $id_product_attribute);
if ($id_product_download)
{
$productDownload = new ProductDownload($id_product_download);
$this->deleteDownloadProduct($id_product_download);
$productDownload->deleteFile();
}
$product->checkDefaultAttributes();
$product->updateQuantityProductWithAttributeQuantity();
if (!$product->hasAttributes())
{
$product->cache_default_attribute = 0;
$product->update();
}
else
Product::updateDefaultAttribute($id_product);
$json = array(
'status' => 'ok',
'message'=> $this->_conf[1]
);
}
else
$json = array(
'status' => 'error',
'message'=> $this->l('Cannot delete attribute')
);
}
else
$json = array(
'status' => 'error',
'message'=> $this->l('You do not have permission to delete here.')
);
die(Tools::jsonEncode($json));
}
public function ajaxProcessDefaultProductAttribute()
{
if ($this->tabAccess['edit'] === '1')
{
if (!Combination::isFeatureActive())
return;
if (Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product'))))
{
$product->deleteDefaultAttributes();
$product->setDefaultAttribute((int)Tools::getValue('id_product_attribute'));
$json = array(
'status' => 'ok',
'message'=> $this->_conf[4]
);
}
else
$json = array(
'status' => 'error',
'message'=> $this->l('Cannot make default attribute')
);
die(Tools::jsonEncode($json));
}
}
public function ajaxProcessEditProductAttribute()
{
if ($this->tabAccess['edit'] === '1')
{
$id_product = (int)Tools::getValue('id_product');
$id_product_attribute = (int)Tools::getValue('id_product_attribute');
if ($id_product && Validate::isUnsignedId($id_product) && Validate::isLoadedObject($product = new Product($id_product)))
{
$combinaisons = $product->getAttributeCombinaisonsById($id_product_attribute, $this->context->language->id);
die(Tools::jsonEncode($combinaisons));
}
}
}
public function ajaxPreProcess()
{
$this->action = Tools::getValue('action');
@@ -1710,6 +1749,10 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
public function renderList()
{
$this->addRowAction('edit');
$this->addRowAction('duplicate');
$this->addRowAction('delete');
if (!Tools::getValue('id_category'))
unset($this->fieldsDisplay['position']);
return parent::renderList();
@@ -1793,14 +1836,14 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
if ($this->display == 'edit' || $this->display == 'add')
if ($product = $this->loadObject(true))
{
if ($this->tabAccess['delete'])
if ($this->tabAccess['delete'] && $this->display != 'add')
$this->toolbar_btn['delete'] = array(
'short' => 'Delete',
'href' => $this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id.'&amp;deleteproduct',
'desc' => $this->l('Delete this product'),
'confirm' => 1);
if ($this->tabAccess['add'])
if ($this->tabAccess['add'] && $this->display != 'add')
$this->toolbar_btn['duplicate'] = array(
'short' => 'Duplicate',
'href' => '#todo'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id,
@@ -1818,7 +1861,7 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
'class' => 'previewUrl'
);
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php'))
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php') && $this->display != 'add')
$this->toolbar_btn['stats'] = array(
'short' => 'Statistics',
'href' => $this->context->link->getAdminLink('AdminStats').'&amp;module=statsproduct&amp;id_product='.$product->id,
@@ -2662,9 +2705,6 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
$this->tpl_form_vars['iso'] = file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en';
$this->tpl_form_vars['ad'] = dirname($_SERVER['PHP_SELF']);
$this->tpl_form_vars['tinymce'] = true;
$this->addJS(_PS_JS_DIR_.'admin-products.js');
$this->addJS(_PS_JS_DIR_.'tiny_mce/tiny_mce.js');
$this->addJS(_PS_JS_DIR_.'tinymce.inc.js');
$currency = $this->context->currency;
$data->assign('languages',$languages);
@@ -2950,16 +2990,15 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
return;
}
$smarty = $this->context->smarty;
$content = '';
$data = $this->context->smarty->createData();
$attributeJs = array();
$attributes = Attribute::getAttributes($this->context->language->id, true);
foreach ($attributes as $k => $attribute)
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
$currency = $this->context->currency;
$smarty->assign('attributeJs', $attributeJs);
$smarty->assign('attributes_groups', AttributeGroup::getAttributesGroups($this->context->language->id));
$data->assign('attributeJs', $attributeJs);
$data->assign('attributes_groups', AttributeGroup::getAttributesGroups($this->context->language->id));
$default_country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
$product->productDownload = new ProductDownload();
@@ -2967,40 +3006,206 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
if (!empty($id_product_download))
$product->productDownload = new ProductDownload($id_product_download);
// $smarty->assign('productDownload', $productDownload);
$smarty->assign('currency', $currency);
// $data->assign('productDownload', $productDownload);
$data->assign('currency', $currency);
$images = Image::getImages($this->context->language->id, $product->id);
if ($product->id)
{
$smarty->assign('tax_exclude_option', Tax::excludeTaxeOption());
$smarty->assign('ps_weight_unit', Configuration::get('PS_WEIGHT_UNIT'));
$data->assign('tax_exclude_option', Tax::excludeTaxeOption());
$data->assign('ps_weight_unit', Configuration::get('PS_WEIGHT_UNIT'));
$smarty->assign('ps_use_ecotax', Configuration::get('PS_USE_ECOTAX'));
$smarty->assign('field_value_unity', $this->getFieldValue($product, 'unity'));
$data->assign('ps_use_ecotax', Configuration::get('PS_USE_ECOTAX'));
$data->assign('field_value_unity', $this->getFieldValue($product, 'unity'));
$smarty->assign('reasons', $reasons = StockMvtReason::getStockMvtReasons($this->context->language->id));
$smarty->assign('ps_stock_mvt_reason_default', $ps_stock_mvt_reason_default = Configuration::get('PS_STOCK_MVT_REASON_DEFAULT'));
$smarty->assign('minimal_quantity', $this->getFieldValue($product, 'minimal_quantity') ? $this->getFieldValue($product, 'minimal_quantity') : 1);
$smarty->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('reasons', $reasons = StockMvtReason::getStockMvtReasons($this->context->language->id));
$data->assign('ps_stock_mvt_reason_default', $ps_stock_mvt_reason_default = Configuration::get('PS_STOCK_MVT_REASON_DEFAULT'));
$data->assign('minimal_quantity', $this->getFieldValue($product, 'minimal_quantity') ? $this->getFieldValue($product, 'minimal_quantity') : 1);
$data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $language['id_lang']))) : '0000-00-00');
// date picker include
$i = 0;
$smarty->assign('imageType', ImageType::getByNameNType('small', 'products'));
$smarty->assign('imageWidth', (isset($imageType['width']) ? (int)($imageType['width']) : 64) + 25);
$data->assign('imageType', ImageType::getByNameNType('small', 'products'));
$data->assign('imageWidth', (isset($imageType['width']) ? (int)($imageType['width']) : 64) + 25);
foreach ($images as $k => $image)
{
$images[$k]['obj'] = new Image($image['id_image']);
++$i;
}
$smarty->assign('images', $images);
$content .= '
<div>
$data->assign('images', $images);
}
else
$content .= '<b>'.$this->l('You must save this product before adding combinations').'.</b>';
// @todo
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute')));
$data->assign($this->tpl_form_vars);
$data->assign(array(
'list' => $this->renderListAttributes($id_product_download, $product, $currency),
'product' => $product,
'id_category' => $product->id_category_default,
'token_generator' => Tools::getAdminTokenLite('AdminAttributeGenerator')
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
public function renderListAttributes($id_product_download, $product, $currency)
{
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->addRowAction('edit');
$this->addRowAction('default');
$this->addRowAction('delete');
$color_by_default = '#BDE5F8';
$this->fieldsDisplay = array(
'attributes' => array('title' => $this->l('Attributes'), 'align' => 'center', 'width' => 70),
'price' => array('title' => $this->l('Impact'), 'type' => 'price', 'align' => 'center', 'width' => 70),
'weight' => array('title' => $this->l('Weight'), 'align' => 'center', 'width' => 70),
'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 70),
'ean13' => array('title' => $this->l('EAN13'), 'align' => 'center', 'width' => 70),
'upc' => array('title' => $this->l('UPC'), 'align' => 'center', 'width' => 70)
);
if ($id_product_download && !empty($productDownload->display_filename))
{
$this->fieldsDisplay['Filename'] = array('title' => $this->l('Filename'), 'align' => 'center', 'width' => 70);
$this->fieldsDisplay['nb_downloadable'] = array('title' => $this->l('Number of downloads'), 'align' => 'center', 'width' => 70);
$this->fieldsDisplay['date_expiration'] = array('title' => $this->l('Number of days'), 'align' => 'center', 'width' => 70);
$this->fieldsDisplay['is_shareable'] = array('title' => $this->l('Share'), 'align' => 'center', 'width' => 70);
}
if ($product->id)
{
/* Build attributes combinaisons */
$combinaisons = $product->getAttributeCombinaisons($this->context->language->id);
$groups = array();
$combArray = array();
if (is_array($combinaisons))
{
$combinationImages = $product->getCombinationImages($this->context->language->id);
foreach ($combinaisons as $k => $combinaison)
{
if ($currency->format % 2 != 0)
$price = $currency->sign.' '.$combinaison['price'];
else
$price = $combinaison['price'].' '.$currency->sign;
$combArray[$combinaison['id_product_attribute']]['id_combinaison_attribute'] = $product->id.'||'.$combinaison['id_product_attribute'];
$combArray[$combinaison['id_product_attribute']]['id_product_attribute'] = $combinaison['id_product_attribute'];
$combArray[$combinaison['id_product_attribute']]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
$combArray[$combinaison['id_product_attribute']]['wholesale_price'] = $combinaison['wholesale_price'];
$combArray[$combinaison['id_product_attribute']]['price'] = $price;
$combArray[$combinaison['id_product_attribute']]['weight'] = $combinaison['weight'].Configuration::get('PS_WEIGHT_UNIT');
$combArray[$combinaison['id_product_attribute']]['unit_impact'] = $combinaison['unit_price_impact'];
$combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
$combArray[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
$combArray[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc'];
$combArray[$combinaison['id_product_attribute']]['id_image'] = isset($combinationImages[$combinaison['id_product_attribute']][0]['id_image']) ? $combinationImages[$combinaison['id_product_attribute']][0]['id_image'] : 0;
$combArray[$combinaison['id_product_attribute']]['available_date'] = strftime($combinaison['available_date']);
$combArray[$combinaison['id_product_attribute']]['default_on'] = $combinaison['default_on'];
/*$combArray[$combinaison['id_product_attribute']]['minimal_quantity'] = $combinaison['minimal_quantity'];
$combArray[$combinaison['id_product_attribute']]['ecotax'] = $combinaison['ecotax'];*/
if ($combinaison['is_color_group'])
$groups[$combinaison['id_attribute_group']] = $combinaison['group_name'];
}
}
$irow = 0;
if (isset($combArray))
{
foreach ($combArray as $id_product_attribute => $product_attribute)
{
$list = '';
$jsList = '';
/* In order to keep the same attributes order */
asort($product_attribute['attributes']);
foreach ($product_attribute['attributes'] as $attribute)
{
$list .= addslashes(htmlspecialchars($attribute[0])).' - '.addslashes(htmlspecialchars($attribute[1])).', ';
$jsList .= '\''.addslashes(htmlspecialchars($attribute[0])).' : '.addslashes(htmlspecialchars($attribute[1])).'\', \''.$attribute[2].'\', ';
}
$list = rtrim($list, ', ');
$jsList = rtrim($jsList, ', ');
$combArray[$id_product_attribute]['image'] = $product_attribute['id_image'] ? new Image($product_attribute['id_image']) : false;
$combArray[$id_product_attribute]['available_date'] = $product_attribute['available_date'] != 0 ? date('Y-m-d', strtotime($product_attribute['available_date'])) : '0000-00-00';
$combArray[$id_product_attribute]['attributes'] = $list;
if ($product_attribute['default_on'])
{
$this->list_skip_actions['default'][] = $product_attribute['id_combinaison_attribute'];
$combArray[$id_product_attribute]['color']= $color_by_default;
}
$id_product_download = $product->productDownload->getIdFromIdAttribute((int) $product->id, (int) $id_product_attribute);
if ($id_product_download)
$product->productDownload = new ProductDownload($id_product_download);
$available_date_attribute = substr($product->productDownload->date_expiration, 0, -9);
if ($available_date_attribute == '0000-00-00')
$available_date_attribute = '';
if ($id_product_download && !empty($product->productDownload->display_filename))
{
if ($product->productDownload->is_shareable == 1)
$is_shareable = $this->l('Yes');
else
$is_shareable = $this->l('No');
$combArray[$id_product_attribute]['link'] = $product->productDownload->getHtmlLink(false, true);
$combArray[$id_product_attribute]['nb_downloadable'] = $product->productDownload->nb_downloadable;
$combArray[$id_product_attribute]['is_shareable'] = $is_shareable;
}
$exists_file = realpath(_PS_DOWNLOAD_DIR_).'/'.$product->productDownload->filename;
if ($product->productDownload->id && file_exists($exists_file))
$filename = $product->productDownload->filename;
else
$filename = '';
//$combArray[$id_product_attribute]['productDownload'] = $product->productDownload;
$combArray[$id_product_attribute]['id_product_download'] = $id_product_download;
$combArray[$id_product_attribute]['date_expiration'] = $available_date_attribute;
$combArray[$id_product_attribute]['filename'] = $filename;
}
}
}
foreach ($this->actions_available as $action)
{
if (!in_array($action, $this->actions) && isset($this->$action) && $this->$action)
$this->actions[] = $action;
}
$helper = new HelperList();
$helper->identifier = 'id_combinaison_attribute';
$helper->token = $this->token;
$helper->currentIndex = self::$currentIndex;
$helper->no_link = true;
$helper->simple_header = true;
$helper->show_toolbar = false;
$helper->shopLinkType = $this->shopLinkType;
$helper->actions = $this->actions;
$helper->list_skip_actions = $this->list_skip_actions;
$helper->colorOnBackground = true;
$helper->override_folder = $this->tpl_folder.'combinaison/';
return $helper->generateList($combArray, $this->fieldsDisplay);
$content = '';
$content .= '
<table>
<tr><td colspan="2"><div class="separation"></div></td></tr>
<tr>
<td colspan="2">
<tr>
<td colspan="2">
<div class="separation"></div>
</td>
</tr>
<tr>
<td colspan="2">
<br />
<table border="0" cellpadding="0" cellspacing="0" class="table">
<tr>
@@ -3022,141 +3227,131 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
$content .= '<th class="center">'.$this->l('Actions').'</th>
</tr>';
if ($product->id)
{
/* Build attributes combinaisons */
$combinaisons = $product->getAttributeCombinaisons($this->context->language->id);
$groups = array();
if (is_array($combinaisons))
{
$combinationImages = $product->getCombinationImages($this->context->language->id);
foreach ($combinaisons as $k => $combinaison)
{
$combArray[$combinaison['id_product_attribute']]['wholesale_price'] = $combinaison['wholesale_price'];
$combArray[$combinaison['id_product_attribute']]['price'] = $combinaison['price'];
$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']]['ean13'] = $combinaison['ean13'];
$combArray[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc'];
$combArray[$combinaison['id_product_attribute']]['minimal_quantity'] = $combinaison['minimal_quantity'];
$combArray[$combinaison['id_product_attribute']]['available_date'] = strftime($combinaison['available_date']);
$combArray[$combinaison['id_product_attribute']]['id_image'] = isset($combinationImages[$combinaison['id_product_attribute']][0]['id_image']) ? $combinationImages[$combinaison['id_product_attribute']][0]['id_image'] : 0;
$combArray[$combinaison['id_product_attribute']]['default_on'] = $combinaison['default_on'];
$combArray[$combinaison['id_product_attribute']]['ecotax'] = $combinaison['ecotax'];
$combArray[$combinaison['id_product_attribute']]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
if ($combinaison['is_color_group'])
$groups[$combinaison['id_attribute_group']] = $combinaison['group_name'];
}
}
$irow = 0;
if (isset($combArray))
{
foreach ($combArray as $id_product_attribute => $product_attribute)
{
$list = '';
$jsList = '';
/* In order to keep the same attributes order */
asort($product_attribute['attributes']);
foreach ($product_attribute['attributes'] as $attribute)
if ($product->id)
{
$list .= addslashes(htmlspecialchars($attribute[0])).' - '.addslashes(htmlspecialchars($attribute[1])).', ';
$jsList .= '\''.addslashes(htmlspecialchars($attribute[0])).' : '.addslashes(htmlspecialchars($attribute[1])).'\', \''.$attribute[2].'\', ';
}
$list = rtrim($list, ', ');
$jsList = rtrim($jsList, ', ');
$attrImage = $product_attribute['id_image'] ? new Image($product_attribute['id_image']) : false;
$available_date = ($product_attribute['available_date'] != 0) ? date('Y-m-d', strtotime($product_attribute['available_date'])) : '0000-00-00';
$id_product_download = $product->productDownload->getIdFromIdAttribute((int) $product->id, (int) $id_product_attribute);
if ($id_product_download)
$product->productDownload = new ProductDownload($id_product_download);
$available_date_attribute = substr($product->productDownload->date_expiration, 0, -9);
if ($available_date_attribute == '0000-00-00')
$available_date_attribute = '';
if ($product->productDownload->is_shareable == 1)
$is_shareable = $this->l('Yes');
else
$is_shareable = $this->l('No');
$content .= '
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').($product_attribute['default_on'] ? ' style="background-color:#D1EAEF"' : '').'>
<td>'.stripslashes($list).'</td>
<td class="right">'.($currency->format % 2 != 0 ? $currency->sign.' ' : '').$product_attribute['price'].($currency->format % 2 == 0 ? ' '.$currency->sign : '').'</td>
<td class="right">'.$product_attribute['weight'].Configuration::get('PS_WEIGHT_UNIT').'</td>
<td class="right">'.$product_attribute['reference'].'</td>
<td class="right">'.$product_attribute['ean13'].'</td>
<td class="right">'.$product_attribute['upc'].'</td>';
if ($id_product_download && !empty($product->productDownload->display_filename))
/* Build attributes combinaisons */
$combinaisons = $product->getAttributeCombinaisons($this->context->language->id);
$groups = array();
if (is_array($combinaisons))
{
$content .= '<td class="right">'.$product->productDownload->getHtmlLink(false, true).'</td>
<td class="center">'.$product->productDownload->nb_downloadable.'</td>
<td class="center">'.$product->productDownload->nb_downloadable.'</td>
<td class="right">'.$is_shareable.'</td>';
$combinationImages = $product->getCombinationImages($this->context->language->id);
foreach ($combinaisons as $k => $combinaison)
{
$combArray[$combinaison['id_product_attribute']]['wholesale_price'] = $combinaison['wholesale_price'];
$combArray[$combinaison['id_product_attribute']]['price'] = $combinaison['price'];
$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']]['ean13'] = $combinaison['ean13'];
$combArray[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc'];
$combArray[$combinaison['id_product_attribute']]['minimal_quantity'] = $combinaison['minimal_quantity'];
$combArray[$combinaison['id_product_attribute']]['available_date'] = strftime($combinaison['available_date']);
$combArray[$combinaison['id_product_attribute']]['id_image'] = isset($combinationImages[$combinaison['id_product_attribute']][0]['id_image']) ? $combinationImages[$combinaison['id_product_attribute']][0]['id_image'] : 0;
$combArray[$combinaison['id_product_attribute']]['default_on'] = $combinaison['default_on'];
$combArray[$combinaison['id_product_attribute']]['ecotax'] = $combinaison['ecotax'];
$combArray[$combinaison['id_product_attribute']]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
if ($combinaison['is_color_group'])
$groups[$combinaison['id_attribute_group']] = $combinaison['group_name'];
}
}
$exists_file = realpath(_PS_DOWNLOAD_DIR_).'/'.$product->productDownload->filename;
if ($product->productDownload->id && file_exists($exists_file))
$filename = $product->productDownload->filename;
$irow = 0;
if (isset($combArray))
{
foreach ($combArray as $id_product_attribute => $product_attribute)
{
$list = '';
$jsList = '';
/* In order to keep the same attributes order */
asort($product_attribute['attributes']);
foreach ($product_attribute['attributes'] as $attribute)
{
$list .= addslashes(htmlspecialchars($attribute[0])).' - '.addslashes(htmlspecialchars($attribute[1])).', ';
$jsList .= '\''.addslashes(htmlspecialchars($attribute[0])).' : '.addslashes(htmlspecialchars($attribute[1])).'\', \''.$attribute[2].'\', ';
}
$list = rtrim($list, ', ');
$jsList = rtrim($jsList, ', ');
$attrImage = $product_attribute['id_image'] ? new Image($product_attribute['id_image']) : false;
$available_date = ($product_attribute['available_date'] != 0) ? date('Y-m-d', strtotime($product_attribute['available_date'])) : '0000-00-00';
$id_product_download = $product->productDownload->getIdFromIdAttribute((int) $product->id, (int) $id_product_attribute);
if ($id_product_download)
$product->productDownload = new ProductDownload($id_product_download);
$available_date_attribute = substr($product->productDownload->date_expiration, 0, -9);
if ($available_date_attribute == '0000-00-00')
$available_date_attribute = '';
if ($product->productDownload->is_shareable == 1)
$is_shareable = $this->l('Yes');
else
$is_shareable = $this->l('No');
$content .= '
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').($product_attribute['default_on'] ? ' style="background-color:#D1EAEF"' : '').'>
<td>'.stripslashes($list).'</td>
<td class="right">'.($currency->format % 2 != 0 ? $currency->sign.' ' : '').$product_attribute['price'].($currency->format % 2 == 0 ? ' '.$currency->sign : '').'</td>
<td class="right">'.$product_attribute['weight'].Configuration::get('PS_WEIGHT_UNIT').'</td>
<td class="right">'.$product_attribute['reference'].'</td>
<td class="right">'.$product_attribute['ean13'].'</td>
<td class="right">'.$product_attribute['upc'].'</td>';
if ($id_product_download && !empty($product->productDownload->display_filename))
{
$content .= '<td class="right">'.$product->productDownload->getHtmlLink(false, true).'</td>
<td class="center">'.$product->productDownload->nb_downloadable.'</td>
<td class="center">'.$product->productDownload->nb_downloadable.'</td>
<td class="right">'.$is_shareable.'</td>';
}
$exists_file = realpath(_PS_DOWNLOAD_DIR_).'/'.$product->productDownload->filename;
if ($product->productDownload->id && file_exists($exists_file))
$filename = $product->productDownload->filename;
else
$filename = '';
// @todo : a better way to "fillCombinaison" maybe ?
$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['ean13'].'\',
\'0\', \''.($attrImage ? $attrImage->id : 0).'\', Array('.$jsList.'), \''.$id_product_attribute.'\', \''.$product_attribute['default_on'].'\', \''.$product_attribute['ecotax'].'\', \''.$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>&nbsp;
'.(!$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).'">
<img src="../img/admin/asterisk.gif" alt="'.$this->l('Make this the default combination').'" title="'.$this->l('Make this combination the default one').'"></a>' : '').'
<a href="'.self::$currentIndex.'&deleteProductAttribute&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')).(int)$this->context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this combination').'" /></a></td>
</tr>';
}
$content .= '<tr><td colspan="7" align="center"><a href="'.self::$currentIndex.'&deleteAllProductAttributes&id_product='.$product->id.'&token='.Tools::getAdminToken('AdminProducts'.(int)(Tab::getIdFromClassName('AdminProducts')).(int)$this->context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');"><img src="../img/admin/delete.gif" alt="'.$this->l('Delete this combination').'" /> '.$this->l('Delete all combinations').'</a></td></tr>';
}
else
$filename = '';
// @todo : a better way to "fillCombinaison" maybe ?
$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['ean13'].'\',
\'0\', \''.($attrImage ? $attrImage->id : 0).'\', Array('.$jsList.'), \''.$id_product_attribute.'\', \''.$product_attribute['default_on'].'\', \''.$product_attribute['ecotax'].'\', \''.$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>&nbsp;
'.(!$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).'">
<img src="../img/admin/asterisk.gif" alt="'.$this->l('Make this the default combination').'" title="'.$this->l('Make this combination the default one').'"></a>' : '').'
<a href="'.self::$currentIndex.'&deleteProductAttribute&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')).(int)$this->context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this combination').'" /></a></td>
</tr>';
}
$content .= '<tr><td colspan="7" align="center"><a href="'.self::$currentIndex.'&deleteAllProductAttributes&id_product='.$product->id.'&token='.Tools::getAdminToken('AdminProducts'.(int)(Tab::getIdFromClassName('AdminProducts')).(int)$this->context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');"><img src="../img/admin/delete.gif" alt="'.$this->l('Delete this combination').'" /> '.$this->l('Delete all combinations').'</a></td></tr>';
}
else
$content .= '<tr><td colspan="7" align="center"><i>'.$this->l('No combination yet').'.</i></td></tr>';
}
$content .= '
</table>
<br />'.$this->l('The row in blue is the default combination.').'
<br />
'.$this->l('A default combination must be designated for each product.').'
</td>
</tr>
</table>
<script type="text/javascript">
var impact = getE(\'attribute_price_impact\');
var impact2 = getE(\'attribute_weight_impact\');
var s_attr_group = $(\'#span_new_group\');
var s_attr_name = $(\'#span_new_attr\');
var s_impact = $(\'#span_impact\');
var s_impact2 = $(\'#span_weight_impact\');
init_elems();
</script>';
}
else
$content .= '<b>'.$this->l('You must save this product before adding combinations').'.</b>';
// @todo
$smarty->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute')));
$this->context->smarty->assign($this->tpl_form_vars);
$this->context->smarty->assign(array(
'content' => $content,
'product' => $product,
'id_category' => $product->id_category_default,
'token_generator' => Tools::getAdminTokenLite('AdminAttributeGenerator')
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->fetch('products/combinations.tpl');
$content .= '<tr><td colspan="7" align="center"><i>'.$this->l('No combination yet').'.</i></td></tr>';
}
$content .= '
</table>
<br />'.$this->l('The row in blue is the default combination.').'
<br />
'.$this->l('A default combination must be designated for each product.').'
</td>
</tr>
</table>
<script type="text/javascript">
var impact = getE(\'attribute_price_impact\');
var impact2 = getE(\'attribute_weight_impact\');
var s_attr_group = $(\'#span_new_group\');
var s_attr_name = $(\'#span_new_attr\');
var s_impact = $(\'#span_impact\');
var s_impact2 = $(\'#span_weight_impact\');
init_elems();
</script>';
return $content;
}
public function initFormQuantities($obj)
@@ -3589,4 +3784,24 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0,
$this->addJqueryPlugin('ajaxfileupload');
$this->addJqueryPlugin('date');
}
public function setMedia()
{
parent::setMedia();
$this->addjQueryPlugin('fileuploader');
$this->addJqueryUI(array(
'ui.core',
'ui.widget',
'ui.progressbar'
));
$this->addJS(array(
_PS_JS_DIR_.'admin-products.js',
_PS_JS_DIR_.'price.js',
_PS_JS_DIR_.'tiny_mce/tiny_mce.js',
_PS_JS_DIR_.'tinymce.inc.js'
));
}
}
@@ -64,7 +64,7 @@ class AdminShippingControllerCore extends AdminController
'validation' => 'isUnsignedFloat'),
),
'description' =>
'<ul style="font-size: 11px; color:#7F7F7F; line-height: 20px;">
'<ul style="font-size:11px;color:#7F7F7F;line-height:20px;margin-left:20px;">
<li style="list-style-type: disc;">'.$this->l('If you set these parameters to 0, they will be disabled').'</li>
<li style="list-style-type: disc;">'.$this->l('Coupons are not taken into account when calculating free shipping').'</li>
</ul>',
+109
View File
@@ -23,6 +23,115 @@
* International Registered Trademark & Property of PrestaShop SA
*/
function deleteProductAttribute(ids, token, parent)
{
var id = ids.split('||');
$.ajax({
url: 'index.php',
data: {
id_product: id[0],
id_product_attribute: id[1],
controller: 'AdminProducts',
token: token,
action: 'deleteProductAttribute',
ajax: true
},
context: document.body,
dataType: 'json',
context: this,
async: false,
success: function(data) {
if (data.status == 'ok')
{
showSuccessMessage(data.message);
parent.hide();
}
else
showErrorMessage(data.message);
}
});
}
function defaultProductAttribute(ids, token, parent)
{
var id = ids.split('||');
$.ajax({
url: 'index.php',
data: {
id_product: id[0],
id_product_attribute: id[1],
controller: 'AdminProducts',
token: token,
action: 'defaultProductAttribute',
ajax: true
},
context: document.body,
dataType: 'json',
context: this,
async: false,
success: function(data) {
if (data.status == 'ok')
{
showSuccessMessage(data.message);
$('table.table').find('tr').each(function(){
$(this).attr('style', '');
});
parent.find('a.default').hide();
parent.css('background','#BDE5F8');
}
else
showErrorMessage(data.message);
}
});
}
function editProductAttribute(ids, token)
{
var id = ids.split('||');
$.ajax({
url: 'index.php',
data: {
id_product: id[0],
id_product_attribute: id[1],
controller: 'AdminProducts',
token: token,
action: 'editProductAttribute',
ajax: true
},
context: document.body,
dataType: 'json',
context: this,
async: false,
success: function(data) {
$('#add_new_combination').show();
console.log(data[0]);
console.log(data[1]);
for(i=0;i<data.length;i++)
{
$('#product_att_list').append('<option value='+data[i]['id_attribute']+' groupid='+data[i]['id_attribute_group']+'>'+data[i]['group_name']+' : '+data[i]['attribute_name']+'</option>');
$('#attribute_reference').val(data[i]['reference']);
$('#attribute_ean13').val(data[i]['ean13']);
$('#attribute_upc').val(data[i]['upc']);
$('#attribute_wholesale_price').val(Math.abs(data[i]['wholesale_price']));
$('#attribute_price').val(Math.abs(data[i]['price']));
$('#attribute_priceTI').val(data[i]['attribute_reference']);
$('#attribute_weight').val(Math.abs(data[i]['weight']));
$('#attribute_unity').val(Math.abs(data[i]['unit_price_impact']));
if ($('#attribute_ecotax').length != 0)
$('#attribute_ecotax').val(data[i]['ecotax']);
$('#minimal_quantity').val(data[i]['minimal_quantity']);
$('#attribute_minimal_quantity').val(data[i]['minimal_quantity']);
$('#available_date').val(data[i]['available_date']);
if (data[i]['default_on'] == 1)
$('#attribute_default').checked = true;
else
$('#attribute_default').checked = false;
}
}
});
}
function addPackItem()
{
if ($('#curPackItemId').val() == '' || $('#curPackItemName').val() == '')