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-sales
Controller
AbstractController
OrderLoader.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Sales\Controller\AbstractController
;
8
9
use
Magento\Framework\App\RequestInterface
;
10
use
Magento\Framework\Registry
;
11
use Magento\Framework\Controller\Result\ForwardFactory;
12
use
Magento\Framework\Controller\Result\RedirectFactory
;
13
14
class
OrderLoader
implements
OrderLoaderInterface
15
{
19
protected
$orderFactory
;
20
24
protected
$registry
;
25
29
protected
$orderAuthorization
;
30
34
protected
$url
;
35
39
protected
$resultForwardFactory
;
40
44
protected
$redirectFactory
;
45
54
public
function
__construct
(
55
\
Magento
\Sales\Model\OrderFactory
$orderFactory
,
56
OrderViewAuthorizationInterface
$orderAuthorization
,
57
Registry
$registry
,
58
\
Magento
\Framework\UrlInterface
$url
,
59
ForwardFactory
$resultForwardFactory
,
60
RedirectFactory
$redirectFactory
61
) {
62
$this->orderFactory =
$orderFactory
;
63
$this->orderAuthorization =
$orderAuthorization
;
64
$this->registry =
$registry
;
65
$this->url =
$url
;
66
$this->resultForwardFactory =
$resultForwardFactory
;
67
$this->redirectFactory =
$redirectFactory
;
68
}
69
74
public
function
load
(
RequestInterface
$request
)
75
{
76
$orderId = (int)
$request
->getParam(
'order_id'
);
77
if
(!$orderId) {
79
$resultForward = $this->resultForwardFactory->create();
80
return
$resultForward->forward(
'noroute'
);
81
}
82
83
$order
= $this->orderFactory->create()->load($orderId);
84
85
if
($this->orderAuthorization->canView(
$order
)) {
86
$this->registry->register(
'current_order'
,
$order
);
87
return
true
;
88
}
90
$resultRedirect = $this->redirectFactory->create();
91
return
$resultRedirect->setUrl($this->url->getUrl(
'*/*/history'
));
92
}
93
}
Magento\Sales\Controller\AbstractController\OrderLoaderInterface\load
load(RequestInterface $request)
$order
$order
Definition:
order.php:55
Magento\Sales\Controller\AbstractController\OrderLoader\$resultForwardFactory
$resultForwardFactory
Definition:
OrderLoader.php:39
Magento\Sales\Controller\AbstractController
Definition:
Creditmemo.php:7
Magento\Sales\Controller\AbstractController\OrderLoader\__construct
__construct(\Magento\Sales\Model\OrderFactory $orderFactory, OrderViewAuthorizationInterface $orderAuthorization, Registry $registry, \Magento\Framework\UrlInterface $url, ForwardFactory $resultForwardFactory, RedirectFactory $redirectFactory)
Definition:
OrderLoader.php:54
Magento\Sales\Controller\AbstractController\OrderLoaderInterface
Definition:
OrderLoaderInterface.php:15
Magento\Sales\Controller\AbstractController\OrderLoader\$redirectFactory
$redirectFactory
Definition:
OrderLoader.php:44
Magento\Framework\App\RequestInterface
Definition:
RequestInterface.php:14
Magento\Sales\Controller\AbstractController\OrderLoader\$url
$url
Definition:
OrderLoader.php:34
Magento\Framework\Controller\Result\RedirectFactory
Definition:
RedirectFactory.php:14
Magento\Sales\Controller\AbstractController\OrderViewAuthorizationInterface
Definition:
OrderViewAuthorizationInterface.php:13
Magento
$request
$request
Definition:
quote_with_configurable_product_last_variation.php:22
Magento\Sales\Controller\AbstractController\OrderLoader\$orderAuthorization
$orderAuthorization
Definition:
OrderLoader.php:29
Magento\Sales\Controller\AbstractController\OrderLoader\$orderFactory
$orderFactory
Definition:
OrderLoader.php:19
Magento\Framework\Registry
Definition:
Registry.php:18
Magento\Sales\Controller\AbstractController\OrderLoader\$registry
$registry
Definition:
OrderLoader.php:24
Magento\Sales\Controller\AbstractController\OrderLoader
Definition:
OrderLoader.php:14