diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 1ef381eb3..b9846ee6c 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -1766,7 +1766,10 @@ class AdminControllerCore extends Controller if ($this->tabAccess['edit'] === '1') { $this->action = 'save'; - $this->display = 'edit'; + if (Tools::getValue('submitAdd'.$this->table.'AndStay')) + $this->display = 'edit'; + else + $this->display = 'list'; } else $this->errors[] = Tools::displayError('You do not have permission to edit here.'); @@ -1777,7 +1780,10 @@ class AdminControllerCore extends Controller if ($this->tabAccess['add'] === '1') { $this->action = 'save'; - $this->display = 'edit'; + if (Tools::getValue('submitAdd'.$this->table.'AndStay')) + $this->display = 'edit'; + else + $this->display = 'list'; } else $this->errors[] = Tools::displayError('You do not have permission to add here.'); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 264d3fba1..92d07397f 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -997,7 +997,6 @@ class AdminProductsControllerCore extends AdminController // And if still not set, use default if (!$this->tab_display) $this->tab_display = $this->default_tab; - } /** @@ -1435,7 +1434,7 @@ class AdminProductsControllerCore extends AdminController .'&token='.($token ? $token : $this->token); // Save and stay on same form - if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) + if ($this->display == 'edit') $this->redirect_after = self::$currentIndex.'&id_product='.(int)$this->object->id .(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '') .'&addproduct&conf=3&key_tab='.Tools::safeOutput(Tools::getValue('key_tab')).'&token='.($token ? $token : $this->token); @@ -1481,7 +1480,7 @@ class AdminProductsControllerCore extends AdminController $this->processWarehouses($token); $this->processFeatures($token); $this->processProductAttribute($token); -//d($this->redirect_after); + if (!$this->updatePackItems($object)) $this->errors[] = Tools::displayError('An error occurred while adding products to the pack.'); elseif (!$object->updateCategories(Tools::getValue('categoryBox'), true)) @@ -1513,7 +1512,7 @@ class AdminProductsControllerCore extends AdminController else { // Save and stay on same form - if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) + if ($this->display == 'edit') $this->confirmations[] = $this->l('Update successful'); else // Default behavior (save and back)