1

I am using Magento 1.7. If a coupon code is used I am trying to include it in the PDF invoice. I have been trying the suggestions in this thread http://www.magentocommerce.com/boards/viewthread/56110/ changing app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php however any changes I make to this file do not appear to do anything to the generated PDF. I also tried overriding it in app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php and making any changes to this file did not make any difference.

Any suggestions much appreciated, I have spent a long time trying to find answers.

edit

Added this

 /* print coupon code on invoice */
 if($order->getCouponCode()!=""){
    $this->y -= 12;
    $page->drawText('Code: '.$order->getCouponCode(), 450, $this->y, 'UTF-8');
 }

  /* print gift certificate code on invoice */
  if($order->getGiftcertCode()!=""){
     $this->y -= 12;
     $page->drawText('Code: '.$order->getGiftcertCode(), 450, $this->y, 'UTF-8');
  }

In app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.pdf before $this->insertTotals($page, $invoice) on line 149.

  • could you show us code which you have try – MeenakshiSundaram R May 23 '14 at 9:24
  • done, also tried tests such as $page->drawText('test', 450, $this->y, 'UTF-8'); outside the if statements – Alex May 23 '14 at 10:04
0

I think you have any extension installed which does the PDF rendering for you rather instead of the touched file? just throw a die('test') into the file and you will know.

Beside of this I can recommend Firegento_Pdf which offers a great event for exactly this:

https://github.com/firegento/firegento-pdf/wiki/FAQs#how-can-i-add-notes-to-the-pdfs-programmatically

  • 1
    Thanks you are right, someone created an override PdfInvoice.php but not in the same folder you would expected the overrides to go in, going to try changing this file now – Alex May 23 '14 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.