January 28, 2014 at 14:11 #1432
How do I correct the full stops that appear before the price on the ad?
Example: When I post an ad and enter the price like this £40.00 everything
is displayed fine however when I enter the price like this £40:00 it
displays like this £4,000.00January 28, 2014 at 14:12 #1433
When price field stored in database it removes all non numeric characters and leaves only “.” as separator cor decimal point. if you define other decimal point separator in “Settings” -> “Currency” for example “,” then it converts that separator to “.” and stores value as float number.
In your case it removes “:” from 40:00, and number becomes 4000 not 40.00
if you want to modify and make 40:00 convert to 40.00 then make changes as described below:
$val = str_replace(array($currency_decimal_point, $currency_thousands_seperator), array('.', ''), $val);
$val = str_replace(array(":",$currency_decimal_point, $currency_thousands_seperator), array('.','.', ''), $val);
which will replace “:” with “.” then convert to float.
Also make note of this change in case if you update script in future changes you made to script files will be lost.
Regards.January 28, 2014 at 14:27 #1435
Does that mean a user can input . , or : without changing the value? This is how I want it to work.January 28, 2014 at 14:29 #1439
If you want to use .,: as decimal point then change that line to
$val = str_replace(array(":",",",$currency_decimal_point, $currency_thousands_seperator), array('.','.','.', ''), $val);January 28, 2014 at 14:31 #1438
How do I correct the full stops that appear before the price on the ad?January 28, 2014 at 14:33 #1441
Can you explain with example what you mean by “correct” ?January 28, 2014 at 17:27 #1442
I want the user to decide what they want to use , ‘ : ; / but I dont want the script to play about with the value.January 28, 2014 at 17:27 #1443
What if I want to allow the user to input what they want i.e. : , . ; without the script changing the value, how do i do that?January 28, 2014 at 17:29 #1446
You can add as many characters you want to be considered as “.” same way as explained above. Just make sure that each array has equal number of items in it.