diff --git a/admin/themes/default/sass/partials/_content.sass b/admin/themes/default/sass/partials/_content.sass index 94328c025..15f042aab 100644 --- a/admin/themes/default/sass/partials/_content.sass +++ b/admin/themes/default/sass/partials/_content.sass @@ -191,6 +191,84 @@ body.display-modal margin: 15px 0 0!important height: 40px!important +//list header +.list_action_wrapper + margin-bottom: 15px + .list_availibility_container + position: relative + .dropdown-menu + right: 0 + padding: 8px 12px + label + font-weight: 400 + #selected_filter_container + background-color: #fff + padding: 8px 20px + border: solid 1px #d3d8db + border-radius: 5px 5px 0 0 + font-size: 14px + min-height: 52px + margin-top: 15px + .selected_filters > span + font-size: 12px + padding: 6px 10px + display: inline-block + background: #F5F8F9 + border: 1px solid #A0D0EB + border-radius: 3px + &+ span + margin-left: 12px + .filter_value + font-weight: 700 + i + cursor: pointer + + #list_filters_panel + margin-top: 15px + margin-bottom: 0 + #selected_filter_container + #list_filters_panel + margin-top: 0 + #selected_filter_container + div.panel + border-top: transparent + border-radius: 0 0 5px 5px + .list_filters + padding: 0 30px + display: grid + grid-template-columns: repeat(3, minmax(0, 1fr)) + gap: 8px 40px + &>.row + display: flex + align-items: center + .date_range, .input_range + display: flex + justify-content: space-between + gap: 15px + .date_range .input-group:first-child + margin-bottom: 0 + label + text-align: right + font-weight: 400 + .actions + grid-column-start: 1 + grid-column-end: 4 + @media (max-width: $screen-desktop) + .list_filters + grid-template-columns: repeat(2, 1fr) + .actions + grid-column-start: 1 + grid-column-end: 3 + + @media (max-width: $screen-tablet) + .list_filters + grid-template-columns: repeat(1, 1fr) + .actions + grid-column-start: 1 + grid-column-end: 2 + label + text-align: left + + + //help containers #main.helpOpen width: 70% diff --git a/admin/themes/default/template/controllers/normal_products/helpers/list/index.php b/admin/themes/default/template/controllers/normal_products/helpers/list/index.php deleted file mode 100644 index 2cba03ab6..000000000 --- a/admin/themes/default/template/controllers/normal_products/helpers/list/index.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../../../../../../'); -exit; diff --git a/admin/themes/default/template/controllers/normal_products/helpers/list/list_header.tpl b/admin/themes/default/template/controllers/normal_products/helpers/list/list_header.tpl deleted file mode 100644 index 27872f854..000000000 --- a/admin/themes/default/template/controllers/normal_products/helpers/list/list_header.tpl +++ /dev/null @@ -1,36 +0,0 @@ -{* -* 2007-2017 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-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -{extends file="helpers/list/list_header.tpl"} - -{block name=leadin} - {if isset($category_tree)} -
-
- {$category_tree} -
-
- {/if} -{/block} diff --git a/admin/themes/default/template/controllers/orders/helpers/list/list_header.tpl b/admin/themes/default/template/controllers/orders/helpers/list/list_header.tpl index 255b57976..c4365c90f 100644 --- a/admin/themes/default/template/controllers/orders/helpers/list/list_header.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/list/list_header.tpl @@ -65,446 +65,91 @@ {/if} {/block} - - -{block name="tableFilter"}{/block} {block name="override_form_extra"} - {if !$simple_header && $show_filters} - -
-
-
-
- - -
-
-
-
- -
-
-
-
-
- {if $filters_has_value} -
- {l s='Filters: '} - - {foreach $fields_display AS $key => $params} - {if (!isset($params.search) || $params.search) && $params.value != ''} - {if ($params.type == 'date' || $params.type == 'datetime' || $params.type == 'range') && $params.value|is_array} - {assign var="filter_value" value=''} - {foreach $params.value as $value} - {if (isset($value) && ($value !== '' || $value === 0))} - {if !(isset($filter_value) && ($filter_value !== '' || $filter_value === 0))} - {assign var="filter_value" value=$value} - {else} - {assign var="filter_value" value="`$filter_value` - `$value`"} - {/if} - {/if} - {/foreach} - {if (isset($filter_value) && ($filter_value !== '' || $filter_value === 0))} - - {$params['title']|escape:'html':'UTF-8'}: {$filter_value|escape:'html':'UTF-8'} - - - {/if} - {elseif $params.type == 'select'} - {if isset($params.multiple) && $params.multiple} - - {$params['title']|escape:'html':'UTF-8'}: - - {foreach from=$params.value item=option name=foreachInfo} - {$params.list[$option]}{if !$smarty.foreach.foreachInfo.last}{if $params.operator == 'or'} | {else}, {/if}{/if} - {/foreach} - - - - {else} - - {$params['title']|escape:'html':'UTF-8'}: {$params['list'][$params['value']]|replace: ' ' : ''} - - - {/if} - {else} - - {$params['title']|escape:'html':'UTF-8'}: {$params['value']|escape:'html':'UTF-8'} - - - {/if} - {/if} - {/foreach} - -
- {/if} -
-
-
-
- {foreach $fields_display AS $key => $params} - {if !isset($params.search) || $params.search} -
- -
- {if $params.type == 'range'} -
- - -
- {elseif $params.type == 'bool'} - - {elseif $params.type == 'date' || $params.type == 'datetime'} -
-
- - - - - -
-
- - - - - -
- -
- {elseif $params.type == 'select'} - {if isset($params.multiple) && $params.multiple} - - {else} - {if isset($params.filter_key)} - - {/if} - {/if} - {else} - - {/if} -
-
- {/if} - {/foreach} - {if $has_actions || $show_filters} -
-
- {if $show_filters} - - - {if $filters_has_value} - - {/if} - - {/if} -
- {/if} -
-
-
-
-
-
-
- - {/if} {/block} diff --git a/admin/themes/default/template/controllers/products/helpers/list/list_header.tpl b/admin/themes/default/template/controllers/products/helpers/list/list_header.tpl deleted file mode 100644 index 6801fde31..000000000 --- a/admin/themes/default/template/controllers/products/helpers/list/list_header.tpl +++ /dev/null @@ -1,417 +0,0 @@ -{* -* 2007-2017 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-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -{extends file="helpers/list/list_header.tpl"} - -{block name="tableFilter"}{/block} -{block name="override_form_extra"} - {if !$simple_header && $show_filters} - -
-
-
-
- - -
-
-
-
- -
-
-
-
-
- {if $filters_has_value} -
- {l s='Filters: '} - - {foreach $fields_display AS $key => $params} - {if (!isset($params.search) || $params.search) && $params.value != ''} - {if ($params.type == 'date' || $params.type == 'datetime') && $params.value|is_array} - {assign var="filter_value" value=''} - {foreach $params.value as $value} - {if ($value|is_string && !empty($value))} - {if empty($filter_value)} - {assign var="filter_value" value=$value} - {else} - {assign var="filter_value" value="`$filter_value` - `$value`"} - {/if} - {/if} - {/foreach} - {if !empty($filter_value)} - - {$params['title']|escape:'html':'UTF-8'}: {$filter_value|escape:'html':'UTF-8'} - - - {/if} - {elseif $params.type == 'range' && $params.value|is_array} - {assign var="filter_value" value=''} - {foreach $params.value as $value} - {if (isset($value) && ($value !== '' || $value === 0))} - {if !(isset($filter_value) && ($filter_value !== '' || $filter_value === 0))} - {assign var="filter_value" value=$value} - {else} - {assign var="filter_value" value="`$filter_value` - `$value`"} - {/if} - {/if} - {/foreach} - {if (isset($filter_value) && ($filter_value !== '' || $filter_value === 0))} - - {$params['title']|escape:'html':'UTF-8'}: {$filter_value|escape:'html':'UTF-8'} - - - {/if} - {elseif $params.type == 'select'} - {if isset($params.multiple) && $params.multiple} - - {$params['title']|escape:'html':'UTF-8'}: - - {foreach from=$params.value item=option name=foreachInfo} - {$params.list[$option]}{if !$smarty.foreach.foreachInfo.last}{if $params.operator == 'or'} | {else}, {/if}{/if} - {/foreach} - - - - {else} - - {$params['title']|escape:'html':'UTF-8'}: {$params['list'][$params['value']]|replace: ' ' : ''} - - - {/if} - {elseif $params.type == 'bool' && $key == 'advance_payment'} - - {$params['title']|escape:'html':'UTF-8'}: {if $params['value'] == 1}{l s='Yes'}{elseif $params['value'] == 0}{l s='No'}{/if} - - - {else} - - {$params['title']|escape:'html':'UTF-8'}: {$params['value']|escape:'html':'UTF-8'} - - - {/if} - {/if} - {/foreach} - -
- {/if} -
-
-
-
- {foreach $fields_display AS $key => $params} - {if !isset($params.search) || $params.search} -
- -
- {if $params.type == 'range'} -
- - -
- {else if $params.type == 'bool'} - - {elseif $params.type == 'date' || $params.type == 'datetime'} -
-
- - - - - -
-
- - - - - -
- -
- {elseif $params.type == 'select'} - {if isset($params.multiple) && $params.multiple} - - {else} - {if isset($params.filter_key)} - - {/if} - {/if} - {else} - - {/if} -
-
- {/if} - {/foreach} - {if $has_actions || $show_filters} -
-
- {if $show_filters} - - - {if $filters_has_value} - - {/if} - - {/if} -
- {/if} -
-
-
-
-
-
-
- - - {/if} -{/block} \ No newline at end of file diff --git a/admin/themes/default/template/helpers/list/list_header.tpl b/admin/themes/default/template/helpers/list/list_header.tpl index a03584068..fcc22bbbe 100644 --- a/admin/themes/default/template/helpers/list/list_header.tpl +++ b/admin/themes/default/template/helpers/list/list_header.tpl @@ -75,8 +75,8 @@ $('#submitFilter{$list_id}').val(1); }); - if ($("table .datepicker").length > 0) { - $("table .datepicker").datepicker({ + if ($("form .datepicker").length > 0) { + $("form .datepicker").datepicker({ prevText: '', nextText: '', altFormat: 'yy-mm-dd' @@ -121,7 +121,305 @@ {block name="override_form_extra"}{/block} -
+ {if !$simple_header && $show_filters} + + {/if} + {block name="updatelist"} + {if $use_new_header_filters} +
+
+ {if $fields_optional|count} +
+
+ + +
+
+ {/if} + {if !$simple_header && $show_filters} +
+
+ +
+
+ {/if} +
+
+
+ {if $filters_has_value} +
+ {l s='Filters: '} + + {foreach $fields_display AS $key => $params} + {if (!isset($params.search) || $params.search) && $params.value != ''} + {if ($params.type == 'date' || $params.type == 'datetime' || $params.type == 'range') && $params.value|is_array} + {assign var="filter_value" value=''} + {foreach $params.value as $value} + {if (isset($value) && ($value !== '' || $value === 0))} + {if !(isset($filter_value) && ($filter_value !== '' || $filter_value === 0))} + {assign var="filter_value" value=$value} + {else} + {assign var="filter_value" value="`$filter_value` - `$value`"} + {/if} + {/if} + {/foreach} + {if (isset($filter_value) && ($filter_value !== '' || $filter_value === 0))} + + {$params['title']|escape:'html':'UTF-8'}: {$filter_value|escape:'html':'UTF-8'} + + + {/if} + {elseif $params.type == 'select'} + {if isset($params.multiple) && $params.multiple} + + {$params['title']|escape:'html':'UTF-8'}: + + {foreach from=$params.value item=option name=foreachInfo} + {$params.list[$option]}{if !$smarty.foreach.foreachInfo.last}{if $params.operator == 'or'} | {else}, {/if}{/if} + {/foreach} + + + + {else} + + {$params['title']|escape:'html':'UTF-8'}: {$params['list'][$params['value']]|replace: ' ' : ''} + + + {/if} + {elseif $params.type == 'bool'} + + {$params['title']|escape:'html':'UTF-8'}: {if $params['value'] == 1}{l s='Yes'}{else}{l s='No'}{/if} + + + {else} + + {$params['title']|escape:'html':'UTF-8'}: {$params['value']|escape:'html':'UTF-8'} + + + {/if} + {/if} + {/foreach} + +
+ {/if} +
+
+
+
+ {foreach $fields_display AS $key => $params} + {if !isset($params.search) || $params.search} +
+ +
+ {if $params.type == 'range'} +
+ + +
+ {elseif $params.type == 'bool'} + + {elseif $params.type == 'date' || $params.type == 'datetime'} +
+
+ + + + + +
+
+ + + + + +
+ +
+ {elseif $params.type == 'select'} + {if isset($params.multiple) && $params.multiple} + + {else} + {if isset($params.filter_key)} + + {/if} + {/if} + {else} + + {/if} +
+
+ {/if} + {/foreach} + {if $has_actions || $show_filters} +
+
+ {if $show_filters} + + + {if $filters_has_value} + + {/if} + + {/if} +
+ {/if} +
+
+
+
+
+
+
+ {/if} + {/block} +
{block name="panel_heading"}
{if isset($icon)} {/if}{if is_array($title)}{$title|end}{else}{$title}{/if} @@ -138,7 +436,7 @@ {/if} {/foreach} - {if $fields_optional|count} + {if $fields_optional|count && !$use_new_header_filters} @@ -154,46 +452,6 @@ {/foreach} {/if} - @@ -364,7 +622,7 @@ {/block} {block name="tableFilter"} - {if !$simple_header && $show_filters} + {if !$simple_header && $show_filters && !$use_new_header_filters} {if $has_bulk_actions} diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 9ee0ef05e..21683d266 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -197,6 +197,9 @@ class AdminControllerCore extends Controller /** @var string */ protected $_filterHaving; + /** @var string */ + protected $_use_new_header_filters = false; + /** @var array Temporary SQL table WHERE clause determined by filter fields */ protected $_tmpTableFilter = ''; @@ -2511,6 +2514,7 @@ class AdminControllerCore extends Controller } $this->setHelperDisplay($helper); + $helper->_use_new_header_filters = $this->_use_new_header_filters; $helper->_default_pagination = $this->_default_pagination; $helper->_pagination = $this->_pagination; $helper->tpl_vars = $this->getTemplateListVars(); diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index 63223cc11..c243c6201 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -38,6 +38,8 @@ class HelperListCore extends Helper /** @var array WHERE clause determined by filter fields */ protected $_filter; + public $_use_new_header_filters = false; + /** @var array Number of results in list per page (used in select field) */ public $_pagination = array(20, 50, 100, 300, 1000); @@ -742,6 +744,7 @@ class HelperListCore extends Helper Context::getContext()->smarty->assign(array( 'page' => $page, 'simple_header' => $this->simple_header, + 'use_new_header_filters' => $this->_use_new_header_filters, 'total_pages' => $total_pages, 'selected_pagination' => $selected_pagination, 'pagination' => $this->_pagination, diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 1572a1be4..bca99c7b2 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -71,7 +71,14 @@ class AdminCustomersControllerCore extends AdminController $titles_array[$gender->id_gender] = $gender->name; } + $groups_array = array(); + $groups = Group::getGroups(Context::getContext()->language->id); + foreach ($groups as $group) { + $groups_array[$group['id_group']] = $group['name']; + } + $this->_join = 'LEFT JOIN '._DB_PREFIX_.'gender_lang gl ON (a.id_gender = gl.id_gender AND gl.id_lang = '.(int)$this->context->language->id.')'; + $this->_join .= ' LEFT JOIN '._DB_PREFIX_.'group_lang grl ON (a.id_default_group = grl.id_group AND grl.id_lang = '.(int)$this->context->language->id.')'; $this->_use_found_rows = false; $this->fields_list = array( 'id_customer' => array( @@ -107,9 +114,25 @@ class AdminCustomersControllerCore extends AdminController } $this->fields_list = array_merge($this->fields_list, array( + 'default_group_name' => array( + 'title' => $this->l('Default Group'), + 'optional' => true, + 'type' => 'select', + 'list' => $groups_array, + 'filter_key' => 'a!id_default_group', + ), + 'total_orders' => array( + 'title' => $this->l('Number of orders'), + 'optional' => true, + 'visible_default' => true, + 'havingFilter' => true, + 'order_key' => 'total_orders' + ), 'total_spent' => array( 'title' => $this->l('Sales'), 'type' => 'price', + 'optional' => true, + 'visible_default' => true, 'search' => false, 'havingFilter' => true, 'align' => 'text-right', @@ -155,13 +178,19 @@ class AdminCustomersControllerCore extends AdminController parent::__construct(); $this->_select = ' - a.date_add, gl.name as title, ( + a.date_add, gl.name as title, grl.name as default_group_name, ( SELECT SUM(total_paid_real / conversion_rate) FROM '._DB_PREFIX_.'orders o WHERE o.id_customer = a.id_customer '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' AND o.valid = 1 ) as total_spent, ( + SELECT COUNT(o.`id_order`) + FROM '._DB_PREFIX_.'orders o + WHERE o.id_customer = a.id_customer + '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' + AND o.valid = 1 + ) as total_orders, ( SELECT c.date_add FROM '._DB_PREFIX_.'guest g LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest WHERE g.id_customer = a.id_customer @@ -326,6 +355,8 @@ class AdminCustomersControllerCore extends AdminController ); } + $this->_use_new_header_filters = true; + return parent::renderList(); } @@ -601,7 +632,7 @@ class AdminCustomersControllerCore extends AdminController } $birthday = explode('-', $this->getFieldValue($obj, 'birthday')); - + $this->fields_value = array( 'years' => Tools::getValue('years', $this->getFieldValue($obj, 'birthday') ? $birthday[0] : 0), 'months' => Tools::getValue('months', $this->getFieldValue($obj, 'birthday') ? $birthday[1] : 0), @@ -1062,7 +1093,7 @@ class AdminCustomersControllerCore extends AdminController $days = Tools::getValue('days'); $months = Tools::getValue('months'); $years = Tools::getValue('years'); - + if ($days || $months || $years) { if (!$days) { $this->errors[] = Tools::displayError("Please select a valid date of birthday"); @@ -1074,10 +1105,10 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError("Please select a valid month of birthday"); } } - + $customer = new Customer(); $this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase()); - + return parent::processSave(); } diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index 89d0327ac..745d946e6 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -168,6 +168,15 @@ class AdminNormalProductsControllerCore extends AdminController $join_category = true; } + $priceAdditionType = array( + Product::PRICE_ADDITION_TYPE_WITH_ROOM => $this->l('Add price in room price'), + Product::PRICE_ADDITION_TYPE_INDEPENDENT => $this->l('Convenience Fee') + ); + $priceCalculationMethod = array( + Product::PRICE_CALCULATION_METHOD_PER_BOOKING => $this->l('Add price once for the booking range'), + Product::PRICE_CALCULATION_METHOD_PER_DAY => $this->l('Add price for each day of booking') + ); + $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0 '.StockAvailable::addSqlShopRestriction(null, null, 'sav').') '; @@ -188,7 +197,7 @@ class AdminNormalProductsControllerCore extends AdminController LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` rsp ON (rsp.`id_product` = a.`id_product`) LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)'; - $this->_select .= ' IF(a.`auto_add_to_cart`, "'.$this->l('Yes').'", "'.$this->l('No').'") as auto_added, IF(a.`auto_add_to_cart`, 1, 0) as badge_success, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, '; + $this->_select .= ' IF(a.`auto_add_to_cart`, "'.$this->l('Yes').'", "'.$this->l('No').'") as auto_added, IF(a.`auto_add_to_cart`, 1, 0) as badge_success, IF(a.`show_at_front`, "'.$this->l('Yes').'", "'.$this->l('No').'") as show_at_front_txt, IF(a.`price_calculation_method` = '.(int)Product::PRICE_CALCULATION_METHOD_PER_DAY.', "'.$this->l('Per Day').'", "'.$this->l('Per Booking').'") as price_calculation_method_txt, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, '; $this->_select .= ' COUNT(rsp.`id_product`) as products_associated, hrt.`adults`, hrt.`children`, hb.`id` as id_hotel, aa.`city`, hbl.`hotel_name`, '; $this->_select .= 'shop.`name` AS `shopname`, a.`id_shop_default`, '; $this->_select .= $alias_image.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`'; @@ -227,14 +236,62 @@ class AdminNormalProductsControllerCore extends AdminController 'title' => $this->l('Associated Rooms types'), 'class' => 'fixed-width-sm', 'havingFilter' => true, + 'optional' => true, + 'visible_default' => true, ); $this->fields_list['auto_added'] = array( 'title' => $this->l('Auto Added'), 'filter_key' => 'a!auto_add_to_cart', 'align' => 'text-center', 'type' => 'bool', + 'optional' => true, + 'visible_default' => true, 'badge_success' => true ); + $this->fields_list['show_at_front_txt'] = array( + 'title' => $this->l('Show at Front'), + 'filter_key' => 'a!show_at_front', + 'align' => 'text-center', + 'type' => 'bool', + 'optional' => true, + ); + $this->fields_list['available_for_order'] = array( + 'displayed' => false, + 'title' => $this->l('Available for order'), + 'filter_key' => 'a!available_for_order', + 'type' => 'bool', + ); + $this->fields_list['price_addition_type'] = array( + 'displayed' => false, + 'title' => $this->l('Price display preference'), + 'filter_key' => 'a!price_addition_type', + 'type' => 'select', + 'list' => $priceAdditionType, + ); + $this->fields_list['price_calculation_method_txt'] = array( + 'title' => $this->l('Price calculation method'), + 'filter_key' => 'a!price_calculation_method', + 'type' => 'select', + 'list' => $priceCalculationMethod, + 'visible_default' => true, + 'optional' => true, + ); + $this->servicesCategory = array(); + $idServiceCategory = Configuration::get('PS_SERVICE_CATEGORY'); + $this->objLocationsCategory = new Category($idServiceCategory, $this->context->language->id); + $nestedCategories = Category::getNestedCategories($idServiceCategory); + if ($nestedCategories) { + foreach ($nestedCategories[$idServiceCategory]['children'] as $childCategory) { + $this->buildCategoryOptions($childCategory); + } + } + $this->fields_list['name_category'] = array( + 'title' => $this->l('Default Category'), + 'type' => 'select', + 'list' => $this->servicesCategory, + 'filter_key' => 'a!id_category_default', + 'optional' => true, + ); // $serviceProductType = array( // Product::SERVICE_PRODUCT_WITH_ROOMTYPE => $this->l('Bought with room type'), // Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE => $this->l('Bought without room type') @@ -288,6 +345,18 @@ class AdminNormalProductsControllerCore extends AdminController } } + private function buildCategoryOptions($category) + { + $space = str_repeat(' ', 5 * (($category['level_depth'] - $this->objLocationsCategory->level_depth) - 1)); + $this->servicesCategory[$category['id_category']] = $space.$category['name']; + + if (isset($category['children']) && count($category['children'])) { + foreach ($category['children'] as $childCategory) { + $this->buildCategoryOptions($childCategory); + } + } + } + public function getBuyingOption($service_product_type, $row) { if ($service_product_type == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) { @@ -2446,6 +2515,9 @@ class AdminNormalProductsControllerCore extends AdminController $this->addRowAction('edit'); $this->addRowAction('duplicate'); $this->addRowAction('delete'); + + $this->_use_new_header_filters = true; + return parent::renderList(); } diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index efe584010..1c4c0d45a 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -675,6 +675,8 @@ class AdminOrdersControllerCore extends AdminController $this->tpl_list_vars['title'] = $this->l('Orders'); + $this->_use_new_header_filters = true; + return parent::renderList(); } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 3763fb057..3fb4004d8 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2552,6 +2552,8 @@ class AdminProductsControllerCore extends AdminController $this->tpl_list_vars['title'] = $this->l('Room Types'); + $this->_use_new_header_filters = true; + return parent::renderList(); }