title: Get Order Increment Id in Magento
body: <p>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.</p>
  
  <p>I'm using the following code, but it is giving an error on the second line;</p>
  
  <pre><code>$order = Mage::getSingleton('sales/order')-&gt;getLastOrderId();
  $lastOrderId = $order-&gt;getIncrementId();
  </code></pre>
  
  <p>The error reads:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function getIncrementId() on a non-object on line 34: $LastOrderId = $order->getIncrementId();</p>
  </blockquote>
  
  <p>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</p>