|
Monday, 21 February 2011 15:51 |
|
One of my clients recently requested adding any applied coupon codes or gift certificate codes to the invoice printed from Magento. This is actually a pretty quick and easy change. Below are the steps required to implement this change in Magento 1.4.1.1.
- Copy
/app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php to /app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php
- Find the line $page = $this->insertTotals($page, $invoice); in the getPdf function. This was line 107 for me.
- Add the following:
/* added by Wright Creative Labs */ /* print coupon code on invoice */ if($order->getCouponCode()!=""){ $this->y -=12; $page->drawText('Coupon Used: '.$order->getCouponCode(), 450, $this->y, 'UTF-8'); } /* print gift certificate code on invoice */ if($order->getGiftcertCode()!=""){ $this->y -=12; $page->drawText('Coupon Used: '.$order->getGiftcertCode(), 450, $this->y, 'UTF-8'); }
- Save.
- That's it! Go to the backend to test it out... Sales > Invoices and then try to print an invoice with a coupon code or gift certificate.
|