Add 'Save and stay' button on missing pages at back office

This commit is contained in:
Abhishek Kumar
2024-01-16 17:09:13 +05:30
parent 1f9b7098e6
commit 87e45007bf
24 changed files with 299 additions and 32 deletions

View File

@@ -216,6 +216,16 @@ class AdminFeaturesControllerCore extends AdminController
'title' => $this->l('Save'),
);
$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);
return parent::renderForm();
}
@@ -544,9 +554,9 @@ class AdminFeaturesControllerCore extends AdminController
if ($this->table == 'feature_value' && ($this->display == 'edit' || $this->display == 'add')) {
$this->redirect_after = self::$currentIndex.'&addfeature_value&id_feature='.(int)Tools::getValue('id_feature').'&token='.$this->token;
} else {
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token;
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.(int) $object->id.'&conf=3&update'.$this->table.'&token='.$this->token;
}
} elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && count($this->errors)) {
} elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && count($this->errors) && $this->table == 'feature_value') { // enter only if feature is submitted
$this->display = 'editFeatureValue';
}
@@ -562,7 +572,7 @@ class AdminFeaturesControllerCore extends AdminController
$object = parent::processUpdate();
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) {
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token;
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.(int) Tools::getValue('id_feature').'&conf=4&update'.$this->table.'&token='.$this->token;
}
return $object;