kobi44 Posted October 23, 2012 Share Posted October 23, 2012 I need 3 decimal places in the price instead of two. How to change it in version 1.5? Link to comment Share on other sites More sharing options...
benjamin utterback Posted October 23, 2012 Share Posted October 23, 2012 Hello kobi44, you can try to go to localizations/currencies and set the decimals setting as you like. I hope this helps! Thank you! Link to comment Share on other sites More sharing options...
kobi44 Posted October 23, 2012 Author Share Posted October 23, 2012 Yes, I try it but there is no possibility to change on 3 decimal places - only ON/OFF decimals Link to comment Share on other sites More sharing options...
benjamin utterback Posted October 23, 2012 Share Posted October 23, 2012 Hello kobi, could you click on formatting? You should be able to change it there from the currencies tab. Link to comment Share on other sites More sharing options...
kobi44 Posted October 23, 2012 Author Share Posted October 23, 2012 It is just formating, when I go to catalog -> products ans in prices tab I try set price for ex. 1,123 the presta cut it to 1,12. Also in cart I always have 0,00 - should be 0,00. I found similar problem here http://www.prestashop.com/forums/topic/169748-3-decimal-currencies/ but solution is for older presta .. Because in 1.5 it's look: /* X 0,000.00 */ case 1: $ret = $c_char.$blank.number_format($price, $c_decimals, '.', ','); break; How change $c_decimals to get 3 places after coma? Link to comment Share on other sites More sharing options...
benjamin utterback Posted October 23, 2012 Share Posted October 23, 2012 There should be an option to click on "Formatting" in which you can change the number of decimals. What happens when you click on that? Link to comment Share on other sites More sharing options...
kobi44 Posted October 23, 2012 Author Share Posted October 23, 2012 I have 5 options in formatting but it don't change it but I see that it work and change currency symbol from left side to right side. But it is for price 1.123.123 - I need smaller value like 1,123 - this is not the same.. Look on my shop http://dm-components.com - the resistor price should be smaller than 0.01 pounds. It should be 0.005 for example. So I need 3 places. Link to comment Share on other sites More sharing options...
bellini13 Posted January 30, 2013 Share Posted January 30, 2013 (edited) This is pretty sad the way its been implemented, but here is how you support 3 decimal places in Prestashop v1.5. Keep in mind, this is a global site change, so it will impact currencies that are only 2 decimal places. All Prices will be shown with 3 decimals if you make this change. To summarize, you would need to make the following changes to use a 3 decimal place price. Read below for more details 1) Change the config/defines.inc.php define('_PS_PRICE_DISPLAY_PRECISION_', 3); 2) Override Tools::ps_round so the precision is switched globally from 2 to 3 3) Search for the usage of string_format, and ensure 3f is used instead of 2f. I only get 2 hits when I search, which is prices.tpl and AdminRangePriceController.php The detailed explanation 1. Change the config/defines.inc.php There is a config file named defines.inc.php, which has a setting _PS_PRICE_DISPLAY_PRECISION_ define('_PS_PRICE_DISPLAY_PRECISION_', 2); This is used by the Tools::displayPrice function in conjunction with the currency format to show the price on a majority of the site. I changed the 2 to a 3 on a local test site and it seems to be working 90%. 2. Override Tools::ps_round There are still some places where only 2 decimals are showing, and that is because of functions like Product::getPriceStatic and Product::priceCalculation also do decimal formatting, and instead of using the above setting, they hard coded 2. So in the AdminProductsController, where the product price is entered, rounds the price to 2 decimal Product::getPriceStatic($this->_list[$i]['id_product'], true, null, 2, null, false, true, 1, true); Those functions just pass the decimal value to Tools::ps_round, so a simple override of the ps_round function, you could do if ($precision==2) $precision=3 3. Search for the usage of string_format The last thing I could find is within the actual smarty templates, there is also price formatting. For example, in prices.tpl (which is used to show the admin product price), they are using string_format:'%.2f' This is taking the 3 decimal price, and formatting it to 2 decimal, so changing it to string_format:'%.3f' fixes that display issue. I suppose you could just remove the string_format entirely, but that will result in showing the full 6 decimal places Edited January 30, 2013 by bellini13 (see edit history) 1 Link to comment Share on other sites More sharing options...
T0x1c Posted February 26, 2013 Share Posted February 26, 2013 (edited) There seems to be modifications to be done in the databases also. For instance, the structure of table 'ps_product' field 'additional_shipping_cost' = decimal(20,2) should be changed to decimal(20,3). Edit: You also have to change '.toFixed(2)' to '.toFixed(3)' in price.js Edited February 27, 2013 by T0x1c (see edit history) Link to comment Share on other sites More sharing options...
Tahar R Posted March 14, 2013 Share Posted March 14, 2013 Hi guys, I am using version 1.5.3.1. I replaced all values of ps_round(xx,2) with ps_round(xx,3), and string_format = '%2f' with string_format = '%3f' (and of course the value precision on the defines.inc.php file). You can find on attach all the edited files. Just unzip the file, and upload the content of the "prestashop 3 decimals" folder on the root of your prestashop installation. This will overwrite the 35 files which need to be edited. If you want to rollback to a previous files, just unzip the content of the "prestashop 2 decimals" folder on the root, and all edited files will be restored. I just tried it, and it seems to work for me. prestashop 1.5.3.1 with 3 decimals.zip Link to comment Share on other sites More sharing options...
El Patron Posted April 13, 2013 Share Posted April 13, 2013 another way to handle 3 decimal places it to simply turn decimals off for that currency and select, while it may not cover every instance it covers most..for example Colombia Peso's. We turn off decimals and consider the last three digits as decimal places. http://screencast.com/t/CLEdHIrFzUJZ The problem we saw doing this, as well as with two digit decimal places were odd endings...so I wrote our Price Charming module so we could have some control of how 2/3 decimal endings looked. Link to comment Share on other sites More sharing options...
Tahar R Posted December 25, 2013 Share Posted December 25, 2013 Hi guys, I am using version 1.5.3.1. I replaced all values of ps_round(xx,2) with ps_round(xx,3), and string_format = '%2f' with string_format = '%3f' (and of course the value precision on the defines.inc.php file). You can find on attach all the edited files. Just unzip the file, and upload the content of the "prestashop 3 decimals" folder on the root of your prestashop installation. This will overwrite the 35 files which need to be edited. If you want to rollback to a previous files, just unzip the content of the "prestashop 2 decimals" folder on the root, and all edited files will be restored. I just tried it, and it seems to work for me. And here is the files updated for 1.5.6.1 version: prestashop 1.5.6.1 with 3 decimals.zip 1 Link to comment Share on other sites More sharing options...
pl.sabotinov Posted September 11, 2014 Share Posted September 11, 2014 (edited) Hello everybody, Hello Tahar R, do you have also files updater for 3 decimals for presta version 1.5.4.1. Are all the files same as 1.5.3.1 or the 1.5.6.1. Does anybody knows that? So i could realy fast update all files, and not do it manually in 1.5.4.1. Edited September 11, 2014 by pl.sabotinov (see edit history) Link to comment Share on other sites More sharing options...
skullxcrusher Posted December 25, 2015 Share Posted December 25, 2015 do u have the files for PrestaShop™ 1.5.6.3 ? Link to comment Share on other sites More sharing options...
Galliass Posted June 2, 2017 Share Posted June 2, 2017 Hello, anything for PrestaShop 1.6.1.13 ? Link to comment Share on other sites More sharing options...
Recommended Posts