diff --git a/admin-dev/themes/template/attributes/form.tpl b/admin-dev/themes/template/attributes/form.tpl index fc56b9135..5ab708bbe 100644 --- a/admin-dev/themes/template/attributes/form.tpl +++ b/admin-dev/themes/template/attributes/form.tpl @@ -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} - - -{/if} - -{if isset($toolbar) && $toolbar} - {include file="toolbar.tpl"} -{/if} - -{if isset($fields.title)}

{$fields.title}

{/if} -
- {if $form_id} - - {/if} -
- {foreach $fields as $key => $field} - {if $key == 'legend'} - - {if isset($field.image)}{$field.title}{/if} - {$field.title} - - {elseif $key == 'input'} - {foreach $field as $input} - {if $input.name == 'id_state'} -
- {/if} - {if $input.type == 'color'} -
- {/if} - {block name="label"} - {if isset($input.label)} - - {/if} - {/block} - {if $input.type == 'hidden'} - - {else} - {block name="start_field_block"} -
- {/block} - {if $input.type == 'text' && $input.name == 'texture'} -

- {if $imageTextureExists} - - {l s='Delete'} - {else} - {l s='None'} - {/if} -

- {elseif $input.type == 'text'} - {if isset($input.lang) && isset($input.attributeLang)} - {foreach $languages as $language} -
- - {if isset($input.hint)}{$input.hint} {/if} -
- {/foreach} - {if count($languages) > 1} -
- -
-
- {l s='Choose language:'}

- {foreach $languages as $language} - {$language.name} - {/foreach} -
- {/if} - {else} - - {if isset($input.suffix)}{$input.suffix}{/if} - {if isset($input.hint)}{$input.hint} {/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} - - {if isset($input.hint)}{$input.hint} {/if} - {/if} - {elseif $input.type == 'radio'} - {foreach $input.values as $value} - - - {if isset($input.br) && $input.br}
{/if} - {/foreach} - {elseif $input.type == 'textarea'} - {if isset($input.lang) && isset($input.attributeLang)} - {foreach $languages as $language} -
- -
- {/foreach} - {if count($languages) > 1} -
- -
-
- {l s='Choose language:'}

- {foreach $languages as $language} - {$language.name} - {/foreach} -
- {/if} - {else} - - {/if} - {elseif $input.type == 'checkbox'} - {foreach $input.values.query as $value} - {assign var=id_checkbox value=$input.name|cat:'_'|cat:$value[$input.values.id]} - -
- {/foreach} - {elseif $input.type == 'file'} - {if isset($input.display_image) && $input.display_image} - {if isset($fields_value.image) && $fields_value.image} -
- {$fields_value.image} -

{l s='File size'} {$fields_value.size}kb

- - {l s='Delete'} {l s='Delete'} - -

- {/if} - {/if} - - {elseif $input.type == 'password'} - - {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} - -
- {$asso_shop} -
- {elseif $input.type == 'color'} - - - {elseif $input.type == 'date'} - - - {/if} - {if isset($input.required) && $input.required} *{/if} - {if isset($input.p)} -

- {if is_array($input.p)} - {foreach $input.p as $p} - {if is_array($p)} - {$p.text}
- {else} - {$p}
- {/if} - {/foreach} - {else} - {$input.p} - {/if} -

- {/if} - {if isset($languages)}
{/if} - {block name="end_field_block"}
{/block} - {/if} - {if $input.name == 'id_state'} -
- {/if} - {if $input.type == 'text' && $input.name == 'texture'} -
- {/if} - {/foreach} - {elseif $key == 'submit'} -
- -
- {/if} - {/foreach} - {if $required_fields} -
* {l s ='Required field'}
- {/if} - {if isset($fields.tinymce) && $fields.tinymce} - - - - {/if} -
-
- -

