diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php
index 11c4203d3..3c02164d8 100644
--- a/controllers/admin/AdminPPreferencesController.php
+++ b/controllers/admin/AdminPPreferencesController.php
@@ -305,6 +305,29 @@ class AdminPPreferencesControllerCore extends AdminController
// 'bottom' => '',
// 'submit' => array('title' => $this->l('Save'))
// ),
+ 'fo_search_filters' => array(
+ 'title' => $this->l('Search Filters'),
+ 'icon' => 'icon-search',
+ 'fields' => array(
+ 'SHOW_AMENITIES_FILTER' => array(
+ 'title' => $this->l('Show Amenities filter'),
+ 'hint' => $this->l('Enable to display Amenities filter for search.'),
+ 'validation' => 'isBool',
+ 'cast' => 'intval',
+ 'required' => false,
+ 'type' => 'bool',
+ ),
+ 'SHOW_PRICE_FILTER' => array(
+ 'title' => $this->l('Show Price filter'),
+ 'hint' => $this->l('Enable to display Price filter for search.'),
+ 'validation' => 'isBool',
+ 'cast' => 'intval',
+ 'required' => false,
+ 'type' => 'bool',
+ ),
+ ),
+ 'submit' => array('title' => $this->l('Save'))
+ ),
);
}
diff --git a/install/data/theme.sql b/install/data/theme.sql
index 499aa07d3..f302b2c22 100644
--- a/install/data/theme.sql
+++ b/install/data/theme.sql
@@ -3,6 +3,8 @@ SET NAMES 'utf8';
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'PS_CONDITIONS';
UPDATE `PREFIX_configuration` SET value = '12' WHERE name = 'PS_PRODUCTS_PER_PAGE';
UPDATE `PREFIX_configuration` SET value = '9' WHERE name = 'PS_HOTEL_IMAGES_PER_PAGE';
+UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'SHOW_AMENITIES_FILTER';
+UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'SHOW_PRICE_FILTER';
UPDATE `PREFIX_configuration` SET value = '0' WHERE name = 'PS_PRODUCTS_ORDER_WAY';
UPDATE `PREFIX_configuration` SET value = '4' WHERE name = 'PS_PRODUCTS_ORDER_BY';
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'PS_DISPLAY_QTIES';
diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml
index 436515bc6..4a07b5e6c 100644
--- a/install/data/xml/configuration.xml
+++ b/install/data/xml/configuration.xml
@@ -59,6 +59,12 @@
9
+
+ 1
+
+
+ 1
+
0
diff --git a/modules/wkhotelfilterblock/wkhotelfilterblock.php b/modules/wkhotelfilterblock/wkhotelfilterblock.php
index 79a6423c8..8aada65ce 100644
--- a/modules/wkhotelfilterblock/wkhotelfilterblock.php
+++ b/modules/wkhotelfilterblock/wkhotelfilterblock.php
@@ -42,129 +42,6 @@ class wkhotelfilterblock extends Module
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
}
- public function getContent()
- {
- $this->html = '';
- if (Tools::isSubmit('btnConfigSubmit')) {
- $this->postProcess();
- } else {
- $this->html .= '
';
- }
-
- $this->html .= $this->renderForm();
-
- return $this->html;
- }
-
- public function renderForm()
- {
- $fields_form = array();
- $fields_form['form'] = array(
- 'legend' => array(
- 'icon' => 'icon-cog',
- 'title' => $this->l('Search Results Filter Configuration'),
- ),
- 'input' => array(
- array(
- 'type' => 'switch',
- 'label' => $this->l('Show Guest Rating Filter'),
- 'name' => 'SHOW_RATTING_FILTER',
- 'is_bool' => true,
- 'values' => array(
- array(
- 'id' => 'active_on',
- 'value' => 1,
- ),
- array(
- 'id' => 'active_off',
- 'value' => 0,
- ),
- ),
- 'hint' => $this->l('If yes, it will display Guest Rating Filter.'),
- ),
- array(
- 'type' => 'switch',
- 'label' => $this->l('Show Amenities Filter'),
- 'name' => 'SHOW_AMENITIES_FILTER',
- 'is_bool' => true,
- 'values' => array(
- array(
- 'id' => 'active_on',
- 'value' => 1,
- ),
- array(
- 'id' => 'active_off',
- 'value' => 0,
- ),
- ),
- 'hint' => $this->l('If yes, it will display Amenities Filter.'),
- ),
- array(
- 'type' => 'switch',
- 'label' => $this->l('Show Price Filter'),
- 'name' => 'SHOW_PRICE_FILTER',
- 'is_bool' => true,
- 'values' => array(
- array(
- 'id' => 'active_on',
- 'value' => 1,
- ),
- array(
- 'id' => 'active_off',
- 'value' => 0,
- ),
- ),
- 'hint' => $this->l('If yes, it will display price Filter.'),
- ),
- ),
- 'submit' => array(
- 'title' => $this->l('Save'),
- 'name' => 'submit_conf_filter',
- ),
- );
-
- $helper = new HelperForm();
- $helper->show_toolbar = false;
- $helper->table = $this->table;
- $lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
- $helper->default_form_language = $lang->id;
- $this->fields_form = array();
- $helper->identifier = $this->identifier;
- $helper->submit_action = 'btnConfigSubmit';
- $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).
- '&configure='.$this->name.'&module_name='.$this->name;
- $helper->token = Tools::getAdminTokenLite('AdminModules');
-
- $helper->tpl_vars = array(
- 'fields_value' => $this->getConfigFieldsValues(),
- 'languages' => $this->context->controller->getLanguages(),
- 'id_language' => $this->context->language->id,
- );
-
- return $helper->generateForm(array($fields_form));
- }
-
- public function postProcess()
- {
- if (Tools::isSubmit('btnConfigSubmit')) {
- Configuration::updateValue(
- 'SHOW_RATTING_FILTER',
- Tools::getValue('SHOW_RATTING_FILTER')
- );
- Configuration::updateValue(
- 'SHOW_AMENITIES_FILTER',
- Tools::getValue('SHOW_AMENITIES_FILTER')
- );
- Configuration::updateValue('SHOW_PRICE_FILTER', Tools::getValue('SHOW_PRICE_FILTER'));
-
- // redirect after saving the configuration
- Tools::redirectAdmin(
- $this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&tab_module='.$this->tab.
- '&module_name='.$this->name.'&conf=4'
- );
- }
- }
-
public function install()
{
if (!parent::install()
@@ -174,11 +51,6 @@ class wkhotelfilterblock extends Module
return false;
}
- //set default config variable`
- Configuration::updateValue('SHOW_RATTING_FILTER', 1);
- Configuration::updateValue('SHOW_AMENITIES_FILTER', 1);
- Configuration::updateValue('SHOW_PRICE_FILTER', 1);
-
return true;
}
@@ -187,15 +59,6 @@ class wkhotelfilterblock extends Module
$this->context->controller->addJQueryUI('ui.slider');
}
- public function uninstall($keep = true)
- {
- if (!parent::uninstall() || !$this->deleteConfigKeys()) {
- return false;
- }
-
- return true;
- }
-
public function hookDisplayLeftColumn()
{
if ($this->context->controller->php_self == 'category') {
@@ -266,30 +129,4 @@ class wkhotelfilterblock extends Module
return $this->display(__FILE__, 'htlfilterblock.tpl');
}
}
-
- public function getConfigFieldsValues()
- {
- $config_vars = array(
- 'SHOW_RATTING_FILTER' => Tools::getValue('SHOW_RATTING_FILTER', Configuration::get('SHOW_RATTING_FILTER')),
- 'SHOW_AMENITIES_FILTER' => Tools::getValue('SHOW_AMENITIES_FILTER', Configuration::get('SHOW_AMENITIES_FILTER')),
- 'SHOW_PRICE_FILTER' => Tools::getValue('SHOW_PRICE_FILTER', Configuration::get('SHOW_PRICE_FILTER')),
- );
-
- return $config_vars;
- }
-
- public function deleteConfigKeys()
- {
- $var = array('SHOW_RATTING_FILTER',
- 'SHOW_AMENITIES_FILTER',
- 'SHOW_PRICE_FILTER', );
-
- foreach ($var as $key) {
- if (!Configuration::deleteByName($key)) {
- return false;
- }
- }
-
- return true;
- }
}