Reihenfolge der Beträge in Magento

With a little programming effort, you can get Magento to change the order in which amounts are displayed during the checkout process, in the shopping cart, and in the breakdown included in sent emails—here using taxes as an example, which we want to move below the grand total (changing the order in the admin area under System->Configuration->SALES->Sales->"Sort Order of Address Total Segments" does not produce the desired result here):



1) In the Magento backend:
System->Configuration->SALES->Tax->"Shopping Cart Display Settings"->"Include Tax In Grand Total"
and
System->Configuration->SALES->Tax->"Orders, Invoices, Credit Memos Display Settings"->"Include Tax In Grand Total"
set to "yes".

2) Comment out the grand total excluding VAT and move the tax display below the grand total including VAT in \app\design\frontend\TEMPLATENAME\default\template\tax\checkout\grandtotal.phtml:

The following section is commented out, changing it from
<tr>
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
<strong><?php echo $this->helper('tax')->__('Grand Total Excl. Tax')?></strong>
</td>
<td style="<?php echo $this->getStyle() ?>" class="a-right">
<strong><?php echo $this->helper('checkout')->formatPrice($this->getTotalExclTax()) ?></strong>
</td>
</tr>

to
<?php /*
<tr>
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
<strong><?php echo $this->helper('tax')->__('Grand Total Excl. Tax')?></strong>
</td>
<td style="<?php echo $this->getStyle() ?>" class="a-right">
<strong><?php echo $this->helper('checkout')->formatPrice($this->getTotalExclTax()) ?></strong>
</td>
</tr> */
?>

We move the tax display so that the following code section
<?php echo $this->renderTotals('taxes', $this->getColspan()); ?>
<tr>
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
<strong><?php echo $this->helper('tax')->__('Grand Total')?></strong>
</td>
<td style="<?php echo $this->getStyle() ?>" class="a-right">
<strong><?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?></strong>
</td>
</tr>

is replaced with
<tr>
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
<strong><?php echo $this->helper('tax')->__('Grand Total')?></strong>
</td>
<td style="<?php echo $this->getStyle() ?>" class="a-right">
<strong><?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?></strong>
</td>
</tr>
<?php echo $this->renderTotals('taxes', $this->getColspan()); ?>

3) If, instead of "Tax", you want to use something like "Tax (19% of €19.38)", for example, you can modify the file \app\design\frontend\TEMPLATENAME\default\template\tax\checkout\tax.phtml.

4) We are not quite finished yet, because the changes made so far only affect the shopping cart and checkout. To adjust the order confirmation, we therefore also need to work on the file \app\design\frontend\TEMPLATENAME\default\template\sales\order\totals.phtml. By implementing the following if loop

<?php if ($_code != "grand_total" && $_code != "tax") { ?>

we prevent the grand total excluding tax and the tax itself from being output. The tax is then output, for example, by repeating the foreach loop with the restriction

<?php if ($_code == "tax") { ?>

.

5) If you also want to change the label "Tax" in the order confirmation email sent by Magento (see point 3), you can do this in the file \app\design\frontend\TEMPLATENAME\default\template\tax\order\tax.phtml.

6) Done.

... back to the blog