-{if $firstCall && !$no_back} - {if $back} - {l s='Back'} - {else} - {l s='Back to list'} - {/if} -
-{/if} +{/block} diff --git a/admin-dev/themes/template/attributes/list_content.tpl b/admin-dev/themes/template/attributes/list_content.tpl deleted file mode 100644 index 80bc7fd8f..000000000 --- a/admin-dev/themes/template/attributes/list_content.tpl +++ /dev/null @@ -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 -* @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 -*} - -{foreach $list AS $index => $tr} - - - {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} - - {/if} - {/if} - - {foreach $fields_display AS $key => $params} - {if isset($params.prefix)}{$params.prefix}{/if} - {else} - > - {/if} - {if isset($params.active)} - {$tr.$key} - {elseif isset($params.activeVisu)} - {if $tr.$key}{l s='Enabled'}{else}{l s='Disabled'}{/if} - {elseif isset($params.position)} - {if $order_by == 'position' && $order_way != 'DESC'} - - {l s='Down'} - - - - {l s='Up'} - - {else} - {$tr.$key.position + 1} - {/if} - {elseif isset($params.image)} - {$tr.$key} - {elseif (isset($params.icon))} - {$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'} -
- {elseif isset($tr.$key)} - {$tr.$key|escape:'htmlall':'UTF-8'} - {else} - -- - {/if} - {if isset($params.suffix)}{$params.suffix}{/if} - - {/foreach} - - {if $shop_link_type} - {if isset($tr.shop_short_name)}{$tr.shop_short_name}{else}{$tr.shop_name}{/if} - {/if} - {if $has_actions} - - {foreach $actions AS $action} - {if isset($tr.$action)} - {$tr.$action} - {/if} - {/foreach} - - {/if} - -{/foreach} - \ No newline at end of file diff --git a/admin-dev/themes/template/categories/list_header.tpl b/admin-dev/themes/template/categories/list_header.tpl deleted file mode 100644 index 2c34be918..000000000 --- a/admin-dev/themes/template/categories/list_header.tpl +++ /dev/null @@ -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 -* @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} - - - - {* Display column names and arrows for ordering (ASC, DESC) *} - {if $is_order_position} - - - - {/if} - - - -
- {l s='Current Category:'} - {if count($categories_tree) == 0} -   {l s='Home'} - {else} - -   {l s='Home'} >  - - {foreach $categories_tree key=key item=category} - - {if $key != 0} - {l s='edit'} {$category.name} >  - - {else} - {$category.name} - {/if} - {/foreach} - {/if} -
- - - -
- -
-

{l s='Categories'} {$categories_name}

