Questions about Payment Form extension

number of digits after the decimal sign

More
11 years 6 months ago #20314 by erik
In the confirmation page the amount 8.90 is shown as 8.9 Is there a way to change this to always have 2 digits after the decimal sign?

In the Netherlands we use a comma as the decimal sign. Can we set this somewhere?

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #20415 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: number of digits after the decimal sign
Hi erik

Yes. It is possible. However, you will have to edit the code (right now, the format number is not configurable in the extension). Basically, PHP now uses number_format function to format the number ( php.net/manual/en/function.number-format.php ). So in this case, you will need to search through the code , find number_format function and change it to meet your need.

Hope it gives you some clues !

Tuan

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #20446 by erik
Hi Tuan,

Can you be more specific as to where in the code this must be changed? In controller.php I can see the following 2 lines:

$results_arr[]= number_format($r->amount, 2);
$results_arr[]= number_format($r->discount_amount, 2);

changing this to:
$results_arr[]= number_format($r->amount, 2, ',', '.');
$results_arr[]= number_format($r->discount_amount, 2, ',', '.');

did not change the result

also changing the following line:
$results_arr[] = $value ;

into:
$results_arr[] = number_format($value, 2, ',', '.') ;

did not change the result

PHP version is 5.3.17

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc