Magento – Change order of totals for emails and pdf invoices

email-templatesmagento-1.9pdftotals

I am having trouble changing the order of totals in sales emails and pdf-s

I have tried these thing I read on this forum:

1) Changed order of totals in admin side system->configuration->sales->checkout totals sort order
2)coping /app/code/core/Mage/Sales/etc/config.xml lo local and editing

No results though, what else to do?

update – I got the totals right in pdf-s
I guess the config.xml worked or smth
But the e-mails are still wrong

img to iilustrate what I am tryimg yo do

enter image description here

Best Answer

I found the solution here https://stackoverflow.com/questions/18362033/change-the-order-of-totals Hope it helps someone. These things fixed it for me:

1) Change order of totals in admin side system->configuration->sales->checkout totals sort order

2) copy /app/code/core/Mage/Sales/etc/config.xml lo local and edit and tags of children

3) Copy app/code/core/Mage/Sales/Block/Order/Totals.php to app/code/local/Mage/Sales/Block/Order/Totals.php

and edit getTotals function to be like this

public function getTotals($area=null)
{
        //Move tax below subtotal
        if($tax = $this->getTotal('tax'))
        {
        $this->removeTotal('tax');
        $this->addTotal($tax, 'subtotal');
        }       

        $totals = array();
        if ($area === null) {
        $totals = $this->_totals;
        } else {
        $area = (string)$area;
        foreach ($this->_totals as $total) {
            $totalArea = (string) $total->getArea();
            if ($totalArea == $area) {
                $totals[] = $total;
            }
        }
    }       
    return $totals;
}
Related Topic