Order totals block on Magento order email and invoice email templates

Wgenie picture Wgenie · Jul 1, 2011 · Viewed 20.4k times · Source

Can anyone point me to the templates/code blocks that are used for the order totals block on the Magento order mail and invoice e-mail templates?

The tax issue is solved but I need to implement some logic to get rid of the shipping and the subtotal. Which templates are used for the emails? I found the frontend and changed this as needed, but can't find the template/block that is used for the e-mails sent by the system.

Can anyone point me in the right direction?

Thanks, Bart

Answer

Jason picture Jason · Apr 4, 2012

Niels answer of app/design/frontend/base/default/template/sales/order/totals.phtml is correct however I thought some further clarification was in order because one doesn't merely make cosmetic changes to this file in order to effect the desired change. totals.phtml loops over the "totals", each of which produces a total-related line-item (Subtotal, Shipping & Handling, Tax, Grand Total (Excl. Tax), and Grand Total (Incl. Tax)). Your best bet is to use Mage::Log to output each of the totals (which are looped over via an associative array $_code => $total). If you log each key ($_code), you'll see names such as subtotal, shipping, grand_total, tax, and grand_total_incl. I filtered out those from the sales order e-mail that I didn't want by adding the following code directly below the foreach:

<?php if (in_array($_code, array('grand_total'))) { 
    continue;
} ?>

Hopefully this will help anybody who is puzzling over where these totals are mysteriously coming from. :-)