1

I need to retrieve my custom column information from "sales_order_item" table. I'm having challenge to get the order id. How to get order id in order view page in admin panel?

I need $orderId in below code?

public function getOrderItemAgreementDeccription()

        {
           $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
           $_order = $objectManager->get('Magento\Sales\Model\Order\Item')->load($orderId);
           $getAgreementDeccription =  $_order->getAgreementDeccription();


        }

2 Answers 2

7

On Order view page in admin panel, you can get Order Id from URL like,

$orderId = $this->getRequest()->getParam('order_id');
2
  • RIGHT...I'd totally forgotten this ;)
    – Zinat
    Feb 10, 2017 at 9:55
  • Cool!! Thank you this works great! Just what I need. Thanks Oct 25, 2019 at 6:59
0

you can get order id by following param order_id as you can in url sales/order/view/order_id/2

$order_id= $this->getRequest()->getParam('order_id');

Your Answer

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

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