You are viewing an old revision of this post, from March 31, 2016 @ 14:59:37. See below for differences between this version and the current revision.

Magento – Get order detail from order id

Magento get order details : If you are working with magento order and looking for order details you can load order in two ways –

  • Order – Load By Increment Id
  • Order – Load By Entity Id

You can use either method to load order in magento. We are going to explain the magento order details with example.

Magento get order details

We will explain both methods to load order detials. Let us start one by one. First let us go with entity id ie. real order id –

Magento load order detail by Order Id (Entity id)

If you know real order id ie. entity id you can load order detail as below-

Load Order by Order Id :

 

1

2

3

$orderId = 111;

// this is entity id

$order = Mage::getModel('sales/order')->load($orderId);

Magento load order detail by Order Increment Id

If you know real order increment id you can load order detail as below-

Load Order by Increment Id :

 

1

2

3

$orderIncrementId = 223;

// this is entity id

$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);

Tip : You can get real order id from order increment id.

Magento get order items collection

Let us get order items collection from above order details-

Get Order Items Detail:

 

1

2

3

4

5

6

$orderItemsCollection = $order->getItemsCollection();

foreach $orderItemsCollection as $item){

    $productId = $item->Id();

    $productSku = $item->sku();

    $productName = $item->getName();

}

Magento get Order Id From Increment Id

You can get magento real order id from increment id as below-

Get Real Order Id From Increment Id:

 

1

2

3

4

//real order id ie. entity id

$orderId = Mage::getModel('sales/order')

             ->loadByIncrementId($incrementId)

             ->getEntityId();


 

 

-More Details From Order-

Let us have a look on other details from magento order –

 

 

 

 


Magento get Order Status

You can get order status in magento as below –

Get Order Status :

 

1

2

3

4

$orderId = 111;

// this is entity id

$order = Mage::getModel('sales/order')->load($orderId);

$status = $order->getStatusLabel();

Magento get Shipping And Billing Address From Order

You can get Shipping And Billing Address From Order in magento as below –

Get Shipping And Billing Address From Order :

 

1

2

3

4

5

$orderId = 111;

// this is entity id

$order = Mage::getModel('sales/order')->load($orderId);

$shippingAddress = $order->getShippingAddress();

$billingAddress = $order->getBillingAddress();

Magento get Shipping Method From Order

You can get Shipping Method from order in magento as below –

Get Shipping Method from Order:

 

1

2

3

4

$orderId = 111;

// this is entity id

$order = Mage::getModel('sales/order')->load($orderId);

$shippingMethod = $order->getShippingMethod();

Magento get Payment Method From Order

You can get Payment Method from order in magento as below –

Get Payment Method from Order:

 

1

2

3

4

$orderId = 111;

// this is entity id

$order = Mage::getModel('sales/order')->load($orderId);

$paymentMethod = $order->getPayment()->getMethodInstance()->getTitle();

Note : The above method will return payment method title. To get payment method code use $paymentMethod = $order->getPayment()->getMethodInstance()->getCode();

Revisions

  • March 31, 2016 @ 14:59:37 [Current Revision] by admin
  • March 31, 2016 @ 14:59:37 by admin
  • March 31, 2016 @ 14:58:50 by admin

Revision Differences

There are no differences between the March 31, 2016 @ 14:59:37 revision and the current revision. (Maybe only post meta information was changed.)

No comments yet.

Leave a Reply