I need to replace the invoice id to order id on my invoice PDF (see image). Spent a few hours researching without finding a proper guide on getting started with customising magento's PDF :/ and explored a few extensions but i really don't wanna add an extension for this. So any help would be greatly appreciated.
1 Answer
The most simple way to do this is to overwrite the core PDF model for invoices.
First copy the file
app\code\core\Mage\Sales\Model\Order\Pdf\Invoice.php
to
app\code\local\Mage\Sales\Model\Order\Pdf\Invoice.php
Now open the new file and replace the following line
Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
with
Mage::helper('sales')->__('Order # ') . $order->getId()
-
that worked ! now just a small problem, i get the order nr but only the last digits, so the order nr is 100002612 and in the pdf it only shows 2612, its not a huge problem but it would help to get the full number any ide how to fix that ? Dec 2, 2015 at 19:42
-
1Never mind i figured it out i just replaced
getId()
withgetIncrementId()
Dec 3, 2015 at 0:35