Does anyone have a quick and dirty explanation of the differences?
I generally would use
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
getLastRealOrderId => the increment ID (the order # shown to a customer after checkout.
getLastOrderId => the entity ID of the order in the database.
getLastRealOrderId are magic methods, meaning they're getters for the properties
last_order_id. They are set on the checkout session during a successful order placement by
The two data properties are set in tandem once the order is successful. -
getLastRealOrderId was introduced in Magento 1.8 CE on the checkout session along with the previously available
getLastOrderId because it would require another model load (e.g. another database query) get get the increment id, which is usually what you want, if you wanted access to that information to display on the site or use in code.
By setting it on the checkout session directly, when it's available, after a successful order they prevent a developer from writing code which may adversely affect performance.
You can get Order entity id from following line:
You can get Order Increment Id from following line:
For more clarification go to app/code/core/Mage/Checkout/Model/Type/Onepage.php
// add order information to the session $this->_checkoutSession->setLastOrderId($order->getId()) ->setRedirectUrl($redirectUrl) ->setLastRealOrderId($order->getIncrementId());