- {if $list_total == 0} - {l s='There are no subcategories in '} "{$categories_name}" - {else} - {$list_total}  - {if $list_total < 1} - {l s='subcategories'} - {else} - {l s='subcategory'} {l s='in category'} "{$categories_name}" - {/if} - {/if} -
-
-   - -
-{/if}{* End if simple_header *} - - - {if !$simple_header} - - - - {/if} - - -
- - {if $page > 1} -   - - {/if} - {l s='Page '}{$page} / {$total_pages} - {if $page < $total_pages} -   - - {/if} - | {l s='Display'} - - / {$list_total} {l s='result(s)'} - - - - - - -
- - - - {foreach $fields_display AS $key => $params} - - {/foreach} - - {if $shop_link_type} - - {/if} - {if $has_actions} - - {/if} - - {if !$simple_header} - - - - {* Filters (input, select, date or bool) *} - {foreach $fields_display AS $key => $params} - - {/foreach} - - {if $shop_link_type} - - {/if} - {if $has_actions} - - {/if} - - {/if} - diff --git a/admin-dev/themes/template/customers/form.tpl b/admin-dev/themes/template/customers/form.tpl index 003e8d409..1a86eafc9 100644 --- a/admin-dev/themes/template/customers/form.tpl +++ b/admin-dev/themes/template/customers/form.tpl @@ -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} {/if} -
- -
{* todo : what to display as title for each items (table_lang.name ? *} -

{$current_obj_name|default:' '}

-
-
+ +{if $show_toolbar} + {include file="toolbar.tpl" toolbar_btn=$toolbar_btn} +{/if} {if isset($fields.title)}

{$fields.title}

{/if} {if $form_id} - + {/if}
{foreach $fields as $key => $field} @@ -85,46 +85,34 @@ {if $input.name == 'id_state'}
{/if} + {block name="label"} {if isset($input.label)} - + {/if} + {/block} {if $input.type == 'hidden'} {else} -
+ {block name="start_field_block"} +
+ {/block} {if $input.type == 'text'} - {if isset($input.lang) && isset($input.attributeLang)} - {foreach $languages as $language} -
- - {if isset($input.hint)}{$input.hint} {/if} -
- {/foreach} - {if count($languages) > 1} -
- -
-
- {l s='Choose language:'}

- {foreach $languages as $language} - {$language.name} - {/foreach} -
- {/if} + {if isset($input.lang)} +
+ {foreach $languages as $language} +
+ + {if isset($input.hint)}{$input.hint} {/if} +
+ {/foreach} +
{else} + {if isset($input.suffix)}{$input.suffix}{/if} {if isset($input.hint)}{$input.hint} {/if} {/if} {elseif $input.type == 'select'} @@ -143,7 +132,11 @@ {$input.required = false} {$input.p = null} {else} - {if isset($input.options.default)} {/if} @@ -168,7 +161,6 @@
+ {elseif $input.type == 'color'} + + + {elseif $input.type == 'date'} + + {/if} {if isset($input.required) && $input.required} *{/if} {if isset($input.p)} @@ -285,7 +289,7 @@

{/if} {if isset($languages)}
{/if} -
+ {block name="end_field_block"}
{/block} {/if} {if $input.name == 'id_state'} @@ -293,13 +297,25 @@ {/foreach} {elseif $key == 'submit'}
- +
{/if} {/foreach} {if $required_fields}
* {l s ='Required field'}
{/if} + {if isset($fields.tinymce) && $fields.tinymce} + + + + {/if}
diff --git a/admin-dev/themes/template/footer.tpl b/admin-dev/themes/template/footer.tpl index 1cb46ffae..0405396c0 100644 --- a/admin-dev/themes/template/footer.tpl +++ b/admin-dev/themes/template/footer.tpl @@ -45,6 +45,13 @@ + {* ajaxBox allows*} + + {/if} diff --git a/admin-dev/themes/template/helper/form/form.tpl b/admin-dev/themes/template/helper/form/form.tpl index b28c53b63..40020db46 100644 --- a/admin-dev/themes/template/helper/form/form.tpl +++ b/admin-dev/themes/template/helper/form/form.tpl @@ -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}); - - + }); {block name="script"} {/block} + + {/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)}

{$fields.title}

{/if} {if $form_id} @@ -233,14 +232,28 @@ name="{$input.name}" size="{$input.size}" value="" /> + {elseif $input.type == 'birthday'} + {foreach $input.options as $key => $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}
diff --git a/admin-dev/themes/template/helper/form/form_category.tpl b/admin-dev/themes/template/helper/form/form_category.tpl index 14c5d1de3..d942bd050 100644 --- a/admin-dev/themes/template/helper/form/form_category.tpl +++ b/admin-dev/themes/template/helper/form/form_category.tpl @@ -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} - + {if $cat.id_category != 1} + {else} {assign var=home_is_selected value=true} {/if} {else} {if $cat != 1} - + {else} {assign var=home_is_selected value=true} {/if} @@ -88,4 +89,4 @@ -{/if} \ No newline at end of file +{/if} diff --git a/admin-dev/themes/template/manufacturers/content.tpl b/admin-dev/themes/template/helper/list/list.tpl similarity index 77% rename from admin-dev/themes/template/manufacturers/content.tpl rename to admin-dev/themes/template/helper/list/list.tpl index 2b4606810..0bc3deb73 100644 --- a/admin-dev/themes/template/manufacturers/content.tpl +++ b/admin-dev/themes/template/helper/list/list.tpl @@ -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"} -

{l s='List of manufacturers:'}

- {$list_manufacturers} -{/if} - -{if isset($list_addresses)} - {include file="toolbar.tpl"} -

