Jump to content

[Tutorial] 3 Decimals Pricing on Prestashop 1.6


Recommended Posts

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.

  • Like 3
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 4 weeks later...

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

×
×
  • Create New...