Poppy381 Posted November 29, 2016 Share Posted November 29, 2016 (edited) Ok the problem is that the Prestashop team change a lot of things with currencies to use cldr. The decimals feature does not work anymore even if the feature is on the BO. Well after several hours of research I've find that : If you want to know the conversion_rate, it's not visible on smarty debug windows but here : $conversion_rate = $this->context->currency->conversion_rate; $this->context->smarty->assign('conversion_rate',$conversion_rate); Now, for the ROUND price. First configure Prestashop to really round your prices. Even if you round theme and select 0 decimals, 2 decimals will always been displayed. That's because prestashop 1.7 does not refer to your settings (thank you guys...) but to cldr. If you want to know the format of your currency try this : $currency_format = $this->context->currency->format; echo $currency_format, break; The format is store in a local file in >Translations>cldr>main-en-US-numbers or main-fr-FR-numbers etc. Open the file and find "currencyFormats-numberSystem-latn" "currencyFormats-numberSystem-latn":{"currencySpacing":{"beforeCurrency":{"currencyMatch":"[:^S:]","surroundingMatch":"[:digit:]","insertBetween":"\u00a0"},"afterCurrency":{"currencyMatch":"[:^S:]","surroundingMatch":"[:digit:]","insertBetween":"\u00a0"[spam-filter],"accounting":"#,##0.00\u00a0\u00a4;(#,##0.00\u00a0\u00a4)","standard":"#,##0.00\u00a0\u00a4","unitPattern-count-one":"{0} {1}","unitPattern-count-other":"{0} {1}"} you will find the currency format. $ format : standard:\u00a4#,##0.00 € format : standard: #,##0.00\u00a0\u00a4 \u00a4 is the currency sign \u00a0 is a space The coma is the thousand(group) separator and The point is the decimal separator. They are defined at the beginning of the file : "symbols-numberSystem-latn":{"decimal":".","group":","; If you don't want to see decimals on your shop, just delete ".00" and save the file, and that's all . I suggest to Prestashop team to allow us to have a variable to display or not decimals instead of doing that . All the best Franck Edited November 29, 2016 by Poppy381 (see edit history) 8 2 Link to comment Share on other sites More sharing options...
babakasfahan Posted March 13, 2017 Share Posted March 13, 2017 thank you very much Link to comment Share on other sites More sharing options...
kike1985 Posted March 20, 2017 Share Posted March 20, 2017 thank you!!!!! Link to comment Share on other sites More sharing options...
kike1985 Posted March 20, 2017 Share Posted March 20, 2017 IT works but, it was not detected by "list of modified files" lol Link to comment Share on other sites More sharing options...
Poppy381 Posted March 20, 2017 Author Share Posted March 20, 2017 But it works ^^. Link to comment Share on other sites More sharing options...
kike1985 Posted April 13, 2017 Share Posted April 13, 2017 i wonder how they gonna fix this Link to comment Share on other sites More sharing options...
Rajabotol Posted June 22, 2017 Share Posted June 22, 2017 it works without objection Link to comment Share on other sites More sharing options...
Drens Posted August 9, 2017 Share Posted August 9, 2017 you are awesome, thanks!! Link to comment Share on other sites More sharing options...
Poppy381 Posted August 10, 2017 Author Share Posted August 10, 2017 Well the first thing to do is to create your own thread on this forum and don't ask a question about something different in a thread...Please delete your message, you will have more answer in your own thread with a good title. Thank you. Link to comment Share on other sites More sharing options...
Truong Huynh Posted August 23, 2017 Share Posted August 23, 2017 Thanks for share! But it's works? how do it, you can help i fix prestashop v1.7.2.1 Thanks! Link to comment Share on other sites More sharing options...
prestahero.com Posted August 23, 2017 Share Posted August 23, 2017 (edited) Thanks for share! But it's works? how do it, you can help i fix prestashop v1.7.2.1 Thanks! hi Truong as I suggested you, this topic is the original post which gives the solution Edited August 24, 2017 by ets-soft (see edit history) Link to comment Share on other sites More sharing options...
Poppy381 Posted August 23, 2017 Author Share Posted August 23, 2017 Original post ? This topic answers to this problem on 29th November 2016 by myself, your topic on 29 June 2017 ? I don't understand why you post another link to another forum as the answer is still here in the first post, with all explanations. Right ? Link to comment Share on other sites More sharing options...
prestahero.com Posted August 24, 2017 Share Posted August 24, 2017 Original post ? This topic answers to this problem on 29th November 2016 by myself, your topic on 29 June 2017 ? I don't understand why you post another link to another forum as the answer is still here in the first post, with all explanations. Right ? hi Poppy381 sorry for the mistake, I didn't know your post is original. @Trung Huynh asked us for help on another forum, I was looking for a solution on Google and saw it on stackoverflow and gave him that solution. I have edited the previous post Link to comment Share on other sites More sharing options...
kulekas Posted September 10, 2017 Share Posted September 10, 2017 Hi, I have tree currencies in my store, but I don't know how to configurate the correct currency format for every one. EUR is X,XXX.XX € USD is $X,XXX.XX COP is $ X.XXX I will waiting for a response (Sorry for my english) Link to comment Share on other sites More sharing options...
Liliana M Posted December 28, 2017 Share Posted December 28, 2017 Thank you very much! It worked! Link to comment Share on other sites More sharing options...
kimy Posted January 29, 2018 Share Posted January 29, 2018 Hi, Thanks, this worked well Can i edit this file in order to make the prices end with a "9", for example 109? Link to comment Share on other sites More sharing options...
Vailry Posted July 5, 2018 Share Posted July 5, 2018 Sadly it doesn't work for me. I've edited the numbers.json according to your information in translations/cldr/datas/main/ko-KR. I don't use a CDN, caching is diabled and theme compiling is forced. None of the changes take effect. Even if I delete the content of the whole file. Link to comment Share on other sites More sharing options...
Poppy381 Posted July 5, 2018 Author Share Posted July 5, 2018 11 minutes ago, Vailry said: Sadly it doesn't work for me. I've edited the numbers.json according to your information in translations/cldr/datas/main/ko-KR. I don't use a CDN, caching is diabled and theme compiling is forced. None of the changes take effect. Even if I delete the content of the whole file. Clear cache and try again. If you delete the file and nothing change, it should help you to understand...Maybe something change on last version... Link to comment Share on other sites More sharing options...
Martin Posted August 11, 2018 Share Posted August 11, 2018 Hello, can you also advise me how to delete the decimal places in discount flags the list of products? E.g. 17.35% discount does not look nice. I would only show 17% (from 17.5% to 18%), etc. "percentFormats-numberSystem-latn": {"standard": "#, ## 0 \ u00a0%"}, = 0 decimal places, but show all Thank you in advance for your advice. Link to comment Share on other sites More sharing options...
delonatelo Posted February 1, 2019 Share Posted February 1, 2019 Hello, I have the same issue, need to display Russian Ruble with no decimals, and Euro with 2 decimals. Is there a possible solution for multiple currencies? Link to comment Share on other sites More sharing options...
884483048 Posted May 13, 2019 Share Posted May 13, 2019 This solution is half working actually. If you remove .00 but your items has prices with decimals then final price will be incorrectly calculated in the basket. As for an examle: you have product#1 with price "10.55", if you remove .00 at standard section of the file then its price will be shown at frontend as "10" but if you add 2 pcs of product#1 to the basket final price will be "21" but not "20". Additional removal of .00 at accounting section of the file does nothing. Any ideas? Link to comment Share on other sites More sharing options...
Giti Posted July 23, 2019 Share Posted July 23, 2019 On 11/29/2016 at 7:58 PM, Poppy381 said: Ok the problem is that the Prestashop team change a lot of things with currencies to use cldr. The decimals feature does not work anymore even if the feature is on the BO. Well after several hours of research I've find that : If you want to know the conversion_rate, it's not visible on smarty debug windows but here : $conversion_rate = $this->context->currency->conversion_rate; $this->context->smarty->assign('conversion_rate',$conversion_rate); Now, for the ROUND price. First configure Prestashop to really round your prices. Even if you round theme and select 0 decimals, 2 decimals will always been displayed. That's because prestashop 1.7 does not refer to your settings (thank you guys...) but to cldr. If you want to know the format of your currency try this : $currency_format = $this->context->currency->format; echo $currency_format, break; The format is store in a local file in >Translations>cldr>main-en-US-numbers or main-fr-FR-numbers etc. Open the file and find "currencyFormats-numberSystem-latn" "currencyFormats-numberSystem-latn":{"currencySpacing":{"beforeCurrency":{"currencyMatch":"[:^S:]","surroundingMatch":"[:digit:]","insertBetween":"\u00a0"},"afterCurrency":{"currencyMatch":"[:^S:]","surroundingMatch":"[:digit:]","insertBetween":"\u00a0"[spam-filter],"accounting":"#,##0.00\u00a0\u00a4;(#,##0.00\u00a0\u00a4)","standard":"#,##0.00\u00a0\u00a4","unitPattern-count-one":"{0} {1}","unitPattern-count-other":"{0} {1}"} you will find the currency format. $ format : standard:\u00a4#,##0.00 € format : standard: #,##0.00\u00a0\u00a4 \u00a4 is the currency sign \u00a0 is a space The coma is the thousand(group) separator and The point is the decimal separator. They are defined at the beginning of the file : "symbols-numberSystem-latn":{"decimal":".","group":","; If you don't want to see decimals on your shop, just delete ".00" and save the file, and that's all . I suggest to Prestashop team to allow us to have a variable to display or not decimals instead of doing that . All the best Franck i can not find file in here Translations>cldr>main-en-US-numbers where is the file ? please help me where i can find the file Link to comment Share on other sites More sharing options...
Dusan K Posted July 24, 2019 Share Posted July 24, 2019 Hi, Translations>cldr> doesn´t work with 1.7.6? I have two currencies and I would like to cancel the decimal places for CZK (1000 CZK), of course for EUR i need (1000.00 EUR). Is any solution for 1.7.6? Link to comment Share on other sites More sharing options...
pujionodk Posted August 12, 2019 Share Posted August 12, 2019 (edited) On 7/24/2019 at 8:20 PM, Dusan K said: Hi, Translations>cldr> doesn´t work with 1.7.6? I have two currencies and I would like to cancel the decimal places for CZK (1000 CZK), of course for EUR i need (1000.00 EUR). Is any solution for 1.7.6? Same here, update to 1.7.6 , decimal number showing again in product price I checked the numbers file in cldr dir, is still same as before "standard":"\u00a4\u00a0#,##0" In 1.7.5.x product price show $ 1 in 1.7.6 product price show $1 (without space) but in numbers file I add \u00a0 So can we assume numbers file in cldr not works in 1.7.6 But you can change in currency table, set precision field value to decimal number you want to show Edited August 12, 2019 by pujionodk (see edit history) 1 Link to comment Share on other sites More sharing options...
bouskdav Posted August 29, 2019 Share Posted August 29, 2019 On 8/12/2019 at 5:33 AM, pujionodk said: Same here, update to 1.7.6 , decimal number showing again in product price I checked the numbers file in cldr dir, is still same as before "standard":"\u00a4\u00a0#,##0" In 1.7.5.x product price show $ 1 in 1.7.6 product price show $1 (without space) but in numbers file I add \u00a0 So can we assume numbers file in cldr not works in 1.7.6 But you can change in currency table, set precision field value to decimal number you want to show I didnt know about precision in ps_currency table. Thanks a lot! Link to comment Share on other sites More sharing options...
Amorino Posted December 13, 2019 Share Posted December 13, 2019 Hello, with 1.7.6.2 the precision in ps_currency is set to 3 but always seeing 2 decimals Is it a template problem? Searching since 2 days Any help please? Thank you in advance Best regards Link to comment Share on other sites More sharing options...
diondlemarcu Posted January 7, 2020 Share Posted January 7, 2020 (edited) On 11/29/2016 at 5:28 PM, Poppy381 said: Ok the problem is that the Prestashop team change a lot of things with currencies to use cldr. The decimals feature does not work anymore even if the feature is on the BO. Well after several hours of research I've find that : Nox Vidmate VLC If you want to know the conversion_rate, it's not visible on smarty debug windows but here : $conversion_rate = $this->context->currency->conversion_rate; $this->context->smarty->assign('conversion_rate',$conversion_rate); Now, for the ROUND price. First configure Prestashop to really round your prices. Even if you round theme and select 0 decimals, 2 decimals will always been displayed. That's because prestashop 1.7 does not refer to your settings (thank you guys...) but to cldr. If you want to know the format of your currency try this : $currency_format = $this->context->currency->format; echo $currency_format, break; The format is store in a local file in >Translations>cldr>main-en-US-numbers or main-fr-FR-numbers etc. Open the file and find "currencyFormats-numberSystem-latn" "currencyFormats-numberSystem-latn":{"currencySpacing":{"beforeCurrency":{"currencyMatch":"[:^S:]","surroundingMatch":"[:digit:]","insertBetween":"\u00a0"},"afterCurrency":{"currencyMatch":"[:^S:]","surroundingMatch":"[:digit:]","insertBetween":"\u00a0"[spam-filter],"accounting":"#,##0.00\u00a0\u00a4;(#,##0.00\u00a0\u00a4)","standard":"#,##0.00\u00a0\u00a4","unitPattern-count-one":"{0} {1}","unitPattern-count-other":"{0} {1}"} you will find the currency format. $ format : standard:\u00a4#,##0.00 € format : standard: #,##0.00\u00a0\u00a4 \u00a4 is the currency sign \u00a0 is a space The coma is the thousand(group) separator and The point is the decimal separator. They are defined at the beginning of the file : "symbols-numberSystem-latn":{"decimal":".","group":","; If you don't want to see decimals on your shop, just delete ".00" and save the file, and that's all . I suggest to Prestashop team to allow us to have a variable to display or not decimals instead of doing that . All the best Franck IT works but, it was not detected by "list of modified files" lol Edited January 28, 2020 by diondlemarcu (see edit history) Link to comment Share on other sites More sharing options...
Amorino Posted January 8, 2020 Share Posted January 8, 2020 On 1/7/2020 at 2:50 AM, diondlemarcu said: IT works but, it was not detected by "list of modified files" lol whith which version ? Link to comment Share on other sites More sharing options...
fabmo31 Posted January 13, 2020 Share Posted January 13, 2020 Bonjour, je n'ai pas de fichier dans le dossier translation/cldr/ juste un .htaccess Savez vous pourquoi ? version / 1.7.6.2 Link to comment Share on other sites More sharing options...
surfeur972 Posted January 28, 2020 Share Posted January 28, 2020 (edited) On 1/13/2020 at 10:55 AM, fabmo31 said: Bonjour, je n'ai pas de fichier dans le dossier translation/cldr/ juste un .htaccess Savez vous pourquoi ? version / 1.7.6.2 Bonjour as tu trouvé ? moi non plus j'ai rien trouvé Edited January 28, 2020 by surfeur972 (see edit history) Link to comment Share on other sites More sharing options...
roboy Posted March 23, 2020 Share Posted March 23, 2020 Hello, Any news on this topic? I searched my database for ps_currency using phpMyAdmin but that table doesn't seem to exist at all. Should it still be there in PS 1.7.6? The seemingly simple problem of removing two tiny decimals from the price has proven to be more difficult than what I could ever imagine. Any relevant input on this subject would be highly appreciated. Link to comment Share on other sites More sharing options...
Poppy381 Posted March 23, 2020 Author Share Posted March 23, 2020 (edited) I'm sorry but i've found a way two years ago, and now Prestashop team changes everything without improving (you know the easy way : you put this option visible in the backoffice and it's over, it works and yes it was like that few years ago...). It's a waste of time, just display the cents or move from Prestashop to .... mmm said https://sylius.com/ ? Good luck :). Edited March 23, 2020 by Poppy381 (see edit history) Link to comment Share on other sites More sharing options...
roboy Posted March 23, 2020 Share Posted March 23, 2020 Thanks for your reply! I can't believe they have made it so difficult. Perhaps I need to start a new thread? I'm always open to try new platforms but I'm afraid Sylius does not appear to be comprehensive enough to cover all my needs, for example when it comes to common payment methods used in Sweden. Otherwise it looks nice and sleek. Link to comment Share on other sites More sharing options...
Poppy381 Posted March 23, 2020 Author Share Posted March 23, 2020 I was amazed when they launched PS1.7 how this kind of things becames difficult, and the new menu where everything is hidden in a tab. I think Sylius integration with Symfony is what Prestashop would like to go . I understand your special needs with payment integration so PS is maybe still good...but with cents displayed ^^. Link to comment Share on other sites More sharing options...
El Patron Posted March 23, 2020 Share Posted March 23, 2020 a lot of devs have tried to solve this, I did it once with module 'price charming' but it would only work with 'tax excluded' I'm in the US so that made sense. It's a lot more complicated than some pretty good devs (with passion) tried to solve and failed, I'm still hurting 5 years later. the last module I saw on addon's to do this is no longer there. here are a few but as mentioned the one that look close is no longer offered. https://addons.prestashop.com/en/search?search_query=rounding Link to comment Share on other sites More sharing options...
roboy Posted March 23, 2020 Share Posted March 23, 2020 Thanks a lot for your input on this. I'm not sure if I should be amazed or terrified from your information... To be completely frank, the very need for a module in resolving this feels utterly absurd to me. Anyway, I'm testing my luck in this newly posted thread: Link to comment Share on other sites More sharing options...
joseantgv Posted March 24, 2020 Share Posted March 24, 2020 (edited) This module could also help you https://addons.prestashop.com/en/price-management/27821-change-or-remove-the-decimals-and-format-currency.html Edited March 24, 2020 by joseantgv (see edit history) Link to comment Share on other sites More sharing options...
roboy Posted March 25, 2020 Share Posted March 25, 2020 Thanks a lot for your advice! I was aware of that module and in the end I will probably go for that solution. I just find it somewhat ridiculous to need a module for such basic functionality. For now I'll stick to Prestashop mainly due to the wide availability of third party payment modules, but I regret saying that I'll start considering other alternatives for the next major upgrade of my e-shop. Link to comment Share on other sites More sharing options...
El Patron Posted March 25, 2020 Share Posted March 25, 2020 PrestaShop had a 'very' good price display (by currency) in 1.6 and earlier versions. They changed their localization pack process to use 'something else' and that beautiful feature was lost. I suppose they thought somebody would create a module to replace the feature. I'll ask you this, if you use tax included, look at other ecommerce platforms and see if they support 'charming a price' with tax included...I don't think you will find any/many. That is a really horrible law to require tax included.... Link to comment Share on other sites More sharing options...
Amorino Posted March 26, 2020 Share Posted March 26, 2020 Hello, I'm sorry to notice that for every little ordinary function we should pay 70 € or more I'm afraid this is the end of Free prestashop ! Our concurrents are using other platforms and they are really doing a very good job with much less fees !! What do you thinks guys ? Link to comment Share on other sites More sharing options...
imme Posted March 27, 2020 Share Posted March 27, 2020 On 3/25/2020 at 8:59 PM, roboy said: Thanks a lot for your advice! I was aware of that module and in the end I will probably go for that solution. I just find it somewhat ridiculous to need a module for such basic functionality. For now I'll stick to Prestashop mainly due to the wide availability of third party payment modules, but I regret saying that I'll start considering other alternatives for the next major upgrade of my e-shop. Hi Roboy, Do you have any feedback on that module? does it work as it should? On 3/26/2020 at 2:34 AM, Amorino said: Hello, I'm sorry to notice that for every little ordinary function we should pay 70 € or more I'm afraid this is the end of Free prestashop ! Our concurrents are using other platforms and they are really doing a very good job with much less fees !! What do you thinks guys ? Im quite new to prestashop but the module prices that ive seen so far are crazy to be honest... 1 Link to comment Share on other sites More sharing options...
Poppy381 Posted March 27, 2020 Author Share Posted March 27, 2020 Hello I've found a way for PS 1.7.5.0 It's maybe the same trick for PS1.7.6 whatever : On the file Prestashop_1_7_5_0/vendor/icanboogie/cldr/lib/NumberPattern.php Ligne 275 public function format_integer_with_decimal($integer, $decimal, $decimal_symbol) { //FIRST TRICK : Remove decimals with a condition for example any price with decimal at 0 if (in_array($decimal, array("0","00","000","0000","00000","000000"))) { $decimal = null; } else { if ($this->decimal_digits > strlen($decimal)) { $decimal = str_pad($decimal, $this->decimal_digits, '0'); } if (strlen($decimal)) { $decimal = $decimal_symbol . $decimal; } } //SECOND TRICK : Remove any decimals even if the price is 19,12 it will be displayed 19 //remove the line below ($decimal = null;) if this is not what you wanted. $decimal = null; return "$integer" . $decimal; } I've put 2 visions - The first one is to remove decimals only if the real price is 19,00 € -> 19 € up to 6 decimals - The second one is to remove decimals everywhere I have not test that everywhere on the website but it seems ok Hope its will be helpfull :). Tell me Link to comment Share on other sites More sharing options...
Poppy381 Posted March 27, 2020 Author Share Posted March 27, 2020 And now for the PS 1.7.6.4 let's remove this decimals... File : prestashop1_7_6_4/src/Core/Localization/Number/Formatter.php l.125 #REPLACE if ($minorDigits) { $formattedNumber .= self::DECIMAL_SEPARATOR_PLACEHOLDER . $minorDigits; } #BY if (in_array($minorDigits, array("0","00","000","0000","00000","000000"))) { //$formattedNumber = $formattedNumber; } else if ($minorDigits) { $formattedNumber .= self::DECIMAL_SEPARATOR_PLACEHOLDER . $minorDigits; } Still the same tricks, i only remove decimals from prices that have "0" in decimals Save then refresh your page...End of story. You can easely observe my past comment with my 2 last answers : Any new version change the way they are dealing with displayPrice... Good luck with future versions guys ahahahaha ! Disable one click automatic update ! 2 2 Link to comment Share on other sites More sharing options...
roboy Posted March 28, 2020 Share Posted March 28, 2020 Wow!! That worked wonders. Great to feel that one can still count on the Prestashop community! You ought to be upgraded to guru status 😃. One last question: Should I modify the original Formatter.php and keep notes for future updates to Prestashop, or could I simply use the override feature in order to avoid having to redo the change on each version update? Link to comment Share on other sites More sharing options...
michal227 Posted December 19, 2020 Share Posted December 19, 2020 Hi, I have a big problem after updating my Prestashop to 1.7.7 Previous version used to show decimals rounded to second place after coma. In backoffice I see a price 12,499999 and in the product card my customers see 12,50. Now, after upgrade the price is 12,00 even if the price is 12,49999. The worst thing is that I have a module which generates an XML file for Google Merchant feed and this module makes proper rounding so in the above case the figue is 12,50. Because of the Google Merchant rejects my products because price on my website is different then in my feed... Does anyone know how to fix this? Link to comment Share on other sites More sharing options...
etsmes Posted March 2, 2021 Share Posted March 2, 2021 I am also always shown zeros in decimals. Please help! Link to comment Share on other sites More sharing options...
Xymor Posted January 30 Share Posted January 30 On 3/27/2020 at 11:56 PM, Poppy381 said: And now for the PS 1.7.6.4 let's remove this decimals... File : prestashop1_7_6_4/src/Core/Localization/Number/Formatter.php l.125 #REPLACE if ($minorDigits) { $formattedNumber .= self::DECIMAL_SEPARATOR_PLACEHOLDER . $minorDigits; } #BY if (in_array($minorDigits, array("0","00","000","0000","00000","000000"))) { //$formattedNumber = $formattedNumber; } else if ($minorDigits) { $formattedNumber .= self::DECIMAL_SEPARATOR_PLACEHOLDER . $minorDigits; } thanks, it still works in presta 8.1, just slightly updated: // Assemble the final number $formattedNumber = $majorDigits; if (in_array($minorDigits, array("0","00","000","0000","00000","000000"))) { //$formattedNumber = $formattedNumber; } else if (strlen($minorDigits)) { $formattedNumber .= self::DECIMAL_SEPARATOR_PLACEHOLDER . $minorDigits; } Link to comment Share on other sites More sharing options...
Pablo37 Posted February 14 Share Posted February 14 In ps 8.1.3 there is already an option to remove decimals from BO and it can be specified for each currency. I tried it and it works. International, location, currencies 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