1

enter image description hereI want to add custom column in pdf magento how i can add? And where the location to add custom column?

closed as unclear what you're asking by Piyush, liyakat, Manashvi Birla, Dhiren Vasoya, Marius Aug 10 '18 at 14:46

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

0

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;
  • i want to add in payemnt section and want to rewrite abstract class Mage_Sales_Model_Order_Pdf_Abstract is it possible – imtia Aug 10 '18 at 14:11
  • You cannot override abstract class. In your question you have asked that you need to column. Please explain in detail with screenshot in your question. – Sukumar Gorai Aug 10 '18 at 14:20
  • i have create column in my sales flat order table its name ref no its store any value now i want to show it in my pdf in payment method section after payment – imtia Aug 10 '18 at 14:40
  • Can you add any screenshot how would it looks? – Sukumar Gorai Aug 10 '18 at 14:41
  • done i want after there as i mentioned i color – imtia Aug 10 '18 at 14:44

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