Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace MyTrackorderControllerIndex;
- use MagentoFrameworkAppActionContext;
- class Result extends MagentoFrameworkAppActionAction
- {
- protected $resultFactory;
- protected $orderRepository;
- private $orderFactory;
- public function __construct(Context $context,
- MagentoSalesModelOrderFactory $orderFactory,
- MagentoFrameworkJsonHelperData $jsonHelper,
- MagentoSalesApiOrderRepositoryInterface $orderRepository,
- MagentoFrameworkViewResultPageFactory $resultFactory
- )
- {
- $this->jsonHelper = $jsonHelper;
- $this->resultFactory = $resultFactory;
- $this->orderRepository = $orderRepository;
- $this->orderFactory = $orderFactory;
- parent::__construct($context);
- }
- public function execute()
- {
- $order_id = $this->getRequest()->getParam('order_id');
- $order = $this->orderFactory->create();
- $order->loadByIncrementId($order_id);
- $product = $order->getAllVisibleItems();
- private $orderFactory;
- public function __construct(
- ...
- MagentoSalesModelOrder $orderFactory,
- ...
- ) {
- ...
- $this->orderFactory = $orderFactory;
- ...
- }
- public function execute()
- {
- $order_id = $this->getRequest()->getParam('order_id');
- $order = $this->orderFactory->loadByIncrementId($order_id);
- //$orderItems = $order->getAllItems();
- $orderItems = $order->getAllVisibleItems();
- foreach ($orderItems as $item) {
- // var_dump($item->getData());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement