Updated: Admin Customer Prefrences to display and save the general and KPI configuration seperately

This commit is contained in:
vishalsingh.qlo325
2024-05-09 15:17:41 +05:30
parent 8dcfc9e892
commit bdca200bc2

View File

@@ -50,9 +50,9 @@ class AdminCustomerPreferencesControllerCore extends AdminController
$this->fields_options = array(
'general' => array(
'title' => $this->l('General'),
'icon' => 'icon-cogs',
'fields' => array(
'title' => $this->l('General'),
'icon' => 'icon-cogs',
'fields' => array(
'PS_REGISTRATION_PROCESS_TYPE' => array(
'title' => $this->l('Registration process type'),
'hint' => $this->l('The "Only account creation" registration option allows the customer to register faster, and create his/her address later.'),
@@ -121,6 +121,16 @@ class AdminCustomerPreferencesControllerCore extends AdminController
'cast' => 'intval',
'type' => 'bool'
),
),
'submit' => array(
'title' => $this->l('Save'),
'name' => 'submitCustomerGeneralConfig'
),
),
'customer_kpi' => array(
'title' => $this->l('Customer KPI configuration'),
'icon' => 'icon-cogs',
'fields' => array(
'PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS' => array(
'title' => $this->l('Number of orders to use to calculate frequent customers'),
'hint' => $this->l('Set the number of orders to use to calculate frequent customers.'),
@@ -157,11 +167,31 @@ class AdminCustomerPreferencesControllerCore extends AdminController
'class' => 'fixed-width-xl',
),
),
'submit' => array('title' => $this->l('Save')),
),
'submit' => array(
'title' => $this->l('Save'),
'name' => 'submitCustomerKpiConfig'
),
)
);
}
public function postProcess()
{
// using this to separate the saving process for the both option fields
$fields = $this->fields_options;
if (Tools::isSubmit('submitCustomerKpiConfig')) {
unset($this->fields_options['general']);
$this->processUpdateOptions();
} else if (Tools::isSubmit('submitCustomerGeneralConfig')) {
unset($this->fields_options['customer_kpi']);
$this->processUpdateOptions();
}
$this->fields_options = $fields;
return parent::postProcess();
}
/**
* Update PS_B2B_ENABLE and enables / disables the associated tabs
* @param $value integer Value of option