I want to get the customer order details in a custom controller in Magento2. I have created following directory structure and a basic controller.
I have also registered it by following command.
php bin/magento setup:upgrade
.
app
code
Muk
Frontcontrollerpage
Block
Controller
Index
Index.php
etc
view
registration.php
I have following code in Index.php
<?php
namespace Muk\Frontcontrollerpage\Controller\Index;
class Index extends \Magento\Framework\App\Action\Action
{
protected $resultPageFactory;
/**
* @param \Magento\Framework\App\Action\Context $context
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
)
{
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
return $this->resultPageFactory->create(); // How do I get customer order detail(total, items (sku, item_id, price)) using the order Id?
}
}
How do I get customer order detail(total, items (sku, item_id, price)) using the order Id?