MEG Venture Posted April 24, 2014 Share Posted April 24, 2014 Hi One of my customers asked me how to convert Prestashop 1.6 for 3 decimals pricing (currency). There is no easy way to do this as the decimals are hard coded in many places, and it is a painful process to make this possible, but I guess we made it. There may be ones who need to replicate this procedure. So, here is what I did: *****MAKE A BACKUP OF YOUR FILES AND DATABASE BEFORE THIS IMPLEMENTATION***** 1. /config/defines.inc.php define('_PS_PRICE_DISPLAY_PRECISION_', 3); <-- change 2 into 3 2. Scan all files of the installation having the ps_round or Tools::ps_round function, and replace all instances of 2 with 3 3. Scan all files of the installation having the Product::getPriceStatic function and replace all instances of 2 with 3 4. Scan all files of the installation having the precision variable and replace all instances of 2 with 3 5. Scan all files of the installation having the string_format:"%.2f" statement, and replace with string_format:"%.3f" 6. Finally, open the database, and from the table structures having the price fields, find all instances of Decimal 17,2 and Decimal 10,2; then replace with Decimal 17,3 and Decimal 10,3; also change the default value having 3 zeroes after the point like 0.000, if exist. 3 Link to comment Share on other sites More sharing options...
JaivyDaam Posted June 12, 2014 Share Posted June 12, 2014 Wauw, this is awesome thanks for sharing! How can they hard code such an easy thing, they got a define statement... oh well, lets get to business! Thank you!!! Link to comment Share on other sites More sharing options...
ultimatebondagerope Posted August 12, 2014 Share Posted August 12, 2014 will this show prices with 3 decimals in the front end or simly use 3 decimals for tax calculations? I would be interested in the latter... Link to comment Share on other sites More sharing options...
MEG Venture Posted August 12, 2014 Author Share Posted August 12, 2014 will this show prices with 3 decimals in the front end or simly use 3 decimals for tax calculations? I would be interested in the latter... This is actually for display purposes. But I remember that it covers both cases. Link to comment Share on other sites More sharing options...
cupidon4040 Posted September 9, 2014 Share Posted September 9, 2014 Hello MEG Venture, Thanks for this ! But I've a little problem with this on Prestashop 1.6.0.9. Sorry for my bad English. Here you can see the problem : Just I not find all instances of Decimal 17,2 and Decimal 10,2. But I don't think it's the reason. Could you help me ? Thank you Link to comment Share on other sites More sharing options...
MEG Venture Posted September 9, 2014 Author Share Posted September 9, 2014 @cupidon4040 I am not sure. We need to check the database and all files. Maybe you missed something. Link to comment Share on other sites More sharing options...
pl.sabotinov Posted September 11, 2014 Share Posted September 11, 2014 Hello MEG Venture, After doing all these changes the cart summary should be with 3 decimal places as items , items total and order total amount. So if you send this cart values to paypal, usually paypal module does report errors : 10401, 10426, 10427, 10413. Have you tried this with low value single price items. Do you receive these errors. I am asking, because i do search for complete solution for presta 1.5.4.1, which solution should also round correctly the single prices in 3 decimal places in cart and give correct values to paypal. Else these errors will appear. I have achieved showing and computing the prices with 3 decimal places correctly, but paypal module gives errors at the end. So i have used another solution, but the want to know if this solution does avoid these errors. Thanks in advance. Link to comment Share on other sites More sharing options...
Recommended Posts