Magento – How to Get Order Details by Invoice ID

gridinvoice

how to get order deatils by invoice id?
I need to search order details by invoice id. Where to change this one?

Best Answer

$invoice = Mage::getModel('sales/order_invoice')->load($id);
//or if you have the long increment id: `100000401`
//$invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId($id);

$order = $invoice->getOrder();

Then you can access the order data from the $order variable.