{l s='Manufacturers addresses:'}

- {$list_addresses} -{/if} - +{$header} {$content} +{$footer} diff --git a/admin-dev/themes/template/helper/list/list_content.tpl b/admin-dev/themes/template/helper/list/list_content.tpl index 0a03de5bc..c567e931f 100644 --- a/admin-dev/themes/template/helper/list/list_content.tpl +++ b/admin-dev/themes/template/helper/list/list_content.tpl @@ -24,6 +24,7 @@ * International Registered Trademark & Property of PrestaShop SA *}
+{if count($list)} {foreach $list AS $index => $tr} {if isset($params.prefix)}{$params.prefix}{/if} @@ -50,7 +51,7 @@ > {/if} {if isset($params.active)} - {$tr.$key} + {$tr.$key} {elseif isset($params.activeVisu)} {if $tr.$key}{l s='Enabled'}{else}{l s='Disabled'}{/if} @@ -70,7 +71,7 @@ {$tr.$key} {elseif (isset($params.icon))} {$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'} +
{elseif isset($tr.$key)} {$tr.$key|escape:'htmlall':'UTF-8'} {else} @@ -90,17 +93,25 @@ {/foreach} {if $shop_link_type} - + {/if} {if $has_actions} {/if} {/foreach} - \ No newline at end of file +{else} + +{/if} + diff --git a/admin-dev/themes/template/helper/list/list_header.tpl b/admin-dev/themes/template/helper/list/list_header.tpl index af1452c9f..aa8c1a876 100644 --- a/admin-dev/themes/template/helper/list/list_header.tpl +++ b/admin-dev/themes/template/helper/list/list_header.tpl @@ -36,7 +36,7 @@ {* Display column names and arrows for ordering (ASC, DESC) *} {if $is_order_position} - + - - {if isset($toolbar) && $toolbar} - {include file="toolbar.tpl"} - {/if} - -   {/if}{* End if simple_header *} - + +{if $show_toolbar} +
+

{block name=pageTitle} + {$page_title|default:' '} + {/block}

+
+ {include file="toolbar.tpl" toolbar_btn=$toolbar_btn} +{/if} + +  + +
- {if $delete} - - {/if} - {$params.title} - {if (!isset($params.orderby) || $params.orderby) && !$simple_header} -
- - - - - - - {/if} -
- {if $shop_link_type == 'shop'} - {l s='shop'} - {else} - {l s='Group shop'} - {/if} - {l s='Actions'}
- {if $delete} - -- - {/if} - - {if isset($params.search) && !$params.search} - -- - {else} - {if $params.type == 'bool'} - - {elseif $params.type == 'date' || $params.type == 'datetime'} - {l s='From'}
- {l s='To'} - {elseif $params.type == 'select'} - {if isset($params.filter_key)} - - {/if} - {else} - - {/if} - {/if} -
----
{if isset($tr.shop_short_name)}{$tr.shop_short_name}{else}{$tr.shop_name}{/if} + {if isset($tr.shop_short_name)} + {$tr.shop_short_name} + {else} + {$tr.shop_name} + {/if} {foreach $actions AS $action} {if isset($tr.$action)} - {$tr.$action} - {/if} + {$tr.$action} + {/if} {/foreach}
{l s='No items found'}
{if !$simple_header} diff --git a/admin-dev/themes/template/manufacturers/form_addresses.tpl b/admin-dev/themes/template/manufacturers/form_addresses.tpl index ef93b8d8c..0cf6c8493 100644 --- a/admin-dev/themes/template/manufacturers/form_addresses.tpl +++ b/admin-dev/themes/template/manufacturers/form_addresses.tpl @@ -25,266 +25,14 @@ *} {if $firstCall} - - -{/if} -{if isset($fields.title)}

{$fields.title}

