1

I have developed a block and placed at order details page, and wanna get the order information but cannot use query_string

http://127.0.0.1/Magento2EE/sales/order/view/order_id/3/

I can get the order no. from query_string: $this->getRequest()->getParam('order_id');

For security issue I cannot use this method -> pass by query_string.

So, I try to use $this->getOrder()->getOrderId();

but system retured error:

Fatal error: Call to a member function getOrderId() on null

1 Answer 1

1

First,You need to check ,the order is exit or not by below code:

if($this->getOrder()->getId()):
 $orderId=$this->getOrder()->getId();
 $IncrementId=$this->getOrder()->getIncreamentId();

endif;

getOrderId() is not right method to get order id

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.