diff --git a/admin/themes/default/template/controllers/products/informations.tpl b/admin/themes/default/template/controllers/products/informations.tpl index d67bdffb0..fdfa02ee0 100644 --- a/admin/themes/default/template/controllers/products/informations.tpl +++ b/admin/themes/default/template/controllers/products/informations.tpl @@ -455,7 +455,7 @@

{l s='Please note that position numbering starts from 0. A position of 0 means room type will be displayed at the topmost position.'}

{l s='You can manage positions of the room types of this hotel from'} - {l s='here.'} + {l s='here.'}
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 80e71feba..2dcb41a51 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -878,9 +878,8 @@ class AdminControllerCore extends Controller } } - if (empty($filters)) { - $filters = $this->context->cookie->getFamily($prefix.$this->list_id.'Filter_'); - } + // To merge the older filters with the new ones, and replace if new data is added to filter. + $filters = array_merge($this->context->cookie->getFamily($prefix.$this->list_id.'Filter_'), $filters); foreach ($filters as $key => $value) { $key_org = $key; diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index d204c88ff..12d070ce4 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -139,6 +139,7 @@ class AdminNormalProductsControllerCore extends AdminController } } + $catFitlerKey = $this->table.'Filter_a!id_category_default'; if (Tools::getValue('reset_filter_category')) { $this->context->cookie->id_category_products_filter = false; } @@ -149,6 +150,9 @@ class AdminNormalProductsControllerCore extends AdminController Tools::redirectAdmin($this->context->link->getAdminLink('AdminNormalProducts')); } } + if (!Tools::getValue($catFitlerKey)) { + $this->context->cookie->id_category_products_filter = false; + } /* Join categories table */ if ($id_category = (int)Tools::getValue('productFilter_cl!name')) { $this->_category = new Category((int)$id_category); @@ -160,6 +164,21 @@ class AdminNormalProductsControllerCore extends AdminController } elseif ($id_category = $this->context->cookie->id_category_products_filter) { $this->id_current_category = $id_category; } + + $idFilterCategory = false; + if (!Tools::isSubmit($catFitlerKey)) { + $prefix = $this->getCookieFilterPrefix(); + $idFilterCategory = $this->context->cookie->{$prefix.$catFitlerKey}; + } + + if ($idFilterCategory) { + $this->id_current_category = $idFilterCategory; + $this->context->cookie->id_category_products_filter = $idFilterCategory; + } else { + $this->id_current_category = false; + $this->context->cookie->id_category_products_filter = false; + } + if ($this->id_current_category) { $this->_category = new Category((int)$this->id_current_category); } else { @@ -550,8 +569,9 @@ class AdminNormalProductsControllerCore extends AdminController public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null) { - $orderByPriceFinal = (empty($orderBy) ? ($this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : 'id_'.$this->table) : $orderBy); - $orderWayPriceFinal = (empty($orderWay) ? ($this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderby') : 'ASC') : $orderWay); + $prefix = $this->getCookieFilterPrefix(); + $orderByPriceFinal = (empty($orderBy) ? ($this->context->cookie->__get($prefix.$this->table.'Orderby') ? $this->context->cookie->__get($prefix.$this->table.'Orderby') : 'id_'.$this->table) : $orderBy); + $orderWayPriceFinal = (empty($orderWay) ? ($this->context->cookie->__get($prefix.$this->table.'Orderway') ? $this->context->cookie->__get($prefix.$this->table.'Orderby') : 'ASC') : $orderWay); if ($orderByPriceFinal == 'price_final') { $orderBy = 'id_'.$this->table; $orderWay = 'ASC'; @@ -2560,9 +2580,10 @@ class AdminNormalProductsControllerCore extends AdminController // If products from all categories are displayed, we don't want to use sorting by position if (!$id_category) { $this->_defaultOrderBy = $this->identifier; - if ($this->context->cookie->{$this->table.'Orderby'} == 'position') { - unset($this->context->cookie->{$this->table.'Orderby'}); - unset($this->context->cookie->{$this->table.'Orderway'}); + $prefix = $this->getCookieFilterPrefix(); + if ($this->context->cookie->{$prefix.$this->table.'Orderby'} == 'position') { + unset($this->context->cookie->{$prefix.$this->table.'Orderby'}); + unset($this->context->cookie->{$prefix.$this->table.'Orderway'}); } } if (!$id_category) { diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index c65497b23..36610d0b0 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -161,14 +161,32 @@ class AdminProductsControllerCore extends AdminController $_POST['productFilter_a!id_category_default'] = $id_category; } + $catFitlerKey = $this->table.'Filter_a!id_category_default'; + if (!Tools::getValue($catFitlerKey)) { + $this->context->cookie->id_category_room_types_filter = false; + } if (($id_category = (int)Tools::getValue('id_category')) - || ($id_category = (int) Tools::getValue('productFilter_a!id_category_default')) + || ($id_category = (int) Tools::getValue($catFitlerKey)) ) { $this->id_current_category = $id_category; $this->context->cookie->id_category_room_types_filter = $id_category; } elseif ($id_category = $this->context->cookie->id_category_room_types_filter) { $this->id_current_category = $id_category; + } else { + $idFilterCategory = false; + if (!Tools::isSubmit($catFitlerKey)) { + $prefix = $this->getCookieFilterPrefix(); + $idFilterCategory = $this->context->cookie->{$prefix.$catFitlerKey}; + } + + if ($idFilterCategory) { + $this->id_current_category = $idFilterCategory; + $this->context->cookie->id_category_room_types_filter = $idFilterCategory; + } else { + $this->context->cookie->id_category_room_types_filter = false; + } } + if ($this->id_current_category) { $this->_category = new Category((int)$this->id_current_category); $this->position_group_identifier = (int) $this->id_current_category; @@ -631,8 +649,9 @@ class AdminProductsControllerCore extends AdminController public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null) { - $orderByPriceFinal = (empty($orderBy) ? ($this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : 'id_'.$this->table) : $orderBy); - $orderWayPriceFinal = (empty($orderWay) ? ($this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderby') : 'ASC') : $orderWay); + $prefix = $this->getCookieFilterPrefix(); + $orderByPriceFinal = (empty($orderBy) ? ($this->context->cookie->__get($prefix.$this->table.'Orderby') ? $this->context->cookie->__get($prefix.$this->table.'Orderby') : 'id_'.$this->table) : $orderBy); + $orderWayPriceFinal = (empty($orderWay) ? ($this->context->cookie->__get($prefix.$this->table.'Orderway') ? $this->context->cookie->__get($prefix.$this->table.'Orderby') : 'ASC') : $orderWay); if ($orderByPriceFinal == 'price_final') { $orderBy = 'id_'.$this->table; $orderWay = 'ASC'; @@ -2524,9 +2543,10 @@ class AdminProductsControllerCore extends AdminController // If products from all categories are displayed, we don't want to use sorting by position if (!(int) $this->id_current_category) { $this->_defaultOrderBy = $this->identifier; - if ($this->context->cookie->{$this->table.'Orderby'} == 'position') { - unset($this->context->cookie->{$this->table.'Orderby'}); - unset($this->context->cookie->{$this->table.'Orderway'}); + $prefix = $this->getCookieFilterPrefix(); + if ($this->context->cookie->{$prefix.$this->table.'Orderby'} == 'position') { + unset($this->context->cookie->{$prefix.$this->table.'Orderby'}); + unset($this->context->cookie->{$prefix.$this->table.'Orderway'}); } } } diff --git a/modules/wkhotelroom/controllers/admin/AdminHotelRoomModuleSettingController.php b/modules/wkhotelroom/controllers/admin/AdminHotelRoomModuleSettingController.php index 4e37f08d8..0fe71a798 100644 --- a/modules/wkhotelroom/controllers/admin/AdminHotelRoomModuleSettingController.php +++ b/modules/wkhotelroom/controllers/admin/AdminHotelRoomModuleSettingController.php @@ -106,6 +106,7 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController ), 'date_add' => array( 'title' => $this->l('Date Add'), + 'filter_key' => 'a!date_add', 'align' => 'center', 'type' => 'datetime', ),