/** * Don't actually redirect if we've got AJAX request - return redirect URL instead. * * @param string $path * @param array $arguments * @return $this|\Magento\Backend\App\AbstractAction */ protected function _redirect($path, $arguments = []) { if ($this->getRequest()->isXmlHttpRequest()) { $this->getResponse()->representJson($this->jsonHelper->jsonEncode(['_redirect' => $this->getUrl($path, $arguments)])); return $this; } else { return parent::_redirect($path, $arguments); } }
/** * Clears global messages session to prevent duplicate * @inheritdoc */ protected function _redirect($path, $arguments = []) { $this->messageManager->getMessages(true, self::GLOBAL_MESSAGES_GROUP); return parent::_redirect($path, $arguments); }