46 $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
48 $resultRedirect->setPath(
'/');
49 return $resultRedirect;
56 $model = $this->_objectManager->create(\
Magento\ProductAlert\Model\Stock::class)
57 ->setCustomerId($this->customerSession->getCustomerId())
60 $this->_objectManager->get(\
Magento\Store\Model\StoreManagerInterface::class)
65 $this->messageManager->addSuccess(
__(
'Alert subscription has been saved.'));
66 }
catch (NoSuchEntityException $noEntityException) {
67 $this->messageManager->addError(
__(
'There are not enough parameters.'));
68 $resultRedirect->setUrl($backUrl);
69 return $resultRedirect;
70 }
catch (\Exception $e) {
71 $this->messageManager->addException(
73 __(
"The alert subscription couldn't update at this time. Please try again later.")
76 $resultRedirect->setUrl($this->
_redirect->getRedirectUrl());
77 return $resultRedirect;
_redirect($path, $arguments=[])
const PARAM_NAME_URL_ENCODED
__construct(Context $context, CustomerSession $customerSession, ProductRepositoryInterface $productRepository)