Jupiterr Posted February 28, 2011 Share Posted February 28, 2011 I have been trying to modify the tools.js and price.js (JS Folder) to get a 3 decimals price (without the default 2 decimals rounding) but I can't make it work.Can anyone have a look? I need to display 1,027€ instead of 1,03€. Maybe is only changing one function.Thanks in advance! Link to comment Share on other sites More sharing options...
Jupiterr Posted March 2, 2011 Author Share Posted March 2, 2011 I finally got it working. The main problem was the ps_orders table (fields were "decimal(17,2) NOT NULL DEFAULT '0.00'" and I needed "decimal(17,3) NOT NULL DEFAULT '0.000'").Anyway I changed classes/tools.php, classes/product.php and classes/cart.php to fix the display and external rounding issues.I attach the changes maded (maybe it's not optimized because is prepared to work in all cases). modifDecimals.docx Link to comment Share on other sites More sharing options...
hoss Posted September 22, 2011 Share Posted September 22, 2011 Hello Jupiterr can you explain me how did you do??? i try but i dont know what i will change in classes/tools.php, classes/product.php and classes/cart.php and modifDecimals.docx i dont fiend it Thanks in advance! Link to comment Share on other sites More sharing options...
Jupiterr Posted October 6, 2011 Author Share Posted October 6, 2011 Hello Jupiterr can you explain me how did you do??? i try but i dont know what i will change in classes/tools.php, classes/product.php and classes/cart.php and modifDecimals.docx i dont fiend it Thanks in advance! I'm sorry about that. I will write it down on my calendar to have a look post about that. I hope it will be today. Anyway, I will reupload that file (rewrited). Good luck. Link to comment Share on other sites More sharing options...
Velocity Posted December 15, 2011 Share Posted December 15, 2011 Thank you very much for the help Jupiterr. You saved my life [Off Topic] Please next time try to write directly the code instead of upload a file, just in case the file wont be accesible (like this time). [/Off Topic] So, summary and replying to hoss: Make Prestashop using 3 decimals and don't rounding into 2: 1º) Change global variable _PS_PRICE_DISPLAY_PRECISION_ to 3 (or the number of decimals you need...) in file /config/defines.inc.php This is supossed to be the one and only thing to change, BUT some static coding in other files that doesn't use this variable make our life harder... (at least till version 1.4.5, dont know if in next versions this is solved, if not... PLEASE PRESTASHOP TAKE NOTE OF THIS BUG!!!) Well... next steps... 2º) Search for function Tools::ps_round( *price*, *decimals*) in this files: classes/Cart.php classes/Tools.php classes/Product.php controllers/ProductController.php And algo keep an eye to this files, they have hardcoded the function with 2 decimals, so they most problably will need to be changed... (not tested yet) admin/tabs/AdminOrders.php admin/tabs/AdminProducts.php classes/Order.php classes/PDF.php classes/PaymentModule.php And change all the static *decimals* parameter from 2 to 3. Hope this will clarify the issue to someone for won't an afternoon looking for the solution like me hehe. Best Regards! 1 Link to comment Share on other sites More sharing options...
Jupiterr Posted December 15, 2011 Author Share Posted December 15, 2011 Hello Velocity, I'm really sorry about that. The post is from March and I learnt from that mistake, so it won't happen again Thanks for reposting the solution! Good luck. 1 Link to comment Share on other sites More sharing options...
Velocity Posted December 15, 2011 Share Posted December 15, 2011 I'm coming back to report another issue... Function Product::getPriceStatic is also hardcoded and also is used for format/round prices, so you have to search for this function and change the 4º parameter when necessary from 2 to 3. Sorry if i don't detail all the files the function is in (searching for it is easy with "search in files" function of any decent text editor (like Komodo for MAC or Notepad++ for Windows), but after a long afternoon searching hardcoded variables... i need to go to gym Best Regards! Link to comment Share on other sites More sharing options...
kobi44 Posted October 26, 2012 Share Posted October 26, 2012 anybody have similar solution for 1.5 version? Link to comment Share on other sites More sharing options...
bellini13 Posted February 25, 2013 Share Posted February 25, 2013 http://www.prestashop.com/forums/index.php?/topic/196757-3-decimal-currencies/page__view__findpost__p__1089081 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now