// bugfix admin products, adminattributesgroups, admincategories

// helper list and form improved
This commit is contained in:
mMarinetti
2011-11-03 17:04:33 +00:00
parent 2d3ce82382
commit 1927cbfaa3
24 changed files with 636 additions and 1263 deletions
+4 -335
View File
@@ -23,345 +23,14 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if $firstCall}
<script type="text/javascript">
{extends file="helper/form/form.tpl"}
{block name=script}
var attributesGroups = {ldelim}{$strAttributesGroups}{rdelim};
var vat_number = {$vat_number};
var module_dir = '{$module_dir}';
var id_language = {$defaultFormLanguage};
var languages = new Array();
$(document).ready(function() {ldelim}
{foreach $languages as $k => $language}
languages[{$k}] = {ldelim}
id_lang: {$language.id_lang},
iso_code: '{$language.iso_code}',
name: '{$language.name}'
{rdelim};
{/foreach}
displayFlags(languages, id_language, {$allowEmployeeFormLang});
{if isset($fields_value.id_state)}
if ($('#id_country') && $('#id_state'))
{ldelim}
ajaxStates({$fields_value.id_state});
$('#id_country').change(function() {ldelim}
ajaxStates();
{rdelim});
{rdelim}
{/if}
if ($(".datepicker").length > 0)
$(".datepicker").datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
$('#id_attribute_group').change(function() {
$('#id_attribute_group').change(function() {
var val = $(this).val();
if (attributesGroups[val])
$('#colorAttributeProperties').show();
else
$('#colorAttributeProperties').hide();
});
{rdelim});
</script>
<script type="text/javascript" src="../js/form.js"></script>
{/if}
{if isset($toolbar) && $toolbar}
{include file="toolbar.tpl"}
{/if}
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
<form class="defaultForm" action="{$current}&{$submit_action}=1&token={$token}" method="post" enctype="multipart/form-data">
{if $form_id}
<input type="hidden" name="id_{$table}" value="{$form_id}" />
{/if}
<fieldset>
{foreach $fields as $key => $field}
{if $key == 'legend'}
<legend>
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title}" />{/if}
{$field.title}
</legend>
{elseif $key == 'input'}
{foreach $field as $input}
{if $input.name == 'id_state'}
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
{/if}
{if $input.type == 'color'}
<div id="colorAttributeProperties" style="display:{if $colorAttributeProperties}block{else}none{/if}";>
{/if}
{block name="label"}
{if isset($input.label)}
<label>{$input.label} </label>
{/if}
{/block}
{if $input.type == 'hidden'}
<input type="hidden" name="{$input.name}" value="{$fields_value[$input.name]}" />
{else}
{block name="start_field_block"}
<div class="margin-form">
{/block}
{if $input.type == 'text' && $input.name == 'texture'}
<p>
{if $imageTextureExists}
<img src="{$imageTexture}" alt="" />
<a href="{$imageTextureUrl}"><img src="../img/admin/delete.gif" alt="" title="{l s='Delete'}" />{l s='Delete'}</a>
{else}
{l s='None'}
{/if}
</p>
{elseif $input.type == 'text'}
{if isset($input.lang) && isset($input.attributeLang)}
{foreach $languages as $language}
<div id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
<input type="text"
name="{$input.name}_{$language.id_lang}"
value="{$fields_value[$input.name][$language.id_lang]}"
{if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
{if isset($input.class)}class="{$input.class}"{/if}
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
</div>
{/foreach}
{if count($languages) > 1}
<div class="displayed_flag">
<img src="../img/l/{$defaultFormLanguage}.jpg"
class="pointer"
id="language_current_{$input.name}"
onclick="toggleLanguageFlags(this);" />
</div>
<div id="languages_{$input.name}" class="language_flags">
{l s='Choose language:'}<br /><br />
{foreach $languages as $language}
<img src="../img/l/{$language.id_lang}.jpg"
class="pointer"
alt="{$language.name}"
title="{$language.name}"
onclick="changeLanguage('{$input.name}', '{$input.attributeLang}', {$language.id_lang}, '{$language.iso_code}');" />
{/foreach}
</div>
{/if}
{else}
<input type="text"
name="{$input.name}"
id="{$input.name}"
value="{$fields_value[$input.name]}"
{if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
{if isset($input.class)}class="{$input.class}"{/if}
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
{if isset($input.suffix)}{$input.suffix}{/if}
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
{/if}
{elseif $input.type == 'select'}
{if isset($input.options.query) && !$input.options.query && isset($input.empty_message)}
{$input.empty_message}
{$input.required = false}
{$input.p = null}
{else}
<select name="{$input.name}" id="{$input.name}" {if isset($input.multiple)}multiple="multiple" {/if}{if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
{if isset($input.options.default)}
<option value="{$input.options.default.value}">{$input.options.default.label}</option>
{/if}
{if isset($input.options.optiongroup)}
{foreach $input.options.optiongroup.query AS $optiongroup}
<optgroup label="{$optiongroup[$input.options.optiongroup.label]}">
{foreach $optiongroup[$input.options.options.query] as $option}
<option value="{$option[$input.options.options.id]}"
{if isset($input.multiple)}
{foreach $fields_value[$input.name] as $field_value}
{if $field_value == $option[$input.options.options.id]}selected="selected"{/if}
{/foreach}
{else}
{if $fields_value[$input.name] == $option[$input.options.options.id]}selected="selected"{/if}
{/if}
>{$option[$input.options.options.name]|escape:'htmlall':'UTF-8'}</option>
{/foreach}
</optgroup>
{/foreach}
{else}
{foreach $input.options.query AS $option}
<option value="{$option[$input.options.id]}"
{if isset($input.multiple)}
{foreach $fields_value[$input.name] as $field_value}
{$field_value}
{if $field_value == $option[$input.options.id]}selected="selected"{/if}
{/foreach}
{else}
{if $fields_value[$input.name] == $option[$input.options.id]}selected="selected"{/if}
{/if}
>{$option[$input.options.name]|escape:'htmlall':'UTF-8'}</option>
{/foreach}
{/if}
</select>
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
{/if}
{elseif $input.type == 'radio'}
{foreach $input.values as $value}
<input type="radio"
name="{$input.name}"
id="{$value.id}"
value="{$value.value|escape:'htmlall':'UTF-8'}"
{if $fields_value[$input.name] == $value.value}checked="checked"{/if} />
<label {if isset($input.class)}class="{$input.class}"{/if} for="{$value.id}">
{if isset($input.is_bool) && $input.is_bool == true}
{if $value.value == 1}
<img src="../img/admin/enabled.gif" alt="{$value.label}" title="{$value.label}" />
{else}
<img src="../img/admin/disabled.gif" alt="{$value.label}" title="{$value.label}" />
{/if}
{else}
{$value.label}
{/if}
</label>
{if isset($input.br) && $input.br}<br />{/if}
{/foreach}
{elseif $input.type == 'textarea'}
{if isset($input.lang) && isset($input.attributeLang)}
{foreach $languages as $language}
<div id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}">{$fields_value[$input.name][$language.id_lang]}</textarea>
</div>
{/foreach}
{if count($languages) > 1}
<div class="displayed_flag">
<img src="../img/l/{$defaultFormLanguage}.jpg"
class="pointer"
id="language_current_{$input.name}"
onclick="toggleLanguageFlags(this);" />
</div>
<div id="languages_{$input.name}" class="language_flags">
{l s='Choose language:'}<br /><br />
{foreach $languages as $language}
<img src="../img/l/{$language.id_lang}.jpg"
class="pointer"
alt="{$language.name}"
title="{$language.name}"
onclick="changeLanguage('{$input.name}', '{$input.attributeLang}', {$language.id_lang}, '{$language.iso_code}');" />
{/foreach}
</div>
{/if}
{else}
<textarea name="{$input.name}" id="{$input.name}" cols="{$input.cols}" rows="{$input.rows}">{$fields_value[$input.name]}</textarea>
{/if}
{elseif $input.type == 'checkbox'}
{foreach $input.values.query as $value}
{assign var=id_checkbox value=$input.name|cat:'_'|cat:$value[$input.values.id]}
<input type="checkbox" name="{$id_checkbox}" id="{$id_checkbox}" {if $fields_value[$id_checkbox]}checked="checked"{/if} />
<label for="{$id_checkbox}" class="t"><strong>{$value[$input.values.name]}</strong></label><br />
{/foreach}
{elseif $input.type == 'file'}
{if isset($input.display_image) && $input.display_image}
{if isset($fields_value.image) && $fields_value.image}
<div id="image">
{$fields_value.image}
<p align="center">{l s='File size'} {$fields_value.size}kb</p>
<a href="{$current}&id_category={$form_id}&token={$token}&deleteImage=1">
<img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'}
</a>
</div><br />
{/if}
{/if}
<input type="file" name="{$input.name}" />
{elseif $input.type == 'password'}
<input type="password"
name="{$input.name}"
size="{$input.size}"
value="" />
{elseif $input.type == 'group'}
{assign var=groups value=$input.values}
{include file='helper/form/form_group.tpl'}
{elseif $input.type == 'shop' OR $input.type == 'group_shop'}
{include file='helper/form/form_shop.tpl'}
{elseif $input.type == 'categories'}
{assign var=categories value=$input.values}
{include file='helper/form/form_category.tpl'}
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
<label>{l s='Shop association:'}</label>
<div class="margin-form">
{$asso_shop}
</div>
{elseif $input.type == 'color'}
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
<input type="color"
size="{$input.size}"
data-hex="true"
{if isset($input.class)}class="{$input.class}"
{else}class="color mColorPickerInput"{/if}
name="{$input.name}"
value="{$fields_value[$input.name]}" />
{elseif $input.type == 'date'}
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
<input type="text"
size="{$input.size}"
data-hex="true"
{if isset($input.class)}class="{$input.class}"
{else}class="datepicker"{/if}
name="{$input.name}"
value="{$fields_value[$input.name]}" />
{/if}
{if isset($input.required) && $input.required} <sup>*</sup>{/if}
{if isset($input.p)}
<p class="clear">
{if is_array($input.p)}
{foreach $input.p as $p}
{if is_array($p)}
<span id="{$p.id}">{$p.text}</span><br />
{else}
{$p}<br />
{/if}
{/foreach}
{else}
{$input.p}
{/if}
</p>
{/if}
{if isset($languages)}<div class="clear"></div>{/if}
{block name="end_field_block"}</div>{/block}
{/if}
{if $input.name == 'id_state'}
</div>
{/if}
{if $input.type == 'text' && $input.name == 'texture'}
</div>
{/if}
{/foreach}
{elseif $key == 'submit'}
<div class="margin-form">
<input type="submit" value="{$field.title}" name="{$submit_action}" {if isset($field.class)}class="{$field.class}"{/if} />
</div>
{/if}
{/foreach}
{if $required_fields}
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
{/if}
{if isset($fields.tinymce) && $fields.tinymce}
<script type="text/javascript">
var iso = '{$iso}';
var pathCSS = '{$path_css}';
var ad = '{$ad}';
</script>
<script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="'../js/tinymce.inc.js"></script>
{/if}
</fieldset>
</form>
<br /><br />
{if $firstCall && !$no_back}
{if $back}
<a href="{$back}"><img src="../img/admin/arrow2.gif" />{l s='Back'}</a>
{else}
<a href="{$current}&token={$token}"><img src="../img/admin/arrow2.gif" />{l s='Back to list'}</a>
{/if}
<br />
{/if}
{/block}
@@ -1,116 +0,0 @@
{*
* 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: 9608 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<tbody>
{foreach $list AS $index => $tr}
<tr
{if $is_dnd_identifier}id="tr_{$id_category}_{$tr.$identifier}_{$tr.position['position']}"{/if}
{if $index is odd}class="alt_row"{/if}
{if isset($tr.color) && $color_on_bg}style="background-color: {$tr.color}"{/if}
>
<td class="center">
{if $bulk_actions}
{assign var=bulkActionPossible value=true}
{foreach $list_skip_actions as $key => $value}
{if in_array($tr.$identifier, $value) == true}
{assign var=bulkActionPossible value=false}
{/if}
{/foreach}
{if $bulkActionPossible == true}
<input type="checkbox" name="{$table}Box[]" value="{$tr.$identifier}" class="noborder" />
{/if}
{/if}
</td>
{foreach $fields_display AS $key => $params}
<td
{if isset($params.position)}
id="td_{if $id_category}{$id_category}{else}0{/if}_{$tr.$identifier}"
{/if}
class="{if !$no_link}pointer{/if}
{if isset($params.position) && $order_by == 'position'} dragHandle{/if}
{if isset($params.align)} {$params.align}{/if}"
{if (!isset($params.position) && !$no_link)}
onclick="document.location = '{$current_index}&{$identifier}={$tr.$identifier}{if $view}&view{else}&update{/if}{$table}&token={$token}'">{if isset($params.prefix)}{$params.prefix}{/if}
{else}
>
{/if}
{if isset($params.active)}
{$tr.$key}
{elseif isset($params.activeVisu)}
<img src="../img/admin/{if $tr.$key}enabled.gif{else}disabled.gif{/if}"
alt="{if $tr.$key}{l s='Enabled'}{else}{l s='Disabled'}{/if}" title="{if $tr.$key}{l s='Enabled'}{else}{l s='Disabled'}{/if}" />
{elseif isset($params.position)}
{if $order_by == 'position' && $order_way != 'DESC'}
<a href="{$tr.$key.position_url_down}" {if !($tr.$key.position != $positions[count($positions) - 1])}style="display: none;"{/if}>
<img src="../img/admin/{if $order_way == 'ASC'}down{else}up{/if}.gif" alt="{l s='Down'}" title="{l s='Down'}" />
</a>
<a href="{$tr.$key.position_url_up}" {if !($tr.$key.position != $positions.0)}style="display: none;"{/if}>
<img src="../img/admin/{if $order_way == 'ASC'}up{else}down{/if}.gif" alt="{l s='Up'}" title="{l s='Up'}" />
</a>
{else}
{$tr.$key.position + 1}
{/if}
{elseif isset($params.image)}
{$tr.$key}
{elseif (isset($params.icon))}
<img src="../img/admin/{$tr[$key]}" alt="{$tr[$key]}" title="{$tr[$key]}" />
{elseif isset($params.price)}
{$tr.$key}
{elseif isset($params.float)}
{$tr.$key}
{elseif isset($params.type) && $params.type == 'date'}
{$tr.$key}
{elseif isset($params.type) && $params.type == 'datetime'}
{$tr.$key}
{elseif isset($params.callback)}
{$tr.$key}
{elseif isset($tr.$key) && $key == 'color'}
<div style="float: left; width: 18px; height: 12px; border: 1px solid #996633; background-color: {$tr.$key}; margin-right: 4px;"></div>
{elseif isset($tr.$key)}
{$tr.$key|escape:'htmlall':'UTF-8'}
{else}
--
{/if}
{if isset($params.suffix)}{$params.suffix}{/if}
</td>
{/foreach}
{if $shop_link_type}
<td class="center" {if $name != $tr.shop_name}title="{$tr.shop_name}"{/if}>{if isset($tr.shop_short_name)}{$tr.shop_short_name}{else}{$tr.shop_name}{/if}</td>
{/if}
{if $has_actions}
<td class="center" style="white-space: nowrap;">
{foreach $actions AS $action}
{if isset($tr.$action)}
{$tr.$action}
{/if}
{/foreach}
</td>
{/if}
</tr>
{/foreach}
</tbody>
@@ -1,231 +0,0 @@
{*
* 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: 9604 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if !$simple_header}
<link href="../css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function() {
$('table.{$table} .filter').keypress(function(event){
formSubmit(event, 'submitFilterButton{$table}')
})
});
</script>
{* Display column names and arrows for ordering (ASC, DESC) *}
{if $is_order_position}
<script type="text/javascript" src="../js/jquery/jquery.tablednd_0_5.js"></script>
<script type="text/javascript">
var token = '{$token}';
var come_from = '{$table}';
var alternate = {if $order_way == 'DESC'}'1'{else}'0'{/if};
</script>
<script type="text/javascript" src="../js/admin-dnd.js"></script>
{/if}
<script type="text/javascript">
$(function() {
if ($("table.{$table} .datepicker").length > 0)
$("table.{$table} .datepicker").datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
});
</script>
<div class="cat_bar">
<span style="color: #3C8534;">{l s='Current Category:'}</span>
{if count($categories_tree) == 0}
&nbsp;<img src="../img/admin/home.gif" alt="" /> {l s='Home'}
{else}
<a href="{$currentIndex}&id_category=1&viewcategory&token={$token}">
&nbsp;<img src="../img/admin/home.gif" alt="" /> {l s='Home'}&nbsp;>&nbsp;
</a>
{foreach $categories_tree key=key item=category}
<a href="{$currentIndex}&id_category={$category.id_category}&{if $category.id_category == 1}viewcategory{else}addcategory{/if}&token={$token}">
{if $key != 0}
<img src="../img/admin/edit.gif" alt="{l s='edit'}" /> {$category.name}&nbsp;&gt;&nbsp;
</a>
{else}
<img src="../img/admin/edit.gif" alt="" /> {$category.name}
{/if}
{/foreach}
{/if}
</div>
<div class="toolbarBox">
<ul class="cc_button">
{foreach from=$toolbar_btn item=btn key=k}
<li>
<a class="toolbar_btn" href="{$btn.href}" title="{$btn.desc}">
<span class="process-icon-{$btn.imgclass|default:$k} {$btn.class|default:''}" ></span>{$btn.desc}
</a>
</li>
{/foreach}
</ul>
<div class="pageTitle">
<h3>{l s='Categories'}<span id="current_obj" style="font-weight:normal">&nbsp;{$categories_name}</span></h3>
{if $list_total == 0}
{l s='There are no subcategories in '} "{$categories_name}"
{else}
{$list_total}&nbsp;
{if $list_total < 1}
{l s='subcategories'}
{else}
{l s='subcategory'} {l s='in category'} "{$categories_name}"
{/if}
{/if}
</div>
</div>
<a name="{$table}">&nbsp;</a>
<form method="post" action="{$action}" class="form">
{/if}{* End if simple_header *}
<input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
<table style="table-layout: fixed; width: 100%;">
{if !$simple_header}
<tr>
<td style="vertical-align: bottom;">
<span style="float: left;">
{if $page > 1}
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$table}').value=1"/>&nbsp;
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$table}').value={$page - 1}"/>
{/if}
{l s='Page '}<b>{$page}</b> / {$total_pages}
{if $page < $total_pages}
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$table}').value={$page + 1}"/>&nbsp;
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$table}'').value={$total_pages}"/>
{/if}
| {l s='Display'}
<select name="pagination">
{* Choose number of results per page *}
{foreach $pagination AS $value}
<option value="{$value|intval}"{if $selected_pagination == $value} selected="selected" {elseif $selected_pagination == NULL && $value == $pagination[1]} selected="selected2"{/if}>{$value|intval}</option>
{/foreach}
</select>
/ {$list_total} {l s='result(s)'}
</span>
<span style="float: right;">
<input type="submit" name="submitReset{$table}" value="{l s='Reset'}" class="button" />
<input type="submit" id="submitFilterButton{$table}" name="submitFilter" value="{l s='Filter'}" class="button" />
</span>
<span class="clear"></span>
</td>
</tr>
{/if}
<tr>
<td{if $simple_header} style="border:none;"{/if}>
<table
{if $table_id} id={$table_id}{/if}
class="table {if $table_dnd}tableDnd{/if} {$table}"
cellpadding="0" cellspacing="0"
style="width: 100%; margin-bottom:10px;"
>
<thead>
<tr class="nodrag nodrop">
<th style="width:10px;">
{if $delete}
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$table}Box[]', this.checked)" />
{/if}
</th>
{foreach $fields_display AS $key => $params}
<th {if isset($params.widthColumn)} style="width: {if $params.widthColumn == 'auto'}auto{else}{$params.widthColumn}px{/if}"{/if}>{$params.title}
{if (!isset($params.orderby) || $params.orderby) && !$simple_header}
<br />
<a href="{$currentIndex}&{$identifier}={$id_cat}&{$table}Orderby={$key|urlencode}&{$table}Orderway=desc&token={$token}">
<img border="0" src="../img/admin/down{if isset($order_by) && ($key == $order_by) && ($order_way == 'DESC')}_d{/if}.gif" />
</a>
<a href="{$currentIndex}&{$identifier}={$id_cat}&{$table}Orderby={$key|urlencode}&{$table}Orderway=asc&token={$token}">
<img border="0" src="../img/admin/up{if isset($order_by) && ($key == $order_by) && ($order_way == 'ASC')}_d{/if}.gif" />
</a>
{/if}
</th>
{/foreach}
{if $shop_link_type}
<th style="width: 80px">
{if $shop_link_type == 'shop'}
{l s='shop'}
{else}
{l s='Group shop'}
{/if}
</th>
{/if}
{if $has_actions}
<th style="width: 52px">{l s='Actions'}</th>
{/if}
</tr>
{if !$simple_header}
<tr class="nodrag nodrop" style="height: 35px;">
<td class="center">
{if $delete}
--
{/if}
</td>
{* Filters (input, select, date or bool) *}
{foreach $fields_display AS $key => $params}
<td {if isset($params.align)} class="{$params.align}" {/if}>
{if isset($params.search) && !$params.search}
--
{else}
{if $params.type == 'bool'}
<select onchange="$('#submitFilterButton{$table}').focus();$('#submitFilterButton{$table}').click();" name="{$table}Filter_{$key}">
<option value="">--</option>
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
</select>
{elseif $params.type == 'date' || $params.type == 'datetime'}
{l s='From'} <input type="text" class="filter datepicker" id="{$name_id}_0" name="{$name}[0]" value="{if isset($value.0)}$value.0{/if}"{if isset($params.width)} style="width:{$params.width}px"{/if}/><br />
{l s='To'} <input type="text" class="filter datepicker" id="{$name_id}_1" name="{$name}[1]" value="{if isset($value.1)}$value.1{/if}"{if isset($params.width)} style="width:{$params.width}px"{/if}/>
{elseif $params.type == 'select'}
{if isset($params.filter_key)}
<select onchange="$('#submitFilterButton{$table}').focus();$('#submitFilterButton{$table}').click();" name="{$table}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
<option value="" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>--</option>
{if isset($params.select) && is_array($params.select)}
{foreach $params.select AS $option_value => $option_display}
<option value="{$option_value}" {if $option_display.selected == 'selected'} selected="selected"{/if}>{$option_display}</option>
{/foreach}
{/if}
</select>
{/if}
{else}
<input type="text" class="filter" name="{$table}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'htmlall':'UTF-8'}" {if isset($params.width)} style="width:{$params.width}px"{/if} />
{/if}
{/if}
</td>
{/foreach}
{if $shop_link_type}
<td>--</td>
{/if}
{if $has_actions}
<td class="center">--</td>
{/if}
</tr>
{/if}
</thead>
+102 -86
View File
@@ -31,47 +31,47 @@
var id_language = {$defaultFormLanguage};
var languages = new Array();
$(document).ready(function() {ldelim}
$(document).ready(function() {
{foreach $languages as $k => $language}
languages[{$k}] = {ldelim}
languages[{$k}] = {
id_lang: {$language.id_lang},
iso_code: '{$language.iso_code}',
name: '{$language.name}'
{rdelim};
};
{/foreach}
displayFlags(languages, id_language, {$allowEmployeeFormLang});
{if isset($fields_value.id_state)}
if ($('#id_country') && $('#id_state'))
{ldelim}
{
ajaxStates({$fields_value.id_state});
$('#id_country').change(function() {ldelim}
$('#id_country').change(function() {
ajaxStates();
{rdelim});
{rdelim}
});
}
{/if}
{rdelim});
if ($(".datepicker").length > 0)
$(".datepicker").datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
});
{block name="script"}
{/block}
</script>
<script type="text/javascript" src="../js/form.js"></script>
{/if}
<div class="toolbarBox">
<ul class="cc_button">
{foreach from=$toolbar_btn item=btn key=k}
<li>
<a class="toolbar_btn" href="{$btn.href}" title="{$btn.desc}">
<span class="process-icon-{$btn.imgclass|default:$k} {$btn.class|default:''}" ></span>{$btn.desc}
</a>
</li>
{/foreach}
</ul>
<div class="pageTitle">{* todo : what to display as title for each items (table_lang.name ? *}
<h3><span id="current_obj" style="font-weight: normal;">{$current_obj_name|default:'&nbsp;'}</span></h3>
</div>
</div>
{if $show_toolbar}
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn}
{/if}
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
<form class="defaultForm" action="{$current}&{$submit_action}=1&token={$token}" method="post" enctype="multipart/form-data">
{if $form_id}
<input type="hidden" name="id_{$table}" value="{$form_id}" />
<input type="hidden" name="id_{$table}" id="id_{$table}" value="{$form_id}" />
{/if}
<fieldset>
{foreach $fields as $key => $field}
@@ -85,46 +85,34 @@
{if $input.name == 'id_state'}
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
{/if}
{block name="label"}
{if isset($input.label)}
<label>{$input.label} </label>
<label>{$input.label} </label>
{/if}
{/block}
{if $input.type == 'hidden'}
<input type="hidden" name="{$input.name}" value="{$fields_value[$input.name]}" />
{else}
<div class="margin-form">
{block name="start_field_block"}
<div class="margin-form">
{/block}
{if $input.type == 'text'}
{if isset($input.lang) && isset($input.attributeLang)}
{foreach $languages as $language}
<div id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
<input type="text"
name="{$input.name}_{$language.id_lang}"
value="{$fields_value[$input.name][$language.id_lang]}"
{if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
{if isset($input.class)}class="{$input.class}"{/if}
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
</div>
{/foreach}
{if count($languages) > 1}
<div class="displayed_flag">
<img src="../img/l/{$defaultFormLanguage}.jpg"
class="pointer"
id="language_current_{$input.name}"
onclick="toggleLanguageFlags(this);" />
</div>
<div id="languages_{$input.name}" class="language_flags">
{l s='Choose language:'}<br /><br />
{foreach $languages as $language}
<img src="../img/l/{$language.id_lang}.jpg"
class="pointer"
alt="{$language.name}"
title="{$language.name}"
onclick="changeLanguage('{$input.name}', '{$input.attributeLang}', {$language.id_lang}, '{$language.iso_code}');" />
{/foreach}
</div>
{/if}
{if isset($input.lang)}
<div class="translatable">
{foreach $languages as $language}
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
<input type="text"
name="{$input.name}_{$language.id_lang}"
value="{$fields_value[$input.name][$language.id_lang]}"
{if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
{if isset($input.class)}class="{$input.class}"{/if}
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
</div>
{/foreach}
</div>
{else}
<input type="text"
name="{$input.name}"
@@ -135,6 +123,7 @@
{if isset($input.class)}class="{$input.class}"{/if}
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
{if isset($input.suffix)}{$input.suffix}{/if}
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
{/if}
{elseif $input.type == 'select'}
@@ -143,7 +132,11 @@
{$input.required = false}
{$input.p = null}
{else}
<select name="{$input.name}" id="{$input.name}" {if isset($input.multiple)}multiple="multiple" {/if}{if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
<select name="{$input.name}"
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
{if isset($input.multiple)}multiple="multiple" {/if}
{if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
{if isset($input.options.default)}
<option value="{$input.options.default.value}">{$input.options.default.label}</option>
{/if}
@@ -168,7 +161,6 @@
<option value="{$option[$input.options.id]}"
{if isset($input.multiple)}
{foreach $fields_value[$input.name] as $field_value}
{$field_value}
{if $field_value == $option[$input.options.id]}selected="selected"{/if}
{/foreach}
{else}
@@ -201,30 +193,14 @@
{if isset($input.br) && $input.br}<br />{/if}
{/foreach}
{elseif $input.type == 'textarea'}
{if isset($input.lang) && isset($input.attributeLang)}
{foreach $languages as $language}
<div id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}">{$fields_value[$input.name][$language.id_lang]}</textarea>
</div>
{/foreach}
{if count($languages) > 1}
<div class="displayed_flag">
<img src="../img/l/{$defaultFormLanguage}.jpg"
class="pointer"
id="language_current_{$input.name}"
onclick="toggleLanguageFlags(this);" />
</div>
<div id="languages_{$input.name}" class="language_flags">
{l s='Choose language:'}<br /><br />
{foreach $languages as $language}
<img src="../img/l/{$language.id_lang}.jpg"
class="pointer"
alt="{$language.name}"
title="{$language.name}"
onclick="changeLanguage('{$input.name}', '{$input.attributeLang}', {$language.id_lang}, '{$language.iso_code}');" />
{/foreach}
</div>
{/if}
{if isset($input.lang)}
<div class="translatable">
{foreach $languages as $language}
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}">{$fields_value[$input.name][$language.id_lang]}</textarea>
</div>
{/foreach}
</div>
{else}
<textarea name="{$input.name}" id="{$input.name}" cols="{$input.cols}" rows="{$input.rows}">{$fields_value[$input.name]}</textarea>
{/if}
@@ -235,8 +211,18 @@
<label for="{$id_checkbox}" class="t"><strong>{$value[$input.values.name]}</strong></label><br />
{/foreach}
{elseif $input.type == 'file'}
{if isset($input.display_image) && $input.display_image}
{if isset($fields_value.image) && $fields_value.image}
<div id="image">
{$fields_value.image}
<p align="center">{l s='File size'} {$fields_value.size}kb</p>
<a href="{$current}&id_category={$form_id}&token={$token}&deleteImage=1">
<img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'}
</a>
</div><br />
{/if}
{/if}
<input type="file" name="{$input.name}" />
<img src="{$fields_value[$input.name]}" />
{elseif $input.type == 'password'}
<input type="password"
name="{$input.name}"
@@ -267,6 +253,24 @@
<div class="margin-form">
{$asso_shop}
</div>
{elseif $input.type == 'color'}
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
<input type="color"
size="{$input.size}"
data-hex="true"
{if isset($input.class)}class="{$input.class}"
{else}class="color mColorPickerInput"{/if}
name="{$input.name}"
value="{$fields_value[$input.name]}" />
{elseif $input.type == 'date'}
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
<input type="text"
size="{$input.size}"
data-hex="true"
{if isset($input.class)}class="{$input.class}"
{else}class="datepicker"{/if}
name="{$input.name}"
value="{$fields_value[$input.name]}" />
{/if}
{if isset($input.required) && $input.required} <sup>*</sup>{/if}
{if isset($input.p)}
@@ -285,7 +289,7 @@
</p>
{/if}
{if isset($languages)}<div class="clear"></div>{/if}
</div>
{block name="end_field_block"}</div>{/block}
{/if}
{if $input.name == 'id_state'}
</div>
@@ -293,13 +297,25 @@
{/foreach}
{elseif $key == 'submit'}
<div class="margin-form">
<input type="submit" value="{$field.title}" name="{$submit_action}" {if isset($field.class)}class="{$field.class}"{/if} />
<input type="submit"
value="{$field.title}"
name="{$submit_action}{if isset($field.stay) && $field.stay}AndStay{/if}"
{if isset($field.class)}class="{$field.class}"{/if} />
</div>
{/if}
{/foreach}
{if $required_fields}
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
{/if}
{if isset($fields.tinymce) && $fields.tinymce}
<script type="text/javascript">
var iso = '{$iso}';
var pathCSS = '{$path_css}';
var ad = '{$ad}';
</script>
<script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="'../js/tinymce.inc.js"></script>
{/if}
</fieldset>
</form>
+7
View File
@@ -45,6 +45,13 @@
</div>
</div>
<div id="ajax_confirmation" style="display:none"></div>
{* ajaxBox allows*}
<div id="ajaxBox" style="display:none"></div>
<script>
function doAjaxAction(action, fromSelector)
{
}
</script>
{/if}
</body>
</html>
+28 -15
View File
@@ -31,24 +31,24 @@
var id_language = {$defaultFormLanguage};
var languages = new Array();
$(document).ready(function() {ldelim}
$(document).ready(function() {
{foreach $languages as $k => $language}
languages[{$k}] = {ldelim}
languages[{$k}] = {
id_lang: {$language.id_lang},
iso_code: '{$language.iso_code}',
name: '{$language.name}'
{rdelim};
};
{/foreach}
displayFlags(languages, id_language, {$allowEmployeeFormLang});
{if isset($fields_value.id_state)}
if ($('#id_country') && $('#id_state'))
{ldelim}
{
ajaxStates({$fields_value.id_state});
$('#id_country').change(function() {ldelim}
$('#id_country').change(function() {
ajaxStates();
{rdelim});
{rdelim}
});
}
{/if}
if ($(".datepicker").length > 0)
@@ -58,17 +58,16 @@
dateFormat: 'yy-mm-dd'
});
{rdelim});
</script>
<script type="text/javascript" src="../js/form.js"></script>
});
{block name="script"}
{/block}
</script>
<script type="text/javascript" src="../js/form.js"></script>
{/if}
{if isset($toolbar) && $toolbar}
{include file="toolbar.tpl"}
{if $show_toolbar}
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn}
{/if}
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
<form class="defaultForm" action="{$current}&{$submit_action}=1&token={$token}" method="post" enctype="multipart/form-data">
{if $form_id}
@@ -233,14 +232,28 @@
name="{$input.name}"
size="{$input.size}"
value="" />
{elseif $input.type == 'birthday'}
{foreach $input.options as $key => $select}
<select name="{$key}">
<option value="">-</option>
{if $key == 'months'}
{foreach $select as $k => $v}
<option value="{$k}" {if $k == $fields_value[$key]}selected="selected"{/if}>{$v}</option>
{/foreach}
{else}
{foreach $select as $v}
<option value="{$v}" {if $v == $fields_value[$key]}selected="selected"{/if}>{$v}</option>
{/foreach}
{/if}
</select>
{/foreach}
{elseif $input.type == 'group'}
{assign var=groups value=$input.values}
{include file='helper/form/form_group.tpl'}
{elseif $input.type == 'shop' OR $input.type == 'group_shop'}
{include file='helper/form/form_shop.tpl'}
{elseif $input.type == 'categories'}
{assign var=categories value=$input.values}
{include file='helper/form/form_category.tpl'}
{include file='helper/form/form_category.tpl' categories=$input.values}
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
<label>{l s='Shop association:'}</label>
<div class="margin-form">
@@ -58,16 +58,17 @@
{assign var=home_is_selected value=false}
{foreach $categories.selected_cat AS $cat}
{if is_array($cat)}
{if $cat['id_category'] != 1}
<input type="hidden" name="{$categories.input_name}" value="{$cat.id_category}" >
{if $cat.id_category != 1}
<input {if in_array($cat.id_category, $categories.disabled_categories)}disabled="disabled"{/if} type="hidden" name="{$categories.input_name}" value="{$cat.id_category}" >
{else}
{assign var=home_is_selected value=true}
{/if}
{else}
{if $cat != 1}
<input type="hidden" name="{$categories.input_name}" value="{$cat}" >
<input {if in_array($cat, $categories.disabled_categories)}disabled="disabled"{/if} type="hidden" name="{$categories.input_name}" value="{$cat}" >
{else}
{assign var=home_is_selected value=true}
{/if}
@@ -88,4 +89,4 @@
</ul>
</li>
</ul>
{/if}
{/if}
@@ -1,5 +1,5 @@
{*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -23,17 +23,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if isset($list_manufacturers)}
{include file="toolbar.tpl"}
<h2>{l s='List of manufacturers:'}</h2>
{$list_manufacturers}
{/if}
{if isset($list_addresses)}
{include file="toolbar.tpl"}
<h2>{l s='Manufacturers addresses:'}</h2>
{$list_addresses}
{/if}
{$header}
{$content}
{$footer}
@@ -24,6 +24,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<tbody>
{if count($list)}
{foreach $list AS $index => $tr}
<tr
{if $is_dnd_identifier}id="tr_{$id_category}_{$tr.$identifier}_{$tr.position['position']}"{/if}
@@ -41,8 +42,8 @@
id="td_{if $id_category}{$id_category}{else}0{/if}_{$tr.$identifier}"
{/if}
class="{if !$no_link}pointer{/if}
{if isset($params.position) && $order_by == 'position'} dragHandle{/if}
{if isset($params.align)} {$params.align}{/if}"
{if isset($params.position) && $order_by == 'position'} dragHandle{/if}
{if isset($params.align)} {$params.align}{/if}"
{if (!isset($params.position) && !$no_link)}
onclick="document.location = '{$current_index}&{$identifier}={$tr.$identifier}{if $view}&view{else}&update{/if}{$table}&token={$token}'">{if isset($params.prefix)}{$params.prefix}{/if}
@@ -50,7 +51,7 @@
>
{/if}
{if isset($params.active)}
{$tr.$key}
{$tr.$key}
{elseif isset($params.activeVisu)}
<img src="../img/admin/{if $tr.$key}enabled.gif{else}disabled.gif{/if}"
alt="{if $tr.$key}{l s='Enabled'}{else}{l s='Disabled'}{/if}" title="{if $tr.$key}{l s='Enabled'}{else}{l s='Disabled'}{/if}" />
@@ -70,7 +71,7 @@
{$tr.$key}
{elseif (isset($params.icon))}
<img src="../img/admin/{$tr[$key]}" alt="{$tr[$key]}" title="{$tr[$key]}" />
{elseif isset($params.price)}
{elseif isset($params.price)}
{$tr.$key}
{elseif isset($params.float)}
{$tr.$key}
@@ -80,6 +81,8 @@
{$tr.$key}
{elseif isset($params.callback)}
{$tr.$key}
{elseif isset($tr.$key) && $key == 'color'}
<div style="float: left; width: 18px; height: 12px; border: 1px solid #996633; background-color: {$tr.$key}; margin-right: 4px;"></div>
{elseif isset($tr.$key)}
{$tr.$key|escape:'htmlall':'UTF-8'}
{else}
@@ -90,17 +93,25 @@
{/foreach}
{if $shop_link_type}
<td class="center" {if $name != $tr.shop_name}title="{$tr.shop_name}"{/if}>{if isset($tr.shop_short_name)}{$tr.shop_short_name}{else}{$tr.shop_name}{/if}</td>
<td class="center" title="{$tr.shop_name}">
{if isset($tr.shop_short_name)}
{$tr.shop_short_name}
{else}
{$tr.shop_name}
{/if}</td>
{/if}
{if $has_actions}
<td class="center" style="white-space: nowrap;">
{foreach $actions AS $action}
{if isset($tr.$action)}
{$tr.$action}
{/if}
{$tr.$action}
{/if}
{/foreach}
</td>
{/if}
</tr>
{/foreach}
</tbody>
{else}
<tr><td class="center" colspan="{count($fields_display) + 2}">{l s='No items found'}</td></tr>
{/if}
</tbody>
@@ -36,7 +36,7 @@
</script>
{* Display column names and arrows for ordering (ASC, DESC) *}
{if $is_order_position}
<script type="text/javascript" src="../js/jquery/jquery.tablednd_0_5.js"></script>
<script type="text/javascript" src="../js/jquery/plugins/jquery.tablednd.js"></script>
<script type="text/javascript">
var token = '{$token}';
var come_from = '{$table}';
@@ -55,14 +55,20 @@
});
});
</script>
{if isset($toolbar) && $toolbar}
{include file="toolbar.tpl"}
{/if}
<a name="{$table}">&nbsp;</a>
{/if}{* End if simple_header *}
<form method="post" action="{$action}" class="form">
{if $show_toolbar}
<div class="pageTitle">
<h3>{block name=pageTitle}
<span id="current_obj" style="font-weight: normal;">{$page_title|default:'&nbsp;'}</span>
{/block}</h3>
</div>
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn}
{/if}
<a name="{$table}">&nbsp;</a>
<form method="post" action="{$action}" class="form">
<input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
<table class="table_grid">
{if !$simple_header}
@@ -25,266 +25,14 @@
*}
{if $firstCall}
<script type="text/javascript">
var vat_number = {$vat_number};
var module_dir = '{$module_dir}';
var id_language = {$defaultFormLanguage};
var languages = new Array();
$(document).ready(function() {ldelim}
{foreach $languages as $k => $language}
languages[{$k}] = {ldelim}
id_lang: {$language.id_lang},
iso_code: '{$language.iso_code}',
name: '{$language.name}'
{rdelim};
{/foreach}
displayFlags(languages, id_language, {$allowEmployeeFormLang});
{if isset($fields_value.id_state)}
if ($('#id_country') && $('#id_state'))
{ldelim}
ajaxStates({$fields_value.id_state});
$('#id_country').change(function() {ldelim}
ajaxStates();
{rdelim});
{rdelim}
{/if}
{rdelim});
</script>
<script type="text/javascript" src="../js/form.js"></script>
{/if}
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
<form action="{$current}&{$submit_action}=1&token={$token}" method="post" enctype="multipart/form-data">
{if $form_id}
<input type="hidden" name="id_{$table}" value="{$form_id}" />
{/if}
<fieldset>
{foreach $fields as $key => $field}
{if $key == 'legend'}
<legend>
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title}" />{/if}
{$field.title}
</legend>
{elseif $key == 'input'}
{foreach $field as $input}
{if $input.name == 'id_state'}
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
{/if}
{block name="label"}
{if isset($input.label)}
<label>{$input.label} </label>
{/if}
{/block}
{if $input.type == 'hidden'}
<input type="hidden" name="{$input.name}" value="{$fields_value[$input.name]}" />
{else}
{block name="start_field_block"}
<div class="margin-form">
{/block}
{if $input.type == 'text'}
{if isset($input.lang) && isset($input.attributeLang)}
{foreach $languages as $language}
<div id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
<input type="text"
name="{$input.name}_{$language.id_lang}"
value="{$fields_value[$input.name][$language.id_lang]}"
{if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
{if isset($input.class)}class="{$input.class}"{/if}
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
</div>
{/foreach}
{if count($languages) > 1}
<div class="displayed_flag">
<img src="../img/l/{$defaultFormLanguage}.jpg"
class="pointer"
id="language_current_{$input.name}"
onclick="toggleLanguageFlags(this);" />
</div>
<div id="languages_{$input.name}" class="language_flags">
{l s='Choose language:'}<br /><br />
{foreach $languages as $language}
<img src="../img/l/{$language.id_lang}.jpg"
class="pointer"
alt="{$language.name}"
title="{$language.name}"
onclick="changeLanguage('{$input.name}', '{$input.attributeLang}', {$language.id_lang}, '{$language.iso_code}');" />
{/foreach}
</div>
{/if}
{else}
<input type="text"
name="{$input.name}"
id="{$input.name}"
value="{$fields_value[$input.name]}"
{if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
{if isset($input.class)}class="{$input.class}"{/if}
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
{if isset($input.suffix)}{$input.suffix}{/if}
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
{/if}
{elseif $input.type == 'select'}
{if isset($input.options.query) && !$input.options.query && isset($input.empty_message)}
{$input.empty_message}
{$input.required = false}
{$input.p = null}
{else}
<select name="{$input.name}" id="{$input.name}" {if isset($input.multiple)}multiple="multiple" {/if}{if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
{if isset($input.options.default)}
<option value="{$input.options.default.value}">{$input.options.default.label}</option>
{/if}
{if isset($input.options.optiongroup)}
{foreach $input.options.optiongroup.query AS $optiongroup}
<optgroup label="{$optiongroup[$input.options.optiongroup.label]}">
{foreach $optiongroup[$input.options.options.query] as $option}
<option value="{$option[$input.options.options.id]}"
{if isset($input.multiple)}
{foreach $fields_value[$input.name] as $field_value}
{if $field_value == $option[$input.options.options.id]}selected="selected"{/if}
{/foreach}
{else}
{if $fields_value[$input.name] == $option[$input.options.options.id]}selected="selected"{/if}
{/if}
>{$option[$input.options.options.name]|escape:'htmlall':'UTF-8'}</option>
{/foreach}
</optgroup>
{/foreach}
{else}
{foreach $input.options.query AS $option}
<option value="{$option[$input.options.id]}"
{if isset($input.multiple)}
{foreach $fields_value[$input.name] as $field_value}
{$field_value}
{if $field_value == $option[$input.options.id]}selected="selected"{/if}
{/foreach}
{else}
{if $fields_value[$input.name] == $option[$input.options.id]}selected="selected"{/if}
{/if}
>{$option[$input.options.name]|escape:'htmlall':'UTF-8'}</option>
{/foreach}
{/if}
</select>
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
{/if}
{elseif $input.type == 'radio'}
{foreach $input.values as $value}
<input type="radio"
name="{$input.name}"
id="{$value.id}"
value="{$value.value|escape:'htmlall':'UTF-8'}"
{if $fields_value[$input.name] == $value.value}checked="checked"{/if} />
<label {if isset($input.class)}class="{$input.class}"{/if} for="{$value.id}">
{if isset($input.is_bool) && $input.is_bool == true}
{if $value.value == 1}
<img src="../img/admin/enabled.gif" alt="{$value.label}" title="{$value.label}" />
{else}
<img src="../img/admin/disabled.gif" alt="{$value.label}" title="{$value.label}" />
{/if}
{else}
{$value.label}
{/if}
</label>
{if isset($input.br) && $input.br}<br />{/if}
{/foreach}
{elseif $input.type == 'textarea'}
{if isset($input.lang) && isset($input.attributeLang)}
{foreach $languages as $language}
<div id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}">{$fields_value[$input.name][$language.id_lang]}</textarea>
</div>
{/foreach}
{if count($languages) > 1}
<div class="displayed_flag">
<img src="../img/l/{$defaultFormLanguage}.jpg"
class="pointer"
id="language_current_{$input.name}"
onclick="toggleLanguageFlags(this);" />
</div>
<div id="languages_{$input.name}" class="language_flags">
{l s='Choose language:'}<br /><br />
{foreach $languages as $language}
<img src="../img/l/{$language.id_lang}.jpg"
class="pointer"
alt="{$language.name}"
title="{$language.name}"
onclick="changeLanguage('{$input.name}', '{$input.attributeLang}', {$language.id_lang}, '{$language.iso_code}');" />
{/foreach}
</div>
{/if}
{else}
<textarea name="{$input.name}" id="{$input.name}" cols="{$input.cols}" rows="{$input.rows}">{$fields_value[$input.name]}</textarea>
{/if}
{elseif $input.type == 'checkbox'}
{foreach $input.values.query as $value}
{assign var=id_checkbox value=$input.name|cat:'_'|cat:$value[$input.values.id]}
<input type="checkbox" name="{$id_checkbox}" id="{$id_checkbox}" {if $fields_value[$id_checkbox]}checked="checked"{/if} />
<label for="{$id_checkbox}" class="t"><strong>{$value[$input.values.name]}</strong></label><br />
{/foreach}
{elseif $input.type == 'file'}
<input type="file" name="{$input.name}" />
<img src="{$fields_value[$input.name]}" />
{elseif $input.type == 'password'}
<input type="password"
name="{$input.name}"
size="{$input.size}"
value="" />
{elseif $input.type == 'group'}
{assign var=groups value=$input.values}
{include file='form_group.tpl'}
{elseif $input.type == 'shop' OR $input.type == 'group_shop'}
{include file='form_shop.tpl'}
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
<label>{l s='Shop association:'}</label>
<div class="margin-form">
{$asso_shop}
</div>
{/if}
{if isset($input.required) && $input.required} <sup>*</sup>{/if}
{if isset($input.p)}
<p class="clear">
{if is_array($input.p)}
{foreach $input.p as $p}
{if is_array($p)}
<span id="{$p.id}">{$p.text}</span><br />
{else}
{$p}<br />
{/if}
{/foreach}
{else}
{$input.p}
{/if}
</p>
{/if}
{if isset($languages)}<div class="clear"></div>{/if}
{block name="end_field_block"}</div>{/block}
{/if}
{if $input.name == 'id_state'}
</div>
{/if}
{/foreach}
{elseif $key == 'submit'}
<div class="margin-form">
<input type="submit" value="{$field.title}" name="{$submit_action}" {if isset($field.class)}class="{$field.class}"{/if} />
</div>
{/if}
{/foreach}
{if $required_fields}
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
{/if}
</fieldset>
</form>
<br /><br />
{if $firstCall && !$no_back}
{if $back}
<a href="{$back}"><img src="../img/admin/arrow2.gif" />{l s='Back'}</a>
{else}
<a href="{$current}&token={$token}"><img src="../img/admin/arrow2.gif" />{l s='Back to list'}</a>
{/if}
<br />
{/if}
{extends file="helper/form/form.tpl"}
{block name=script}
$(document).ready(function(){
if ($(".datepicker").length > 0)
$(".datepicker").datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd'
});
});
{/block}
@@ -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
*}
<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>
@@ -24,7 +24,6 @@
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="../helper/form/form.tpl"}
{block name="label"}
{if $input.type == 'select' && $input.name == 'country[]'}
<div id="add_new_tax_rule" style="display:none">
@@ -60,8 +59,6 @@
{/block}
{block name="script"}
<script type="text/javascript">
$(document).ready(function() {
$('#country').click(function() {
populateStates($(this).val(), '');
@@ -154,6 +151,4 @@
populateStates(0,0);
}
</script>
{/block}
{/block}
+18 -15
View File
@@ -23,19 +23,22 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if count($toolbar_btn) > 0}
<div class="toolbarBox">
<ul class="cc_button">
{foreach from=$toolbar_btn item=btn key=k}
<li>
<a class="toolbar_btn" href="{$btn.href}" title="{$btn.desc}">
<span class="process-icon-{$btn.imgclass|default:$k} {$btn.class|default:'' }" ></span>{$btn.desc}
</a>
</li>
{/foreach}
</ul>
<div class="pageTitle">{* todo : what to display as title for each items (table_lang.name ? *}
<h3><span id="current_obj" style="font-weight: normal;">{$current_obj_name|default:'&nbsp;'}</span></h3>
</div>
<div class="toolbarBox">
{block name=toolbarBox}
<ul class="cc_button">
{foreach from=$toolbar_btn item=btn key=k}
<li>
<a class="toolbar_btn" href="{$btn.href}" title="{$btn.desc}">
<span class="process-icon-{$btn.imgclass|default:$k} {$btn.class|default:'' }" ></span>{$btn.desc}
</a>
</li>
{/foreach}
</ul>
<div class="pageTitle">
<h3>{block name=pageTitle}
<span id="current_obj" style="font-weight: normal;">{$title|default:'&nbsp;'}</span>
{/block}</h3>
</div>
{/if}
{/block}
</div>
+13 -17
View File
@@ -78,7 +78,7 @@ class AdminControllerCore extends Controller
protected $list_simple_header;
/** @var define if the header of the list contains filter and sorting links or not */
protected $list_title;
protected $toolbar_title;
/** @var array list to be generated */
protected $fieldsDisplay;
@@ -192,7 +192,8 @@ class AdminControllerCore extends Controller
protected $action;
protected $display;
protected $_includeContainer = true;
protected $tpl_folder;
public $tpl_folder;
/** @var bool Redirect or not ater a creation */
protected $_redirect = true;
@@ -739,7 +740,6 @@ class AdminControllerCore extends Controller
'desc' => $this->l('Add new')
);
}
$this->context->smarty->assign('toolbar_btn', $this->toolbar_btn);
}
/**
@@ -1151,12 +1151,6 @@ class AdminControllerCore extends Controller
$helper = new HelperList();
// Check if list templates have been overriden
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_header.tpl'))
$helper->header_tpl = $this->tpl_folder.'list_header.tpl';
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_content.tpl'))
$helper->content_tpl = $this->tpl_folder.'list_content.tpl';
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_footer.tpl'))
$helper->footer_tpl = $this->tpl_folder.'list_footer.tpl';
// For compatibility reasons, we have to check standard actions in class attributes
foreach ($this->actions_available as $action)
@@ -1183,10 +1177,11 @@ class AdminControllerCore extends Controller
* @return void
*/
public function setHelperListDisplay(Helper $helper)
{
{
// @todo : move that in Helper
$helper->actions = $this->actions;
$helper->simple_header = $this->list_simple_header;
$helper->title = $this->list_title;
$helper->title = $this->toolbar_title;
$helper->toolbar_btn = $this->toolbar_btn;
$helper->bulk_actions = $this->bulk_actions;
$helper->currentIndex = self::$currentIndex;
@@ -1223,10 +1218,10 @@ class AdminControllerCore extends Controller
if ($this->fields_form && is_array($this->fields_form))
{
$this->getlanguages();
$helper = new HelperForm();
$helper = new HelperForm($this);
// Check if form template has been overriden
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'form.tpl'))
$helper->tpl = $this->tpl_folder.'form.tpl';
$helper->setTpl($this->tpl_folder.'form.tpl');
$helper->currentIndex = self::$currentIndex;
$helper->token = $this->token;
$helper->table = $this->table;
@@ -1238,14 +1233,14 @@ class AdminControllerCore extends Controller
$helper->fields_value = $this->getFieldsValue($this->object);
$helper->toolbar_btn = $this->toolbar_btn;
$helper->no_back = isset($this->no_back) ? $this->no_back : false;
$helper->tpl_vars = $this->tpl_form_vars;
if ($this->tabAccess['view'])
{
if (Tools::getValue('back'))
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue('back')));
$this->tpl_vars['back'] = Tools::safeOutput(Tools::getValue('back'));
else
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue(self::$currentIndex.'&token='.$this->token)));
$this->tpl_vars['back'] = Tools::safeOutput(Tools::getValue(self::$currentIndex.'&token='.$this->token));
}
return $helper->generateForm($this->fields_form);
}
}
@@ -1260,9 +1255,10 @@ class AdminControllerCore extends Controller
$helper = new HelperOptions();
// Check if form template has been overriden
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'options.tpl'))
$helper->tpl = $this->tpl_folder.'options.tpl';
$helper->setTpl($this->tpl_folder.'options.tpl');
$helper->id = $this->id;
$helper->token = $this->token;
$helper->shopLinkType = $this->shopLinkType;
$helper->table = $this->table;
$helper->currentIndex = self::$currentIndex;
return $helper->generateOptions($this->options);
+33 -3
View File
@@ -37,11 +37,39 @@ class HelperCore
public $identifier;
public $token;
public $toolbar_btn;
public $title;
public $show_toolbar = true;
public $context;
/**
* @var string filename, then smartyTemplate object
*/
protected $tpl = 'content.tpl';
public $tpl_vars = array();
public function __construct()
{
$this->context = Context::getContext();
$this->tpl = $this->context->smarty->createTemplate($this->tpl);
}
public function setTpl($tpl)
{
if (file_exists($this->context->smarty->template_dir[0].'/'.$tpl))
$this->tpl = $this->context->smarty->createTemplate($tpl);
}
/**
* default behaviour for helper is to return a tpl fetched
*
* @return void
*/
public function generate()
{
$this->tpl->assign($this->tpl_vars);
return $this->tpl->fetch();
}
@@ -69,7 +97,7 @@ class HelperCore
* @param type $input_name name of input
* @return string
*/
public static function renderAdminCategorieTree($trads, $selected_cat = array(), $input_name = 'categoryBox', $use_radio = false, $use_search = false)
public static function renderAdminCategorieTree($trads, $selected_cat = array(), $input_name = 'categoryBox', $use_radio = false, $use_search = false, $disabled_categories = array())
{
if (!$use_radio)
$input_name = $input_name.'[]';
@@ -117,15 +145,17 @@ class HelperCore
{
if (is_array($cat))
{
$disabled = in_array($cat['id_category'], $disabled_categories);
if ($cat['id_category'] != 1)
$html .= '<input type="hidden" name="'.$input_name.'" value="'.$cat['id_category'].'" >';
$html .= '<input '.($disabled?'disabled="disabled"':'').' type="hidden" name="'.$input_name.'" value="'.$cat['id_category'].'" >';
else
$home_is_selected = true;
}
else
{
$disabled = in_array($cat, $disabled_categories);
if ($cat != 1)
$html .= '<input type="hidden" name="'.$input_name.'" value="'.$cat.'" >';
$html .= '<input '.($disabled?'disabled="disabled"':'').' type="hidden" name="'.$input_name.'" value="'.$cat.'" >';
else
$home_is_selected = true;
}
+6 -8
View File
@@ -62,22 +62,21 @@ class HelperFormCore extends Helper
public $default_form_language = null;
public $allow_employee_form_lang = null;
public $tpl = 'helper/form/form.tpl';
protected $tpl = 'helper/form/form.tpl';
public function generateForm($fields_form)
{
$this->fields_form = $fields_form;
return $this->displayForm();
return $this->generate();
}
public function displayForm()
public function generate()
{
if ($this->submit_action == '')
$this->submit_action = 'submitAdd'.$this->table;
$iso = $this->context->language->iso_code;
$this->context->smarty->assign(array(
$this->tpl->assign(array(
'submit_action' => $this->submit_action,
'toolbar_btn' => $this->toolbar_btn,
'firstCall' => $this->first_call,
@@ -100,10 +99,9 @@ class HelperFormCore extends Helper
'iso' => file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en',
'path_css' => _THEME_CSS_DIR_,
'ad' => dirname($_SERVER["PHP_SELF"]),
'toolbar' => $this->toolbar
'show_toolbar' => $this->show_toolbar
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->tpl);
return parent::generate();
}
public function getFieldsRequired()
+62 -35
View File
@@ -81,9 +81,10 @@ class HelperListCore extends Helper
/** @var boolean Content line is clickable if true */
public $no_link = false;
public $header_tpl = 'helper/list/list_header.tpl';
public $content_tpl = 'helper/list/list_content.tpl';
public $footer_tpl = 'helper/list/list_footer.tpl';
protected $tpl = 'helper/list/list.tpl';
protected $header_tpl = 'helper/list/list_header.tpl';
protected $content_tpl = 'helper/list/list_content.tpl';
protected $footer_tpl = 'helper/list/list_footer.tpl';
/** @var array list of required actions for each list row */
public $actions = array();
@@ -112,6 +113,27 @@ class HelperListCore extends Helper
/** @var boolean ask for simple header : no filters, no paginations and no sorting */
public $simple_header = false;
public function __construct()
{
parent::__construct();
$smarty = $this->context->smarty;
$controller = $this->context->controller;
// handle template overriding (smarty 3 template inheritance)
if (file_exists($smarty->template_dir[0].'/'.$controller->tpl_folder.'list_header.tpl'))
$this->header_tpl = $controller->tpl_folder.'list_header.tpl';
if (file_exists($smarty->template_dir[0].'/'.$controller->tpl_folder.'list_content.tpl'))
$this->content_tpl = $controller->tpl_folder.'list_content.tpl';
if (file_exists($smarty->template_dir[0].'/'.$controller->tpl_folder.'list_footer.tpl'))
$this->footer_tpl = $controller->tpl_folder.'list_footer.tpl';
$this->header_tpl = $this->context->smarty->createTemplate($this->header_tpl);
$this->content_tpl = $this->context->smarty->createTemplate($this->content_tpl);
$this->footer_tpl = $this->context->smarty->createTemplate($this->footer_tpl);
}
/**
* @var bool
* Usage : Set the value to false if you want to simply display the back button
@@ -140,17 +162,14 @@ class HelperListCore extends Helper
$this->fieldsDisplay = $fields_display;
/* Display list header (filtering, pagination and column names) */
$list_display = $this->displayListHeader();
if (!count($this->_list))
$list_display .= '<tr><td class="center" colspan="'.(count($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>';
$tpl_vars['header'] = $this->displayListHeader();
/* Show the content of the table */
$list_display .= $this->displayListContent();
$tpl_vars['content'] = $this->displayListContent();
/* Close list table and submit button */
$list_display .= $this->displayListFooter();
$tpl_vars['footer'] = $this->displayListFooter();
return $list_display;
$this->tpl->assign($tpl_vars);
return parent::generate();
}
/**
@@ -176,8 +195,6 @@ class HelperListCore extends Helper
public function displayListContent($token = null)
{
if (!$this->_list)
return;
if ($this->is_dnd_identifier)
$id_category = (int)Tools::getValue('id_'.($this->is_cms ? 'cms_' : '').'category', '1');
@@ -305,13 +322,20 @@ class HelperListCore extends Helper
}
}
$this->context->smarty->assign(array(
$this->content_tpl->assign(array(
'shop_link_type' => $this->shopLinkType,
'name' => isset($name) ? $name : null,
'is_dnd_identifier' => $this->is_dnd_identifier,
'identifier' => $this->identifier,
'table' => $this->table,
'token' => $this->token,
'color_on_bg' => $this->colorOnBackground,
'id_category' => $id_category,
'bulk_actions' => $this->bulk_actions,
'key_to_get' => $key_to_get,
'positions' => isset($positions) ? $positions : null,
'order_by' => $this->orderBy,
'order_way' => $this->orderWay,
'is_cms' => $this->is_cms,
'fields_display' => $this->fieldsDisplay,
'list' => $this->_list,
@@ -324,7 +348,7 @@ class HelperListCore extends Helper
'has_bulk_actions' => (bool)count($this->bulk_actions),
'list_skip_actions' => $this->list_skip_actions,
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->content_tpl);
return $this->content_tpl->fetch();
}
/**
@@ -332,6 +356,7 @@ class HelperListCore extends Helper
*/
protected function displayDuplicateLink($token = null, $id)
{
$tpl = $this->context->smarty->createTemplate('helper/list/list_action_duplicate.tpl');
if (!array_key_exists('Duplicate', self::$cache_lang))
self::$cache_lang['Duplicate'] = $this->l('Duplicate');
@@ -340,7 +365,7 @@ class HelperListCore extends Helper
$duplicate = $this->currentIndex.'&'.$this->identifier.'='.$id.'&duplicate'.$this->table;
$this->context->smarty->assign(array(
$tpl->assign(array(
'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&view'.$this->table.'&token='.($token != null ? $token : $this->token),
'action' => self::$cache_lang['Duplicate'],
'confirm' => self::$cache_lang['Copy images too?'],
@@ -348,7 +373,7 @@ class HelperListCore extends Helper
'location_ko' => $duplicate.'&noimage=1&token='.($token ? $token : $this->token).'\\',
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/helper/list/list_action_duplicate.tpl');
return $tpl->fetch();
}
@@ -373,15 +398,16 @@ class HelperListCore extends Helper
*/
protected function displayDetailsLink($token = null, $id)
{
$tpl = $this->context->smarty->createTemplate('helper/list/list_action_details.tpl');
if (!array_key_exists('Details', self::$cache_lang))
self::$cache_lang['Details'] = $this->l('Details');
$this->context->smarty->assign(array(
$tpl->assign(array(
'id' => $id,
'controller' => str_replace('Controller', '', get_class($this->context->controller)),
'token' => $this->token,
'action' => self::$cache_lang['Details'],
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/helper/list/list_action_details.tpl');
return $tpl->fetch();
}
/**
@@ -389,15 +415,16 @@ class HelperListCore extends Helper
*/
protected function displayViewLink($token = null, $id)
{
$tpl = $this->context->smarty->createTemplate('helper/list/list_action_view.tpl');
if (!array_key_exists('View', self::$cache_lang))
self::$cache_lang['View'] = $this->l('View');
$this->context->smarty->assign(array(
$tpl->assign(array(
'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&view'.$this->table.'&token='.($token != null ? $token : $this->token),
'action' => self::$cache_lang['View'],
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/helper/list/list_action_view.tpl');
return $tpl->fetch();
}
@@ -406,21 +433,17 @@ class HelperListCore extends Helper
*/
protected function displayEditLink($token = null, $id)
{
$tpl = $this->context->smarty->createTemplate('helper/list/list_action_edit.tpl');
if (!array_key_exists('Edit', self::$cache_lang))
self::$cache_lang['Edit'] = $this->l('Edit');
$this->context->smarty->assign(array(
$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
));
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_action_edit.tpl'))
$tpl = $this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_action_edit.tpl';
else
$tpl = $this->context->smarty->template_dir[0].'/helper/list/list_action_edit.tpl';
return $this->context->smarty->fetch($tpl);
return $tpl->fetch();
}
@@ -429,19 +452,21 @@ class HelperListCore extends Helper
*/
protected function displayDeleteLink($token = null, $id)
{
$tpl = $this->context->smarty->createTemplate('helper/list/list_action_delete.tpl');
if (!array_key_exists('Delete', self::$cache_lang))
self::$cache_lang['Delete'] = $this->l('Delete');
if (!array_key_exists('DeleteItem', self::$cache_lang))
self::$cache_lang['DeleteItem'] = $this->l('Delete item #', __CLASS__, true, false);
$this->context->smarty->assign(array(
$tpl->assign(array(
'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token != null ? $token : $this->token),
'confirm' => (!is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : self::$cache_lang['DeleteItem'].$id.' ? '),
'action' => self::$cache_lang['Delete'],
));
return $this->context->smarty->fetch('helper/list/list_action_delete.tpl');
return $tpl->fetch();
}
/**
@@ -543,7 +568,7 @@ class HelperListCore extends Helper
$this->fieldsDisplay[$key] = $params;
}
$this->context->smarty->assign(array(
$this->header_tpl->assign(array(
'table' => $this->table,
'currentIndex' => $this->currentIndex,
'action' => $action,
@@ -570,12 +595,12 @@ class HelperListCore extends Helper
'table_dnd' => isset($table_dnd) ? $table_dnd : null,
'name' => isset($name) ? $name : null,
'name_id' => isset($name_id) ? $name_id : null,
'toolbar' => $this->toolbar,
'show_toolbar' => $this->show_toolbar,
'back' => Tools::getValue('back'),
'no_back' => $this->no_back
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->header_tpl);
return $this->header_tpl->fetch();
}
/**
@@ -583,12 +608,14 @@ class HelperListCore extends Helper
*/
public function displayListFooter($token = null)
{
$this->context->smarty->assign(array(
$this->footer_tpl->assign(array(
'token' => $this->token,
'table' => $this->table,
'simple_header' => $this->simple_header,
'bulk_actions' => $this->bulk_actions,
'no_back' => $this->no_back
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->footer_tpl);
return $this->footer_tpl->fetch();
}
}
+2 -2
View File
@@ -145,7 +145,7 @@ class HelperOptionsCore extends Helper
$option_list[$category] = $category_data;
}
$this->context->smarty->assign(array(
$this->tpl->assign(array(
'current' => $this->currentIndex,
'table' => $this->table,
'token' => $this->token,
@@ -154,7 +154,7 @@ class HelperOptionsCore extends Helper
'required_fields' => isset($required_fields) ? $required_fields : false,
'languages' => isset($languages) ? $languages : null,
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->tpl);
return $this->tpl->fetch();
}
/**
@@ -140,15 +140,13 @@ class AdminAttributesGroupsControllerCore extends AdminController
$helper->token = $this->token;
$helper->table = $this->table;
$helper->simple_header = true;
$helper->show_toolbar = false;
$helper->bulk_actions = $this->bulk_actions;
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_content.tpl'))
$helper->content_tpl = $this->tpl_folder.'list_content.tpl';
$content = $helper->generateList($this->_list, $this->fieldsDisplay);
echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
$this->content = Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
}
die;
}
/**
@@ -356,13 +354,13 @@ class AdminAttributesGroupsControllerCore extends AdminController
$str_attributes_groups .= '"'.$attribute_group['id_attribute_group'].'" : '.($attribute_group['group_type'] == 'color' ? '1' : '0' ) .', ';
$image = _PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.$obj->id.'.jpg';
$this->context->smarty->assign(array(
$this->tpl_form_vars = array(
'strAttributesGroups' => $str_attributes_groups,
'colorAttributeProperties' => Validate::isLoadedObject($obj) && $obj->isColorAttribute(),
'imageTextureExists' => file_exists($image),
'imageTexture' => $image,
'imageTextureUrl' => Tools::safeOutput($_SERVER['REQUEST_URI']).'&deleteImage=1'
));
);
return parent::initForm();
}
@@ -542,4 +540,4 @@ class AdminAttributesGroupsControllerCore extends AdminController
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
}
}
}
@@ -98,7 +98,7 @@ class AdminCategoriesControllerCore extends AdminController
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->_filter .= 'AND `id_parent` = '.(int)$this->_category->id.' ';
$this->_filter .= ' AND `id_parent` = '.(int)$this->_category->id.' ';
$this->_select = 'position ';
$categories_tree = $this->_category->getParentsCategories($this->context->language->id);
@@ -129,21 +129,28 @@ class AdminCategoriesControllerCore extends AdminController
public function initToolbar()
{
$this->toolbar_title = stripslashes($this->_category->getName());
if (empty($this->display))
$this->toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&amp;add'.$this->table.'&amp;token='.$this->token,
'desc' => $this->l('Add new')
);
if (Tools::getValue('id_category'))
$this->toolbar_btn['edit'] = array(
'href' => self::$currentIndex.'&amp;update'.$this->table.'&amp;id_category='.Tools::getValue('id_category').'&amp;token='.$this->token,
'desc' => $this->l('Edit')
);
if ($this->display == 'view')
$this->toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&amp;add'.$this->table.'&amp;id_parent='.Tools::getValue('id_category').'&amp;token='.$this->token,
'desc' => $this->l('Add new')
);
parent::initToolbar();
}
public function initForm()
{
$this->initToolbar();
$obj = $this->loadObject(true);
$selected_cat = array(isset($obj->id_parent) ? $obj->id_parent : Tools::getValue('id_parent', 1));
if (sizeof($selected_cat) > 0)
@@ -207,7 +214,8 @@ class AdminCategoriesControllerCore extends AdminController
'selected_cat' => $selected_cat,
'input_name' => 'id_parent',
'use_radio' => true,
'use_search' => false
'use_search' => false,
'disabled_categories' => array(4),
)
),
array(
@@ -85,14 +85,10 @@ class AdminManufacturersControllerCore extends AdminController
parent::__construct();
}
public function setHelperListDisplay(Helper $helper)
{
$helper->toolbar = false;
parent::setHelperListDisplay($helper);
}
public function initList()
public function initListManufacturer()
{
$this->toolbar_title = $this->l('List of manufacturers:');
$this->addRowAction('view');
$this->addRowAction('edit');
$this->addRowAction('delete');
@@ -110,8 +106,14 @@ class AdminManufacturersControllerCore extends AdminController
$this->context->smarty->assign('title_list', $this->l('List of manufacturers:'));
$this->initToolbar();
$list_manufacturers = parent::initList();
$this->content .= parent::initList();
}
public function initListManufacturerAddresses()
{
$this->toolbar_title = $this->l('Manufacturers addresses:');
// reset actions and query vars
$this->actions = array();
unset($this->fieldsDisplay, $this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter);
@@ -191,14 +193,17 @@ class AdminManufacturersControllerCore extends AdminController
$this->postProcess();
$this->initToolbar();
$list_addresses = parent::initList();
$this->content .= parent::initList();
$this->context->smarty->assign(array(
'list_manufacturers' => $list_manufacturers,
'list_addresses' => $list_addresses
));
}
public function initList()
{
$this->initListManufacturer();
$this->initListManufacturerAddresses();
}
/**
* Display editaddresses action link
* @param string $token the token to add to the link
@@ -217,7 +222,7 @@ class AdminManufacturersControllerCore extends AdminController
'action' => self::$cache_lang['editaddresses'],
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/manufacturers/list_action_edit_adresses.tpl');
return $this->context->smarty->fetch('manufacturers/list_action_edit_adresses.tpl');
}
public function initForm()
@@ -526,7 +531,7 @@ class AdminManufacturersControllerCore extends AdminController
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
$helper->fields_value = $this->getFieldsValue($address);
$helper->toolbar_btn = $this->toolbar_btn;
$helper->tpl = 'manufacturers/form_addresses.tpl';
// $helper->tpl = 'manufacturers/form_addresses.tpl';
$this->content .= $helper->generateForm($this->fields_form);
}
@@ -587,7 +587,6 @@ class AdminProductsController extends AdminController
Tools::getValue('attribute_weight') * Tools::getValue('attribute_weight_impact'),
Tools::getValue('attribute_unity') * Tools::getValue('attribute_unit_impact'),
Tools::getValue('attribute_ecotax'),
Tools::getValue('attribute_quantity'),
Tools::getValue('id_image_attr'),
Tools::getValue('attribute_reference'),
Tools::getValue('attribute_supplier_reference'),
@@ -3315,7 +3314,14 @@ $product->supplier_name = Supplier::getNameById($product->id_supplier);
return Tools::jsonEncode(array('error' => 'Undefined value'));
if (Tools::getValue('id_product_attribute') === false)
return Tools::jsonEncode(array('error' => 'Undefined id product attribute'));
// @todo : Product class should handle that
$stock_available = new StockAvailable(StockAvailable::getIdStockAvailable($product->id, (int)Tools::getValue('id_product_attribute')));
if (!$stock_available->id)
{
$stock_available->id_product = $product->id;
$stock_available->id_shop = Context::getContext()->shop->getID(true);
$stock_available->id_product_attribute = Tools::getValue('id_product_attribute');
}
$stock_available->quantity = (int)Tools::getValue('value');
$stock_available->save();
break;
+240 -72
View File
@@ -31,15 +31,43 @@ class AdminTrackingController extends AdminController
{
parent::__construct();
}
public function display()
public function postprocess()
{
$tpl_vars['categories'] = $this->getObjects('categories_empty')->displayCategories();
$tpl_vars['products_disabled'] = $this->getObjects('products_disabled')->displayProducts();
$tpl_vars['products_nostock'] = $this->getObjects('products_nostock')->displayProducts();
$tpl_vars['attributes_nostock'] = $this->getObjects('attributes_nostock')->displayAttributes();
if (Tools::getValue('id_product') && Tools::isSubmit('statusproduct'))
{
$this->table = 'product';
$this->identifier = 'id_product';
$this->action = 'status';
$this->className = 'Product';
}
else
if (Tools::getValue('id_category') && Tools::isSubmit('statuscategory'))
{
$this->table = 'category';
$this->identifier = 'id_category';
$this->action = 'status';
$this->className = 'Category';
}
parent::postprocess();
}
public function initContent()
{
//$tpl_vars['categories'] = $this->getObjects('categories_empty')->displayCategories();
$methods = get_class_methods($this);
$tpl_vars['arrayList'] = array();
foreach ($methods as $method_name)
if (preg_match('#getCustomList(.+)#', $method_name, $matches))
$tpl_vars['arrayList'][Tools::toUnderscoreCase($matches[1])] = call_user_func(array($this,$matches[0]));
// $tpl_vars['categories'] = $this->getMonitorCategoriesEmpty();
// $tpl_vars['products_disabled'] = $this->getObjects('products_disabled')->displayProducts();
// $tpl_vars['products_nostock'] = $this->getObjects('products_nostock')->displayProducts();
// attributes no stock is custom
// $tpl_vars['arrayList']['attributes_nostock'] = $this->getObjects('attributes_nostock')->displayAttributes();
$this->context->smarty->assign($tpl_vars);
parent::display();
$this->display = 'view';
parent::initContent();
}
public function getObjects($type)
@@ -55,7 +83,7 @@ class AdminTrackingController extends AdminController
FROM `'._DB_PREFIX_.'category_product`
)
';
$this->_list['message'] = $this->l('List of empty categories:');
// $this->_list['message'] = $this->l('List of empty categories:');
break ;
case 'products_disabled':
$sql = '
@@ -103,33 +131,70 @@ class AdminTrackingController extends AdminController
return $this;
}
public function getCustomListCategoriesEmpty()
{
$this->clearListOptions();
$this->table = 'category';
$this->lang = true;
$this->identifier = 'id_category';
$this->_defaultOrderBy = 'id_category';
$this->_defaultOrderWay = 'DESC';
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->addRowAction('view');
$this->_filter = ' AND
a.id_category NOT IN (
SELECT DISTINCT(cp.id_category)
FROM `'._DB_PREFIX_.'category_product` cp)';
$this->fieldsDisplay = (array(
'id_category' => array('title' => $this->l('ID')),
'name' => array('title' => $this->l('Name')),
'description' => array('title' => $this->l('Description')),
'active' => array('title' => $this->l('Status'), 'type' => 'bool', 'active' => 'status'),
'action' => array('title' => $this->l('Actions'))
));
$this->getObjects('categories_empty');
$this->list_simple_header = 0;
$this->show_toolbar = 0;
$this->list_title = $this->l('List of empty categories:');
$list = $this->initList();
$this->_filter = '';
return $list;
}
public function displayCategories()
{
$content = '';
if (isset($this->_list['obj']))
{
$nbCategories = sizeof($this->_list['obj']);
$this->content .= '<h3>'.$this->_list['message'].' '.$nbCategories.' '.$this->l('found').'</h3>';
$content .= '<h3>'.$this->_list['message'].' '.$nbCategories.' '.$this->l('found').'</h3>';
if (!$nbCategories)
return ;
$this->content .= '
return $content;
$content .= '
<table cellspacing="0" cellpadding="0" class="table">';
$irow = 0;
foreach ($this->_list['obj'] AS $k => $category)
$this->content .= '<tr class="'.($irow++ % 2 ? 'alt_row' : '').'"><td>'.rtrim(getPath('index.php?tab=AdminCatalog', $category['id_category']), ' >').'</td></tr>';
$this->content .= '</table><br /><br />';
$content .= '<tr class="'.($irow++ % 2 ? 'alt_row' : '').'"><td>'.rtrim(getPath('index.php?controller=AdminCategory', $category['id_category']), ' >').'</td></tr>';
$content .= '</table><br /><br />';
}
return $content;
}
public function displayProducts()
public function getCustomListProductsAttributesNoStock()
{
if (isset($this->_list['obj']))
{
$nbProducts = sizeof($this->_list['obj']);
$this->content .= '<h3>'.$this->_list['message'].' '.$nbProducts.' '.$this->l('found').'</h3>';
if (!$nbProducts)
return ;
$this->fieldsDisplay = (array(
{
$this->clearListOptions();
$this->table = 'product';
$this->lang = true;
$this->identifier = 'id_product';
$this->_defaultOrderBy = 'id_product';
$this->_defaultOrderWay = 'DESC';
$this->fieldsDisplay = array(
'ID' => array('title' => $this->l('ID')),
'manufacturer' => array('title' => $this->l('Manufacturer')),
'reference' => array('title' => $this->l('Reference')),
@@ -138,55 +203,40 @@ class AdminTrackingController extends AdminController
'tax' => array('title' => $this->l('Tax')),
'stock' => array('title' => $this->l('Stock')),
'weight' => array('title' => $this->l('Weight')),
'status' => array('title' => $this->l('Status')),
'action' => array('title' => $this->l('Actions'))
'active' => array('title' => $this->l('Status'), 'type' => 'bool', 'active' => 'status'),
'action' => array('title' => $this->l('Actions')
));
$this->content .= '
<table class="table" cellpadding="0" cellspacing="0">
<tr>';
foreach ($this->fieldsDisplay AS $field)
$this->content .= '<th'.(isset($field['width']) ? 'style="width: '.$field['width'].'"' : '').'>'.$field['title'].'</th>';
$this->content .= '
</tr>';
foreach ($this->_list['obj'] AS $k => $prod)
{
$product = new Product((int)$prod['id_product'], false);
$product->name = $product->name[(int)$this->context->language->id];
$taxrate = $product->getTaxesRate();
$this->_join = '';
$this->_filter = 'AND a.id_product IN (
SELECT id_product
FROM `'._DB_PREFIX_.'product`
WHERE id_product IN (
SELECT DISTINCT(id_product)
FROM `'._DB_PREFIX_.'product_attribute`
)
AND quantity <= 0)';
$this->list_title = $this->l('Product out of stock with attributes');
$this->list_simple_header = 1;
$this->content .= '
<tr>
<td>'.$product->id.'</td>
<td align="center">'.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').'</td>
<td>'.$product->reference.'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">'.stripslashes($product->name).'</a></td>
<td>'.Tools::displayPrice($product->getPrice(), $this->context->currency).'</td>
<td>'.(float)$taxrate.'% </td>
<td align="center">'.$product->quantity.'</td>
<td align="center">'.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'"><img src="../img/admin/'.($product->active ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td>
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>&nbsp;
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.str_replace('"', ' ', $product->name)).' ?\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
</td>
</tr>';
}
$this->content .= '</table><br /><br />';
}
$list = $this->initList();
$this->_filter = '';
return $list;
}
public function displayAttributes()
{
$this->clearListOptions();
$content = '';
$this->table = 'attribute';
$this->lang = true;
$this->identifier = 'id_attribute';
$this->_defaultOrderBy = 'id_attribute';
$this->_defaultOrderWay = 'DESC';
if (isset($this->_list['obj']))
{
$nbAttributes = sizeof($this->_list['obj']);
$this->content .= '<h3>'.$this->_list['message'].' '.$nbAttributes.' '.$this->l('found').'</h3>';
$content .= '<h3>'.$this->_list['message'].' '.$nbAttributes.' '.$this->l('found').'</h3>';
if (!$nbAttributes)
return ;
$this->fieldsDisplay = (array(
return $content;
$this->fieldsDisplay = array(
'ID' => array('title' => $this->l('ID')),
'manufacturer' => array('title' => $this->l('Manufacturer')),
'reference' => array('title' => $this->l('Reference')),
@@ -197,14 +247,14 @@ class AdminTrackingController extends AdminController
'weight' => array('title' => $this->l('Weight')),
'status' => array('title' => $this->l('Status')),
'action' => array('title' => $this->l('Actions'))
));
);
$this->content .= '
$content .= '
<table class="table" cellpadding="0" cellspacing="0">
<tr>';
foreach ($this->fieldsDisplay AS $field)
$this->content .= '<th'.(isset($field['width']) ? 'style="width: '.$field['width'].'"' : '').'>'.$field['title'].'</th>';
$this->content .= '
$content .= '<th'.(isset($field['width']) ? 'style="width: '.$field['width'].'"' : '').'>'.$field['title'].'</th>';
$content .= '
</tr>';
$attributes = array();
@@ -226,27 +276,145 @@ class AdminTrackingController extends AdminController
$product = new Product((int)$prod['id_product'], false);
$tax_rate = $product->getTaxesRate();
$this->content .= '
$content .= '
<tr>
<td>'.$prod['id_product'].'</td>
<td align="center">'.($prod['manufacturer_name'] != NULL ? stripslashes($prod['manufacturer_name']) : '--').'</td>
<td>'.$prod['reference'].'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">'.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.'</a></td>
<td><a href="'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$prod['id_product'].'&addproduct">'.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.'</a></td>
<td>'.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $this->context->currency).'</td>
<td>'.(float)$tax_rate.'% </td>
<td align="center">'.$prod['quantity'].'</td>
<td align="center">'.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'"><img src="../img/admin/'.($prod['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td align="center"><a href="'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$prod['id_product'].'&amp;status"><img src="../img/admin/'.($prod['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td>
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">
<a href="'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$prod['id_product'].'&amp;addproduct">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>&nbsp;
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.$prod['name']).' ?\');">
<a href="'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$prod['id_product'].'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.$prod['name']).' ?\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
</td>
</tr>';
}
$this->content .= '</table><br /><br />';
$content .= '</table><br /><br />';
}
return $content;
}
public function getCustomListProductsNoStock()
{
$this->clearListOptions();
$this->table = 'product';
$this->lang = true;
$this->identifier = 'id_product';
$this->_defaultOrderBy = 'id_product';
$this->_defaultOrderWay = 'DESC';
$this->fieldsDisplay = array(
'ID' => array('title' => $this->l('ID')),
'manufacturer' => array('title' => $this->l('Manufacturer')),
'reference' => array('title' => $this->l('Reference')),
'name' => array('title' => $this->l('Name')),
'price' => array('title' => $this->l('Price')),
'tax' => array('title' => $this->l('Tax')),
'stock' => array('title' => $this->l('Stock')),
'weight' => array('title' => $this->l('Weight')),
'active' => array('title' => $this->l('Status'), 'type' => 'bool', 'active' => 'status'),
'action' => array('title' => $this->l('Actions')
));
$this->_join = '';
$this->_filter = 'AND a.id_product IN (
SELECT id_product
FROM `'._DB_PREFIX_.'product`
WHERE id_product NOT IN (
SELECT DISTINCT(id_product)
FROM `'._DB_PREFIX_.'product_attribute`
)
AND quantity <= 0)';
$this->list_title = $this->l('Product out of stock');
$this->list_simple_header = 1;
$list = $this->initList();
$this->_filter = '';
return $list;
}
public function getCustomListProductsDisabled()
{
$this->clearListOptions();
$content = '';
$this->table = 'product';
$this->lang = true;
$this->identifier = 'id_product';
$this->_defaultOrderBy = 'id_product';
$this->_defaultOrderWay = 'DESC';
$this->_filter = 'AND active = 0';
$this->list_no_filter = true;
$this->list_title = $this->l('Product disabled');
$list = $this->initList();
$this->_filter = '';
return $list;
if (isset($this->_list['obj']))
{
$nbProducts = sizeof($this->_list['obj']);
$content .= '<h3>'.$this->_list['message'].' '.$nbProducts.' '.$this->l('found').'</h3>';
if (!$nbProducts)
return ;
$this->fieldsDisplay = (array(
'ID' => array('title' => $this->l('ID')),
'manufacturer' => array('title' => $this->l('Manufacturer')),
'reference' => array('title' => $this->l('Reference')),
'name' => array('title' => $this->l('Name')),
'price' => array('title' => $this->l('Price')),
'tax' => array('title' => $this->l('Tax')),
'stock' => array('title' => $this->l('Stock')),
'weight' => array('title' => $this->l('Weight')),
'status' => array('title' => $this->l('Status')),
'action' => array('title' => $this->l('Actions'))
));
$content .= '
<table class="table" cellpadding="0" cellspacing="0">
<tr>';
foreach ($this->fieldsDisplay AS $field)
$content .= '<th'.(isset($field['width']) ? 'style="width: '.$field['width'].'"' : '').'>'.$field['title'].'</th>';
$content .= '
</tr>';
foreach ($this->_list['obj'] AS $k => $prod)
{
$product = new Product((int)$prod['id_product'], false);
$product->name = $product->name[(int)$this->context->language->id];
$taxrate = $product->getTaxesRate();
$content .= '
<tr>
<td>'.$product->id.'</td>
<td align="center">'.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').'</td>
<td>'.$product->reference.'</td>
<td><a href="'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id.'&addproduct">'.stripslashes($product->name).'</a></td>
<td>'.Tools::displayPrice($product->getPrice(), $this->context->currency).'</td>
<td>'.(float)$taxrate.'% </td>
<td align="center">'.$product->quantity.'</td>
<td align="center">'.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
<td align="center"><a href="'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id.'&amp;status"><img src="../img/admin/'.($product->active ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td>
<a href="'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id.'&addproduct">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>&nbsp;
<a href="'.$this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.$product->id.'&deleteproduct" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.str_replace('"', ' ', $product->name)).' ?\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
</td>
</tr>';
}
$content .= '</table><br /><br />';
}
return $content;
}
public function clearListOptions(){
$this->table = '';
$this->lang = false;
$this->identifier = '';
$this->_defaultOrderBy = '';
$this->_defaultOrderWay = '';
$this->_filter = '';
$this->list_no_filter = true;
$this->list_title = $this->l('Product disabled');
}
}