Home » Tutorials For Beginner » How to Get Order Details by Order Id

How to Get Order Details by Order Id

In this tutorial, we will go through how to get Order Details by Order Id

Getting the Order Details depends on a few elements:

  1. Order Number
  2. Type of the Order (Simple vs Configurable, Invisible etc.)
  3. The Info you want to Extract (Pricing vs Other information)

To load an order by increment id one would do:

To load by entity id you would just call  load :
Load your Order: (db: sales_flat_order)

Next, Filter your Collection of Items based on the Order.

What most will do is: (db: sales_flat_order_item)

Which will show the visible products. The problem with this is, that it will get the “configurable” item from the collection (which strangely has the child’s sku in the record). I find this to be unpredictable in the case of SKU changes as the historical SKU is no longer present. Instead, I find it better to do an alternative approach as follows.

  • getItemsCollection() will actually return the Parent and the Child, confusing for most. Lets focus on the child.
  • Traditionally, the Parent (ie.Configurable) will have the pricing information, where the child (simple) will not. With the Child (simple product) we’re able to determine if there is a parent_id (but not the reverse) and we’re able to also grab product information from entity_id (not the reverse) as from getAllVisibleItems().
  • iterate through the collection of order items

About Brian Wilson

Brian is a freelance Magento developer with 5 years of experience with customizing Magento extensions, magento themes. He's interested in sharing Magento Tutorials to the community

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Scroll To Top