Is it possible to have different Invoice types in Magento for different payment methods? is there a easy way to setup this?

I.e. I would like to have one invoice template for Invoices that have been generated by orders complted with creditcard payments, and other Invoice template for invoices that have been generated by orders completed with cash on delivery payment?

  • What should be different about the two? Design, data, or both? – benmarks May 29 '13 at 11:15
  • Data. I am using one extension to retrive some sort of special code, and I need that on just one invoice type. (For one sort of orders, completed with creditcard payments). – xul May 29 '13 at 14:33

You should (need to) rewrite the Mage_Sales_Model_Order_Pdf_Invoice class using Magento's config-based class rewrites. This will allow you to implement the logic which you require, and if you extend your class from the Mage_Sales_Model_Order_Pdf_Invoice class you will make future upgrades easy.

Where this can get a little sticky is in the absolute dimensions which the Zend_Pdf component uses. Hopefully your display needs can be accommodated by finding some existing space in the stock invoice PDF where you can conditionally draw your value.

This free community extension makes working with the PDF classes easier (besides offering a nicer default layout): https://github.com/firegento/firegento-pdf (or on Magento Connect)

| improve this answer | |

Every Payment method Mage_Payment_Model_Method_Abstract does have an info block type:

protected $_infoBlockType = 'payment/info';

this block is somehow rendererd into the invoice. So if you check this block and fill it with the infos you want you might reach your goal

/* Payment */
// /app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php:316
    $paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())
| improve this answer | |

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.