0

I have enabled Cash on Delivery with a new extension. but the Fee doesn't show on the PDF invoice.

how can I make it shown on it? Magento 1.9

I have added new extension for the COD because the default COD from Magento doesn't have fee.

0

To display COD fee you need to add below tag in your module config.xml under <global> tag

        <pdf>
            <totals>
                <custom_cashondelivery translate="title">
                    <title>Cash on Delivery fee</title>
                    <source_field>cod_fee</source_field>
                    <font_size>7</font_size>
                    <display_zero>0</display_zero>
                    <sort_order>450</sort_order>
                    <model>modulename_cashondelivery/sales_pdf_cod</model>
                </custom_cashondelivery>
            </totals>
        </pdf>

Where <source_field> is your custom attribute which you are saving COD fee value.

Now you need to create a model file for that which should extend Mage_Sales_Model_Order_Pdf_Total_Default

In this class

class Modulename_CashOnDelivery_Model_Sales_Pdf_Cod extends Mage_Sales_Model_Order_Pdf_Total_Default
{

    public function getTotalsForDisplay()
    {
        $amount        = $this->getOrder()->formatPriceTxt($this->getAmount());
        $fontSize      = $this->getFontSize() ? $this->getFontSize() : 7;
        $helper        = Mage::helper('core');
            $totals = array(
                array(
                    'amount'    => $this->getAmountPrefix().$amount,
                    'label'     => $helper->__($this->getTitle()) . ':',
                    'font_size' => $fontSize
                )
            );
        return $totals;
    }
}

Also, rather than creating a new module for this you can use this free module which fulfills your requirements

  • Hi, unfortunately, this doesn't work :( I do exactly like that and also use the module you sent and nothing work this is what I add to config.xml prntscr.com/i06t2h – muzramn Jan 14 '18 at 7:28
  • Please Install this module, It works without any problem I am using this module since long time for my client @muzramn – Keyur Shah Jan 14 '18 at 9:14
  • I do install it but the fee doesn't show on the PDF invoice. it's calculated right but it isn't shown to the customer. – muzramn Jan 14 '18 at 10:27

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.