Update working of options Features and Customer Groups

This commit is contained in:
Abhishek Kumar
2023-09-20 19:10:11 +05:30
parent c4d30a80ee
commit dab830fcce
5 changed files with 33 additions and 23 deletions

View File

@@ -126,7 +126,7 @@ class AdminGroupsControllerCore extends AdminController
public function initPageHeaderToolbar()
{
if (empty($this->display)) {
if (empty($this->display) && Configuration::get('PS_GROUP_FEATURE_ACTIVE')) {
$this->page_header_toolbar_btn['new_group'] = array(
'href' => self::$currentIndex.'&addgroup&token='.$this->token,
'desc' => $this->l('Add new group', null, null, false),
@@ -542,6 +542,13 @@ class AdminGroupsControllerCore extends AdminController
public function renderList()
{
if (!Configuration::get('PS_GROUP_FEATURE_ACTIVE')) {
$this->displayWarning(sprintf(
$this->l('The feature Customer Groups has been disabled. You can enable it from %s page.'),
'<a href="'.$this->context->link->getAdminLink('AdminPerformance').'#fieldset_2_2" target="_blank">'.$this->l('Advanced Parameters > Performance').'</a>'
));
}
$unidentified = new Group(Configuration::get('PS_UNIDENTIFIED_GROUP'));
$guest = new Group(Configuration::get('PS_GUEST_GROUP'));
$default = new Group(Configuration::get('PS_CUSTOMER_GROUP'));

View File

@@ -400,8 +400,10 @@ class AdminPPreferencesControllerCore extends AdminController
'hint' => $this->l('Enable to display Amenities filter.'),
'validation' => 'isBool',
'cast' => 'intval',
'disabled' => (bool) !Configuration::get('PS_FEATURE_FEATURE_ACTIVE'),
'required' => false,
'type' => 'bool',
'desc' => (bool) !Configuration::get('PS_FEATURE_FEATURE_ACTIVE') ? sprintf($this->l('The feature Features/Amenities has been disabled. You can enable it from %s page.'), '<a href="'.$this->context->link->getAdminLink('AdminPerformance').'#fieldset_2_2" target="_blank">'.$this->l('Advanced Parameters > Performance').'</a>') : '',
),
'SHOW_PRICE_FILTER' => array(
'title' => $this->l('Show Price filter'),

View File

@@ -212,27 +212,27 @@ class AdminPerformanceControllerCore extends AdminController
'type' => 'hidden',
'name' => 'features_detachables_up'
),
array(
'type' => 'switch',
'label' => $this->l('Combinations'),
'name' => 'combination',
'is_bool' => true,
'disabled' => Combination::isCurrentlyUsed(),
'values' => array(
array(
'id' => 'combination_1',
'value' => 1,
'label' => $this->l('Yes'),
),
array(
'id' => 'combination_0',
'value' => 0,
'label' => $this->l('No')
)
),
'hint' => $this->l('Choose "No" to disable Product Combinations.'),
'desc' => Combination::isCurrentlyUsed() ? $this->l('You cannot set this parameter to No when combinations are already used by some of your products') : null
),
// array(
// 'type' => 'switch',
// 'label' => $this->l('Combinations'),
// 'name' => 'combination',
// 'is_bool' => true,
// 'disabled' => Combination::isCurrentlyUsed(),
// 'values' => array(
// array(
// 'id' => 'combination_1',
// 'value' => 1,
// 'label' => $this->l('Yes'),
// ),
// array(
// 'id' => 'combination_0',
// 'value' => 0,
// 'label' => $this->l('No')
// )
// ),
// 'hint' => $this->l('Choose "No" to disable Product Combinations.'),
// 'desc' => Combination::isCurrentlyUsed() ? $this->l('You cannot set this parameter to No when combinations are already used by some of your products') : null
// ),
array(
'type' => 'switch',
'label' => $this->l('Features'),

View File

@@ -19,7 +19,7 @@
<div id="filter_results" class="row block">
<div class="col-sm-12">
{if isset($config) && $config['SHOW_AMENITIES_FILTER']}
{if isset($config) && $config['PS_FEATURE_FEATURE_ACTIVE'] && $config['SHOW_AMENITIES_FILTER']}
<div class="row margin-lr-0 layered_filter_cont">
<div class="col-sm-12 layered_filter_heading">
<div class="row margin-lr-0">

View File

@@ -153,6 +153,7 @@ class wkhotelfilterblock extends Module
return array(
'SHOW_AMENITIES_FILTER' => Configuration::get('SHOW_AMENITIES_FILTER'),
'SHOW_PRICE_FILTER' => Configuration::get('SHOW_PRICE_FILTER'),
'PS_FEATURE_FEATURE_ACTIVE' => Configuration::get('PS_FEATURE_FEATURE_ACTIVE'),
);
}
}