Here is my "solution" (the real solution would be not to need a solution, woudn't it?):
First, add this function to ot_gv.php. Just copy and paste the code between two of the existing functions (methods in fact):
Code:
// change the eropean separators for the US ones
function floatvalue($value) {
return floatval(preg_replace('#^([-]*[0-9\.,\' ]+?)((\.|,){1}([0-9-]{1,2}))*$#e', "str_replace(array('.', ',', \"'\", ' '), '', '\\1') . '.\\4'", $value));
}
Then find this line:
Code:
$_SESSION['cot_gv'] = preg_replace('/[^0-9.%]/', '', $_SESSION['cot_gv']);
And change it for this one (I just added the comma as other ones did):
Code:
// comma added to avoid being stripped
$_SESSION['cot_gv'] = preg_replace('/[^0-9.,%]/', '', $_SESSION['cot_gv']);
Then, finally, apply our new function. You have to apply it after the line you have changed above and before this one:
Code:
$_SESSION['cot_gv'] = abs($_SESSION['cot_gv']);
Just copy and paste:
Code:
// apply the function floatvalue() to replace commas by dots in decimal places
$_SESSION['cot_gv'] = $this->floatvalue($_SESSION['cot_gv']);
I got the function floatvalue() from a contributor on the php site:
http://es2.php.net/floatval
Bookmarks