{/if} - - {if $form_id} - - {/if} -
- {foreach $fields as $key => $field} - {if $key == 'legend'} - - {if isset($field.image)}{$field.title}{/if} - {$field.title} - - {elseif $key == 'input'} - {foreach $field as $input} - {if $input.name == 'id_state'} -
- {/if} - {block name="label"} - {if isset($input.label)} - - {/if} - {/block} - {if $input.type == 'hidden'} - - {else} - {block name="start_field_block"} -
- {/block} - {if $input.type == 'text'} - {if isset($input.lang) && isset($input.attributeLang)} - {foreach $languages as $language} -
- - {if isset($input.hint)}{$input.hint} {/if} -
- {/foreach} - {if count($languages) > 1} -
- -
-
- {l s='Choose language:'}

- {foreach $languages as $language} - {$language.name} - {/foreach} -
- {/if} - {else} - - {if isset($input.suffix)}{$input.suffix}{/if} - {if isset($input.hint)}{$input.hint} {/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} - - {if isset($input.hint)}{$input.hint} {/if} - {/if} - {elseif $input.type == 'radio'} - {foreach $input.values as $value} - - - {if isset($input.br) && $input.br}
{/if} - {/foreach} - {elseif $input.type == 'textarea'} - {if isset($input.lang) && isset($input.attributeLang)} - {foreach $languages as $language} -
- -
- {/foreach} - {if count($languages) > 1} -
- -
-
- {l s='Choose language:'}

- {foreach $languages as $language} - {$language.name} - {/foreach} -
- {/if} - {else} - - {/if} - {elseif $input.type == 'checkbox'} - {foreach $input.values.query as $value} - {assign var=id_checkbox value=$input.name|cat:'_'|cat:$value[$input.values.id]} - -
- {/foreach} - {elseif $input.type == 'file'} - - - {elseif $input.type == 'password'} - - {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} - -
- {$asso_shop} -
- {/if} - {if isset($input.required) && $input.required} *{/if} - {if isset($input.p)} -

- {if is_array($input.p)} - {foreach $input.p as $p} - {if is_array($p)} - {$p.text}
- {else} - {$p}
- {/if} - {/foreach} - {else} - {$input.p} - {/if} -

- {/if} - {if isset($languages)}
{/if} - {block name="end_field_block"}
{/block} - {/if} - {if $input.name == 'id_state'} -
- {/if} - {/foreach} - {elseif $key == 'submit'} -
- -
- {/if} - {/foreach} - {if $required_fields} -
* {l s ='Required field'}
- {/if} -
- - -

