Skip to main content

Reply To: How to convert colon in price field to decimal point seperator

ClassiBase classifieds script Forums Tips and tricks How to convert colon in price field to decimal point seperator Reply To: How to convert colon in price field to decimal point seperator

#1433 Reply

ClassiBase
Keymaster

Hi,

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:

Edit file /sys/app/models/AdField.php line 927

change
$val = str_replace(array($currency_decimal_point, $currency_thousands_seperator), array('.', ''), $val);

to

$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.

  • Classifieds Business Newsletter

    Get discounts and tips about growing your classifieds website.

    Subscribe