BillJ:
I just fixed this myself in 1.57c after seeing the rounding problem. The issue is that $currencies, which is a global, appears not to have been declared as global and therefore a local copy is used instead, which doesn't contain anything. I assume in previous Zen Cart versions it was declared global in some code that included the template (I've only previously tried it up to 1.55f so I can't comment on 1.56 versions).
The solution for me was to edit the template file includes/templates/YOUR_TEMPLATE/templates/tpl_modules_order_totals.php as follows.
Original:
<?php
/**
* Displays order-totals modules' output
*/
for ($i=0; $i<$size; $i++) { ?>
>
> to:
> ```
<?php
/**
* Displays order-totals modules' output
*/
global $currencies;
for ($i=0; $i<$size; $i++) { ?>
Having found and fixed the problem, however, I may now just delete the template override altogether as I think I prefer never to display the subtotal with VAT, even when showing prices inclusive of VAT to our UK customers. Including VAT in the subtotal and then showing the VAT on a separate line on the invoice prompts periodic queries from customers who think they have been charged VAT twice and haven't actually tried totting up the numbers to see that they haven't. I currently get around this by changing the "VAT: £x.xx" line to read "(Includes VAT £x.xx)" but it is conventional for the subtotal not to include VAT.
While this may have prevented the problem seen, it still doesn't look like the right solution or perhaps the problem is caused by something else.
The tpl_ files are expected to be in the global space. That means any variable referenced within them is expected to be in the global space. The $currencies variable when needed is routinely loaded either in the associated header_php.php file for the page or its main_template_vars like file. Having to declare $currencies as a global indicates that this template file is being loaded/run within some other code section like a function or class method. If that is the case, the function/class method really should ensure that the variable is brought into the current space rather than the file that is being called. Meaning, where global $currencies has been added, it should be within the out-of-scope code section that is calling this template file.
In other words would suggest using tools->developers tool kit to search for: tpl_modules_order_totals. I would suggest giving a few lines before/after so that might be able to tell when/where it is called within another function/class method and report the results.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...