Esempio n. 1
0
 /**
  * Add all items from wishlist to shopping cart
  *
  * @return void
  */
 public function execute()
 {
     $wishlist = $this->wishlistProvider->getWishlist();
     if (!$wishlist) {
         $this->_forward('noroute');
         return;
     }
     $redirectUrl = $this->itemCarrier->moveAllToCart($wishlist, $this->getRequest()->getParam('qty'));
     $this->getResponse()->setRedirect($redirectUrl);
 }
Esempio n. 2
0
 /**
  * Shared wishlist view page
  *
  * @return void
  */
 public function execute()
 {
     $wishlist = $this->wishlistProvider->getWishlist();
     $customerId = $this->customerSession->getCustomerId();
     if ($wishlist && $wishlist->getCustomerId() && $wishlist->getCustomerId() == $customerId) {
         $this->getResponse()->setRedirect($this->_objectManager->get('Magento\\Wishlist\\Helper\\Data')->getListUrl($wishlist->getId()));
         return;
     }
     $this->registry->register('shared_wishlist', $wishlist);
     $this->_view->loadLayout();
     $this->_view->getLayout()->initMessages();
     $this->_view->renderLayout();
 }
Esempio n. 3
0
 /**
  * Add all items from wishlist to shopping cart
  *
  * @return \Magento\Framework\Controller\ResultInterface
  */
 public function execute()
 {
     $wishlist = $this->wishlistProvider->getWishlist();
     if (!$wishlist) {
         /** @var \Magento\Framework\Controller\Result\Forward $resultForward */
         $resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
         $resultForward->forward('noroute');
         return $resultForward;
     }
     $redirectUrl = $this->itemCarrier->moveAllToCart($wishlist, $this->getRequest()->getParam('qty'));
     /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
     $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
     $resultRedirect->setUrl($redirectUrl);
     return $resultRedirect;
 }
Esempio n. 4
0
 /**
  * Shared wishlist view page
  *
  * @return \Magento\Framework\Controller\ResultInterface
  */
 public function execute()
 {
     $wishlist = $this->wishlistProvider->getWishlist();
     $customerId = $this->customerSession->getCustomerId();
     if ($wishlist && $wishlist->getCustomerId() && $wishlist->getCustomerId() == $customerId) {
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
         $resultRedirect->setUrl($this->_objectManager->get('Magento\\Wishlist\\Helper\\Data')->getListUrl($wishlist->getId()));
         return $resultRedirect;
     }
     $this->registry->register('shared_wishlist', $wishlist);
     /** @var \Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
     return $resultPage;
 }