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.

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

1 Answer 1

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
  • 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
    Commented May 23, 2014 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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