56 if (strpos(
$url,
'http') ===
false) {
61 || strpos(
$url,
$currentStore->getBaseUrl(UrlInterface::URL_TYPE_LINK,
true)) === 0;
72 $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
74 $resultRedirect->setPath(
'/');
75 return $resultRedirect;
82 $model = $this->_objectManager->create(\
Magento\ProductAlert\Model\Price::class)
83 ->setCustomerId($this->customerSession->getCustomerId())
85 ->setPrice(
$product->getFinalPrice())
87 $this->_objectManager->get(\
Magento\Store\Model\StoreManagerInterface::class)
92 $this->messageManager->addSuccess(
__(
'You saved the alert subscription.'));
93 }
catch (NoSuchEntityException $noEntityException) {
94 $this->messageManager->addError(
__(
'There are not enough parameters.'));
96 $resultRedirect->setUrl($backUrl);
98 $resultRedirect->setPath(
'/');
100 return $resultRedirect;
101 }
catch (\Exception $e) {
102 $this->messageManager->addException(
104 __(
"The alert subscription couldn't update at this time. Please try again later.")
107 $resultRedirect->setUrl($this->
_redirect->getRedirectUrl());
108 return $resultRedirect;
_redirect($path, $arguments=[])
const PARAM_NAME_URL_ENCODED
__construct(Context $context, CustomerSession $customerSession, StoreManagerInterface $storeManager, ProductRepositoryInterface $productRepository)