Magento 1.8 – Understanding Order ID and Order Increment ID

event-observermagento-1.8orders

I am bit confused with order id and order increment id, So can any one help me to understand the difference between these two?

I have an observer for sales_order_place_after where I store sales details in a custom table.

But with

$orderId = $observer->getEvent()->getOrder()->getId();

I get the order ids as normal ids like 112 or 113 or 110 etc not like 20001201

So which is the real order id, 20001201 or 112?

I need to further process order data based on this order id, I use 112, 113 etc. and it works, but I need to clarify this.

Best Answer

The difference is:

  • order_id is the internal Magento order ID
  • order increment ID is the ID which you communicate to your customer

You can easily load an order using the internal order_id:

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

PS: If you need it, you can easily get the increment ID from a loaded order:

$order->getIncrementId();