I'm trying to get the Order Increment Id in Magento, on the success.phtml page so that I can use this for affiliate tracking.
I'm using the following code, but it is giving an error on the second line;
$order = Mage::getSingleton('sales/order')->getLastOrderId();
$lastOrderId = $order->getIncrementId();
The error reads:
Fatal error: Call to a member function getIncrementId() on a non-object on line 34: $LastOrderId = $order->getIncrementId();
I was wondering if anyone has any ideas on how to get the Order Increment Id? This is the reference number seen in the admin, usually something like: #1000123