
Originally Posted by
breadfan
I need to round the Total price to .50. I will simply double the number, round it and then divide it by 2. It will give me the value I need. But I don't know where to place the code. I assume to put it to ot_total module, but I have no idea where and what. ... I just need to modify the final total price so that instead of 1234.61 I'll get 1234.50.

Originally Posted by
breadfan
I want it to be rounded in the last step, just before the last confirmation "click". As I said, it is completly normal in Slovak Republic to have the Total Price rounded to .50 whereever you use coins and banks. And since our customers can choose to pay in cash, they must have the possibility of paying in .50 "units", because there are no smaller coins to pay with.
I have no idea what other implications this will have elsewhere in the system, and whether any other calculations will be adversely affected, but this seems to work on a very simple checkout with a single taxable product without coupons or sales or discounts applied:
ot_total.php
change this:
Code:
function process() {
global $order, $currencies;
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']),
'value' => $order->info['total']);
}
to this, by adding 2 new lines, as shown:
Code:
function process() {
global $order, $currencies;
$val = $order->info['total'];
$order->info['total'] = (round($val * 2) / 2);
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']),
'value' => $order->info['total']);
}