Top Menu

Trouble with decimal separator

02 Feb 2016 13:44 #436 by Prokop

Thanks for an great extension.

Unfortunately, we have trouble updating prices with decimals in the latest 2 releases.

If we attempt to write a decimal number with comma or stop signs, the auto sale price goes nuts.

In short, it is not possible for me to input decimals as the systems neither likes comma nor stop sign separators. When an override is involved, it gets even more difficult.

I made this video to illustrate:

02 Feb 2016 18:22 #437 by Super User

open wooc.php file , find this line:

$_num_sample = (1/2).'';

and replace it with :

$_num_sample = '0.0';
05 Feb 2016 12:13 #439 by Prokop

I have no "wooc.php" on my system. I run Virtuemart. Could you provide me a similar fix for VM ?

05 Feb 2016 13:14 #440 by Super User
Did you maybe activated German numbers option ? If yes turn it off.

If that is ok look for function:

function Getfloat($str) {
global $SETTINGS;
if(strstr($str, ".")) {
$str = str_replace(".", "", $str); // replace ',' with '.'
$str = str_replace(",", ".", $str);
if(strstr($str, ",")) {
$str = str_replace(",", "", $str); // replace ',' with '.'
return floatval($str);

modify it like this:

function Getfloat($str) {

return floatval($str);
15 Feb 2016 13:15 #452 by Prokop

I do not understand what German numbers are or where to find that setting. Is it Virtuemart configuration ?

I searched my way to find the code you mentioned in vmexcellikeinput.php. Upon changing the code, I messed around to see if VMLEM accepted decimals. The component then started to randomly change the price of the shown products. See this vid for example: video

It changed about 30 products before I terminated the page. I then needed the table reconstructed from backup.

So my question is, what are German numbers and what do you think of this behaviour by VMLEM ?
15 Feb 2016 20:02 #456 by Super User
That is when you set decimal separator to comma.

What is your database collation ?
16 Feb 2016 09:19 #459 by Prokop

Thanks for the quick answer.

We use the danish currency, which carries the comma separator. The same system is used by the majority of the non-english speaking world: wiki on decimals

Our database collation is "utf8 - default collation"

Can you comment on how to correct our problem? We cannot correct prices as the system freaks out when inserting comma decimals.

17 Feb 2016 13:43 #463 by Super User

note that decimal option counts only for import/export . After you telling me that you need this for online editing ?
Time to create page: 0.053 seconds