How to add invoice pdf as a custom column? [closed]
-
21-01-2021 - |
Solution
Override the below file:
app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php
and copy the method insertOrder with code from
app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php
to your overridden Invoice.php
Then find the Payment Block and add your code there like below. Find the block:
foreach ($payment as $value){
if (trim($value) != '') {
//Printing "Payment Method" lines
$value = preg_replace('/<br[^>]*>/i', "\n", $value);
foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
$page->drawText(strip_tags(trim($_value)), $paymentLeft, $yPayments, 'UTF-8');
$yPayments -= 15;
}
}
}
and add the following code just after the above block:
$page->drawText(strip_tags('Custom Section'), $paymentLeft, $yPayments, 'UTF-8');
$yPayments -= 15;
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange