55 $this->_customerSession = $customerSession;
59 parent::__construct($context);
71 if (!$this->formKeyValidator->validate($this->getRequest())) {
72 return $resultRedirect->setPath(
'*/*/');
75 $productId = (int)$this->getRequest()->getParam(
'product');
77 $resultRedirect->setPath(
'*/');
78 return $resultRedirect;
83 }
catch (NoSuchEntityException $e) {
88 $this->messageManager->addError(
__(
'We can\'t specify a product.'));
89 $resultRedirect->setPath(
'*/');
90 return $resultRedirect;
94 $id = (int)$this->getRequest()->getParam(
'id');
96 $item = $this->_objectManager->create(\
Magento\Wishlist\Model\Item::class);
98 $wishlist = $this->wishlistProvider->getWishlist(
$item->getWishlistId());
100 $resultRedirect->setPath(
'*/');
101 return $resultRedirect;
104 $buyRequest = new \Magento\Framework\DataObject($this->getRequest()->getParams());
108 $this->_objectManager->get(\
Magento\Wishlist\Helper\Data::class)->calculate();
109 $this->_eventManager->dispatch(
110 'wishlist_update_item',
114 $this->_objectManager->get(\
Magento\Wishlist\Helper\Data::class)->calculate();
117 $this->messageManager->addSuccess(
$message);
118 }
catch (\
Magento\Framework\Exception\LocalizedException $e) {
119 $this->messageManager->addError($e->getMessage());
120 }
catch (\Exception $e) {
121 $this->messageManager->addError(
__(
'We can\'t update your Wish List right now.'));
122 $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
124 $resultRedirect->setPath(
'*/*', [
'wishlist_id' =>
$wishlist->getId()]);
125 return $resultRedirect;
foreach($product->getExtensionAttributes() ->getBundleProductOptions() as $option) $buyRequest
__construct(Action\Context $context, Session $customerSession, WishlistProviderInterface $wishlistProvider, ProductRepositoryInterface $productRepository, Validator $formKeyValidator)