In magento admin dashboard, the order id displayed is of the form #10001011. In the URL, I can see something similar to


Note that order_id is 17 in the URL. How do I get that ID? what function in magento that will return the actual system id 17? I am trying to do some adjustment to an extension and for some reason it is using 17 instead of #10001011 to generate a download URL for the order.

  • Has this answered your question? if so, please accept an answer so the question can be closed. If not, please provide more information. Thanks. – Zeke Farwell Jan 12 '17 at 19:58

Like most entities in Magento, orders have two types of unique identifiers. There is the increment_id which is displayed to users as the Order ID and there is the entity_id also simply called ID. This entity_id is what you're seeing in the url. It is the primary key of the sales_flat_order table and generally used as the internal, private id.

$order->getId() should get you the internal entity_id, and $order->getIncrementId() should get you the Order ID you see in the Admin.


Order_id is the internal Magento order ID

Order increment ID is the ID which you communicate to your customer

To get what you want:

$order = Mage::getModel('sales/order')->load($orderid);
$Incrementid = $order->getIncrementId();

You can obtain the value from the URL through getRequest(). In this case:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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