Magento – Customization of total order and additional infos

carttemplatetotals

When want to have the following style of totals on checkout/cart:

  1. Discount
  2. Subtotal
  3. Shipping fee OR Info Text: "excl. shipping"
  4. Additional text: "free shipping from 30EUR" (display always)
  5. Grand total
  6. incl. Tax

Problems

  1. Even if we set "Checkout Totals Sort Order" in the backend correctly, the grand total is always displayed at the end
  2. How to put any additional info blocks between the totals?
  3. How to display an info text, if one total is not present (shipping)

Best Answer

partial answer

1. Order in Backend does not fully affect rendering

  • The totals are rendered by an "area".
  • The grand total is in the area "footer". See template\checkout\cart\totals.phtml.
  • Passing -1 to renderTotals() renders all areas.

So you have to remove $this->renderTotals('footer'); and change
$this->renderTotals(); to $this->renderTotals(-1);

Example (after copying totals.phtml to your own theme):

<table id="shopping-cart-totals-table">
    <col />
    <col width="1" />
    <tbody>
        <?php echo $this->renderTotals(-1); ?>
    </tbody>
</table>

After this change, the order configured in the back-end works as expected.

Related Topic