Page 1 of 1

Allows nominal currency with decimal fractions

Posted: 19 Oct 2017, 09:19
by heru_subekti
Hello, this time I will share tips to change the currency value for the item of copies. In standard setting, the format of currency field using a round value.
Then how to several countries that use the currency value with fractional cents?
A first step, you must change the data type for the currency in the table of items (I assume you can use the mysql manager, for example phpMyAdmin), then run the following query

Code: Select all

ALTER TABLE `item` CHANGE `price` `price` DECIMAL( 10, 2 ) NULL DEFAULT NULL ;
then open the file slims_folder / admin / modules / bibliography / item.php, find the line contains

Code: Select all

$data['price'] = preg_replace('@[.,\-a­-z ]@i', '', strip_tags($_POST['p­rice']));

Code: Select all

[.,\-a­-z ]
look at this script, the characters in the parameter will be omitted. that means you have to remove the dot within the parameters so that these characters are not deleted when saved to the database.
after edit

Code: Select all

$data['price'] = preg_replace('@[,\-a­-z ]@i', '', strip_tags($_POST['p­rice']));
and then save.

image preview :
currency.jpg
currency.jpg (61.36 KiB) Viewed 6742 times