In the customer account order view page, I added a Block and an associated phtml file. Inside this phtml, I would like to load the order to access some information.
NB: the block is added dynamically and not using XML
I tried in my block :
protected $_order;
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Sales\Api\Data\OrderInterface $order
)
{
$this->_order = $order;
parent::__construct($context);
}
and in my pthml :
$order = $block->_order->load($data['order_id']);
but it results in an error.
If someone could give me a hand, please?