1

When I activate coupon code on my webshop, create an order, and generate PDF invoice, bsed on my configuration settings I get totals like:

Price of the product Excl tax 
Price of the product Incl tax 
Price for shipping Excl tax 
Price for shipping Incl tax 
Tax for product 
Tax for shipping 
Tax 
Grand total 

What I need now is to display two more stuffs on the totals: 1) Price of the product with included discount (Excl tax) 2) Price of the product with included discount (Incl tax)

Is there a way to call this two values from my order on PDF invoice totals?

2

There is a discount_amount total type in the config, and you can inject custom totals using some configuration XML (and a custom totals renderer if there isn't one):

Mage/Sales/etc/config.xml:

<global>
    <pdf>
        <invoice>
            <!-- ... -->
            <discount translate="title">
                <title>Discount</title>
                <source_field>discount_amount</source_field>
                <amount_prefix>-</amount_prefix>
                <font_size>7</font_size>
                <display_zero>0</display_zero>
                <sort_order>200</sort_order>
            </discount>

You can follow this pattern to implement your own total type, and if you specify a <model> node that class will be used to calculate/generate the output. These totals nodes are parsed in Mage_Sales_Model_Order_Pdf_Abstract::_getTotalsList(). Note that these are for order totals, not for individual item lines. Individual line items are parsed from the same area of config:

Mage/Sales/etc/config.xml:

<global>
    <pdf>
        <invoice>
            <default>sales/order_pdf_items_invoice_default</default>
            <grouped>sales/order_pdf_items_invoice_grouped</grouped>
        </invoice>
        <!-- ... -->

So, it's possible to override the original via config or to do a standard Magento class rewrite to generate the content you need.

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.