Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-wishlist
Controller
Shared
Allcart.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Wishlist\Controller\Shared
;
7
8
use
Magento\Framework\App\Action\Context
;
9
use
Magento\Wishlist\Model\ItemCarrier
;
10
use
Magento\Framework\Controller\ResultFactory
;
11
12
class
Allcart
extends
\Magento\Framework\App\Action\Action
13
{
17
protected
$wishlistProvider
;
18
22
protected
$itemCarrier
;
23
29
public
function
__construct
(
30
Context
$context,
31
WishlistProvider
$wishlistProvider
,
32
ItemCarrier
$itemCarrier
33
) {
34
$this->wishlistProvider =
$wishlistProvider
;
35
$this->itemCarrier =
$itemCarrier
;
36
parent::__construct($context);
37
}
38
44
public
function
execute
()
45
{
46
$wishlist
= $this->wishlistProvider->getWishlist();
47
if
(!
$wishlist
) {
49
$resultForward = $this->resultFactory->create(
ResultFactory::TYPE_FORWARD
);
50
$resultForward->forward(
'noroute'
);
51
return
$resultForward;
52
}
53
$redirectUrl = $this->itemCarrier->moveAllToCart(
$wishlist
, $this->
getRequest
()->getParam(
'qty'
));
55
$resultRedirect = $this->resultFactory->create(
ResultFactory::TYPE_REDIRECT
);
56
$resultRedirect->setUrl($redirectUrl);
57
return
$resultRedirect;
58
}
59
}
Magento\Wishlist\Controller\Shared\Allcart
Definition:
Allcart.php:12
Magento\Framework\Controller\ResultFactory
Definition:
ResultFactory.php:17
Magento\Framework\App\Action\AbstractAction\getRequest
getRequest()
Definition:
AbstractAction.php:60
$wishlist
$wishlist
Definition:
wishlist.php:10
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Framework\Controller\ResultFactory\TYPE_FORWARD
const TYPE_FORWARD
Definition:
ResultFactory.php:25
Magento\Framework\Controller\ResultFactory\TYPE_REDIRECT
const TYPE_REDIRECT
Definition:
ResultFactory.php:24
Magento\Wishlist\Controller\Shared\Allcart\__construct
__construct(Context $context, WishlistProvider $wishlistProvider, ItemCarrier $itemCarrier)
Definition:
Allcart.php:29
Magento\Wishlist\Controller\Shared\WishlistProvider
Definition:
WishlistProvider.php:11
Magento\Wishlist\Controller\Shared\Allcart\$wishlistProvider
$wishlistProvider
Definition:
Allcart.php:17
Magento\Framework\App\Action\Context
Definition:
Context.php:24
Magento\Wishlist\Controller\Shared
Definition:
Allcart.php:6
Magento\Wishlist\Controller\Shared\Allcart\$itemCarrier
$itemCarrier
Definition:
Allcart.php:22
Magento\Wishlist\Model\ItemCarrier
Definition:
ItemCarrier.php:23
Magento\Framework\App\Action\Action
Definition:
Action.php:25