Sunday, March 25

How to print coupon code and gift certificate on magento Invoice PDF

In this article we will see how to print the coupon code and gift certificate while invoice the magento order

here is the complete step by step procedure

Step 1 : Copy /app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php to /app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php

Step 2 : Find the line $page = $this->insertTotals($page, $invoice); in the getPdf function. This was line 107 for me.

Step 3 : Add the following in the above and save the file
/* 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');    
}

thats it. now you can able to print the coupon and gift certificate in backend sales order.

No comments:

Post a Comment