Order line totals do not always add up

Description

The line totals in both the orders page in the admin panel and the customers order history do not add up properly.

This is due to the wrong function being used from the currencies class. ::display_price should be used rather than ::format.

To fix;

Open /catalog/templates/<template>/content/account_history_info.tpl.php

Find around line 123;
echo ' <td class="main" align="right" valign="top">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" .
Change to;
echo ' <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty'], $order->info['currency']) . '</td>' . "\n" .

Open /catalog/admin/orders.php

Starting around line 396 find;
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
Change to;
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->display_price($order->products[$i]['final_price'], 0, 1, $order->info['currency']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], 1, $order->info['currency']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->display_price($order->products[$i]['final_price'], 0, $order->products[$i]['qty'], $order->info['currency']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty'], $order->info['currency']) . '</b></td>' . "\n";

Environment

None

Steps to reproduce

None

Status

Assignee

Giles Marshall

Reporter

Scott Murphy

Labels

None

Severity

Minor

Components

Fix versions

Affects versions

v2.5.3

Priority

Configure