44 $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
46 $resultRedirect->setPath(
'/');
47 return $resultRedirect;
53 if (!
$product->isVisibleInCatalog()) {
54 throw new NoSuchEntityException();
57 $model = $this->_objectManager->create(\
Magento\ProductAlert\Model\Price::class)
58 ->setCustomerId($this->customerSession->getCustomerId())
61 $this->_objectManager->get(\
Magento\Store\Model\StoreManagerInterface::class)
70 $this->messageManager->addSuccess(
__(
'You deleted the alert subscription.'));
71 }
catch (NoSuchEntityException $noEntityException) {
72 $this->messageManager->addError(
__(
"The product wasn't found. Verify the product and try again."));
73 $resultRedirect->setPath(
'customer/account/');
74 return $resultRedirect;
75 }
catch (\Exception $e) {
76 $this->messageManager->addException(
78 __(
"The alert subscription couldn't update at this time. Please try again later.")
81 $resultRedirect->setUrl(
$product->getProductUrl());
82 return $resultRedirect;
__construct(Context $context, CustomerSession $customerSession, ProductRepositoryInterface $productRepository)