Other module setting in Hotel Reservation System Settings is not usable. We should give configuration of modules in their separate Configuration tab

This commit is contained in:
sumit panwar
2021-01-27 21:15:58 +05:30
parent 6b7ef21e3a
commit 430b222046
5 changed files with 123 additions and 56 deletions

View File

@@ -28,7 +28,6 @@ class AdminHotelConfigurationSettingController extends ModuleAdminController
'general_setting_link' => $this->context->link->getAdminLink('AdminHotelGeneralSettings'),
'payment_setting_link' => $this->context->link->getAdminLink('AdminPaymentsSetting'),
'order_restrict_setting_link' => $this->context->link->getAdminLink('AdminOrderRestrictSettings'),
'other_module_setting_link' => $this->context->link->getAdminLink('AdminOtherHotelModulesSetting'),
'additional_demand_setting_link' => $this->context->link->getAdminLink('AdminRoomTypeGlobalDemand'),
);
// Reviews setting link if only productcomment module is enabled

View File

@@ -1,13 +0,0 @@
<?php
class AdminOtherHotelModulesSettingController extends ModuleAdminController
{
public function __construct()
{
$this->table = 'configuration';
$this->className = 'Configuration';
$this->bootstrap = true;
$this->fields_options = array();
Hook::exec('addOtherModuleSetting', array('fields_options' => &$this->fields_options));
parent::__construct();
}
}

View File

@@ -597,7 +597,6 @@ class hotelreservationsystem extends Module
//Controllers which are to be used in this modules but we have not to create tab for those ontrollers...
$this->installTab('AdminOrderRestrictSettings', 'order restrict configuration', false, false);
$this->installTab('AdminHotelGeneralSettings', 'Hotel General configuration', false, false);
$this->installTab('AdminOtherHotelModulesSetting', 'other hotel configuration', false, false);
$this->installTab('AdminPaymentsSetting', 'payments configuration', false, false);
$this->installTab('AdminHotelFeaturePricesSettings', 'feature pricing configuration', false, false);
$this->installTab('AdminRoomTypeGlobalDemand', 'Additional demand configuration', false, false);

View File

@@ -40,15 +40,6 @@
<i class="icon-question-circle"></i>
</a>
</div>
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$other_module_setting_link}" class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="icon-support"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{l s='Other Modules' mod='hotelreservationsystem'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{l s='Other Modules Settings' mod='hotelreservationsystem'}" data-content="{l s='Configure here settings of other modules of the software.' mod='hotelreservationsystem'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>
<!-- Setting to set prices for date range -->
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$feature_price_setting_link}" class="setting-link btn btn-default col-sm-10 col-xs-10">

View File

@@ -42,6 +42,128 @@ class wkhotelfilterblock extends Module
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
}
public function getContent()
{
if (Tools::isSubmit('btnConfigSubmit')) {
$this->postProcess();
} else {
$this->html .= '<br />';
}
$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()
@@ -51,7 +173,7 @@ class wkhotelfilterblock extends Module
return false;
}
//set default config variable
//set default config variable`
Configuration::updateValue('SHOW_RATTING_FILTER', 1);
Configuration::updateValue('SHOW_AMENITIES_FILTER', 1);
Configuration::updateValue('SHOW_PRICE_FILTER', 1);
@@ -59,37 +181,6 @@ class wkhotelfilterblock extends Module
return true;
}
public function hookAddOtherModuleSetting($params)
{
$params['fields_options']['categoryfiltersetting'] = array(
'title' => $this->l('Category Filter Configuration'),
'fields' => array(
'SHOW_RATTING_FILTER' => array(
'title' => $this->l('Show Guest Rating Filter'),
'hint' => $this->l('If yes, it will display Guest Rating Filter.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
),
'SHOW_AMENITIES_FILTER' => array(
'title' => $this->l('Show Amenities Filter'),
'hint' => $this->l('If yes, it will display Amenities Filter.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
),
'SHOW_PRICE_FILTER' => array(
'title' => $this->l('Show Price Filter'),
'hint' => $this->l('If yes, it will display Price Filter.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
),
),
'submit' => array('title' => $this->l('Save')),
);
}
public function hookHeader()
{
$this->context->controller->addJQueryUI('ui.slider');