-{if $firstCall && !$no_back} - {if $back} - {l s='Back'} - {else} - {l s='Back to list'} - {/if} -
-{/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} diff --git a/admin-dev/themes/template/products/content.tpl b/admin-dev/themes/template/products/content.tpl index c2cd5d8c2..7a47aa02a 100644 --- a/admin-dev/themes/template/products/content.tpl +++ b/admin-dev/themes/template/products/content.tpl @@ -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 +* @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 +*} + diff --git a/admin-dev/themes/template/tax_rules_group/form_new.tpl b/admin-dev/themes/template/tax_rules_group/form_new.tpl index 8a4ac6da2..5417fbb95 100644 --- a/admin-dev/themes/template/tax_rules_group/form_new.tpl +++ b/admin-dev/themes/template/tax_rules_group/form_new.tpl @@ -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[]'} '; - + $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(); } } diff --git a/classes/HelperOptions.php b/classes/HelperOptions.php index 1756db45b..efb112e7c 100644 --- a/classes/HelperOptions.php +++ b/classes/HelperOptions.php @@ -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(); } /** diff --git a/controllers/admin/AdminAttributesGroupsController.php b/controllers/admin/AdminAttributesGroupsController.php index 95efbf19c..88be5cfbd 100644 --- a/controllers/admin/AdminAttributesGroupsController.php +++ b/controllers/admin/AdminAttributesGroupsController.php @@ -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); } -} \ No newline at end of file +} diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php index 2541af438..e71f4ca4a 100644 --- a/controllers/admin/AdminCategoriesController.php +++ b/controllers/admin/AdminCategoriesController.php @@ -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.'&add'.$this->table.'&token='.$this->token, 'desc' => $this->l('Add new') ); + if (Tools::getValue('id_category')) + $this->toolbar_btn['edit'] = array( + 'href' => self::$currentIndex.'&update'.$this->table.'&id_category='.Tools::getValue('id_category').'&token='.$this->token, + 'desc' => $this->l('Edit') + ); if ($this->display == 'view') $this->toolbar_btn['new'] = array( 'href' => self::$currentIndex.'&add'.$this->table.'&id_parent='.Tools::getValue('id_category').'&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( diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index 93139ea0c..22c05d514 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -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); } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index f2a10c7d3..1b68f0e5d 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -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; diff --git a/controllers/admin/AdminTrackingController.php b/controllers/admin/AdminTrackingController.php index dd5602fb0..856ac7f3d 100644 --- a/controllers/admin/AdminTrackingController.php +++ b/controllers/admin/AdminTrackingController.php @@ -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 .= '

'.$this->_list['message'].' '.$nbCategories.' '.$this->l('found').'

'; + $content .= '

'.$this->_list['message'].' '.$nbCategories.' '.$this->l('found').'

'; if (!$nbCategories) - return ; - $this->content .= ' + return $content; + $content .= '
'.$this->l('No items found').'
'; $irow = 0; foreach ($this->_list['obj'] AS $k => $category) - $this->content .= ''; - $this->content .= '
'.rtrim(getPath('index.php?tab=AdminCatalog', $category['id_category']), ' >').'


'; + $content .= ''.rtrim(getPath('index.php?controller=AdminCategory', $category['id_category']), ' >').''; + $content .= '

'; } + return $content; } - public function displayProducts() + public function getCustomListProductsAttributesNoStock() { - if (isset($this->_list['obj'])) - { - $nbProducts = sizeof($this->_list['obj']); - $this->content .= '

'.$this->_list['message'].' '.$nbProducts.' '.$this->l('found').'

'; - 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 .= ' - - '; - foreach ($this->fieldsDisplay AS $field) - $this->content .= ''.$field['title'].''; - $this->content .= ' - '; - 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 .= ' - - - - - - - - - - - - '; - } - $this->content .= '
'.$product->id.''.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').''.$product->reference.''.stripslashes($product->name).''.Tools::displayPrice($product->getPrice(), $this->context->currency).''.(float)$taxrate.'% '.$product->quantity.''.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').' - - '.$this->l('Modify this product').'  - name)).' ?\');"> - '.$this->l('Delete this product').' -


'; - } + $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 .= '

'.$this->_list['message'].' '.$nbAttributes.' '.$this->l('found').'

'; + $content .= '

'.$this->_list['message'].' '.$nbAttributes.' '.$this->l('found').'

'; 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 .= ' '; foreach ($this->fieldsDisplay AS $field) - $this->content .= ''.$field['title'].''; - $this->content .= ' + $content .= ''.$field['title'].''; + $content .= ' '; $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 .= ' - + - + '; } - $this->content .= '
'.$prod['id_product'].' '.($prod['manufacturer_name'] != NULL ? stripslashes($prod['manufacturer_name']) : '--').' '.$prod['reference'].''.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.''.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.' '.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $this->context->currency).' '.(float)$tax_rate.'% '.$prod['quantity'].' '.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').' - + '.$this->l('Modify this product').'  - + '.$this->l('Delete this product').'


'; + $content .= '

'; } + 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 .= '

'.$this->_list['message'].' '.$nbProducts.' '.$this->l('found').'

'; + 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 .= ' + + '; + foreach ($this->fieldsDisplay AS $field) + $content .= ''.$field['title'].''; + $content .= ' + '; + 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 .= ' + + + + + + + + + + + + '; + } + $content .= '
'.$product->id.''.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').''.$product->reference.''.stripslashes($product->name).''.Tools::displayPrice($product->getPrice(), $this->context->currency).''.(float)$taxrate.'% '.$product->quantity.''.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').' + + '.$this->l('Modify this product').'  + name)).' ?\');"> + '.$this->l('Delete this product').' +


'; + } + 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'); } }