comprausa Posted October 10, 2012 Share Posted October 10, 2012 (edited) Hello. Can prices be rounded to the nearest Zero, for some currencies? My shop has default prices in US$ but we deal with other currencies. One of them is Colombian Peso, in which the smallest coin is 10 pesos. Prices in Colombia are usually expressed with the last digit as zero "0". For example: After currency exchange rate update, price is:... 19,621 I want to show rounding as ........................: 19,620 After currency exchange rate update, price is......: 1,786 I want to show rounding as ...........................: 1,790 Is there any feature in PS 1.4.6.2 or module that can do this for us. just on one of the currencies that the shop handles, or in all of them? Thanks! Edited October 10, 2012 by comprausa (see edit history) Link to comment Share on other sites More sharing options...
comprausa Posted October 10, 2012 Author Share Posted October 10, 2012 I just edited the post above to see If I get any reply, I hope this explains better what I need. Thanks 1 Link to comment Share on other sites More sharing options...
El Patron Posted October 10, 2012 Share Posted October 10, 2012 this should help... http://www.prestashop.com/forums/topic/173170-solved-decimal-round-up/ Link to comment Share on other sites More sharing options...
comprausa Posted October 10, 2012 Author Share Posted October 10, 2012 Thanks elpatron but I'm not sure that helps, these are a few examples of the behavior I want to obtain: 1001.21 Round to 1000 1001.73 Round to 1000 1004.10 Round to 1000 1005.90 Round to 1010 1008.23 Round to 1010 1013.11 Round to 1010 1016.02 Round to 1020 1044.00 Round to 1040 This is only for currencies in which cents, and amounts lower than 10.00 are not used or do not exist in the local economy of that country where the coins smaller than 10.00 are very rarely used. Hence most product prices displayed in this country end in Zero and have no decimals. Link to comment Share on other sites More sharing options...
El Patron Posted October 10, 2012 Share Posted October 10, 2012 you are aware you can by currency...define to use decimals or not, yes? it doesn't round maybe the way you want but it does allow you to drop the decimal.. I understand what you want to do, I haven't seen a module that would do exactly what you want...if you can't find a one off solution for this...I'd suggest posting in the paid modules section to see if someone has the module but whose seo isn't getting picked up very high on search. cheers, fred Link to comment Share on other sites More sharing options...
comprausa Posted October 10, 2012 Author Share Posted October 10, 2012 Yes I am aware thanks for the tip anyways. Right now I have that currency configured without decimals, but with 6 digit prices if I cant round up to the nearest Zero the prices look funny and disorganized and site look too busy. They look more like codes instead of prices: 134.788 500.234 128.911 Very unpleasant for visitors! Anyhow, thanks for the help! I'll wait to see if someone has a quick modification for this. Jorge Link to comment Share on other sites More sharing options...
El Patron Posted October 10, 2012 Share Posted October 10, 2012 Yes I am aware thanks for the tip anyways. Right now I have that currency configured without decimals, but with 6 digit prices if I cant round up to the nearest Zero the prices look funny and disorganized and site look too busy. They look more like codes instead of prices: 134.788 500.234 128.911 Very unpleasant for visitors! Anyhow, thanks for the help! I'll wait to see if someone has a quick modification for this. Jorge if you don't get any results pm me... review : http://php.net/manual/en/function.round.php if this function seems to meet your needs I'd be interested in creating a hack... Link to comment Share on other sites More sharing options...
comprausa Posted October 10, 2012 Author Share Posted October 10, 2012 Keep in mind the "." in the previous examples is not a decimal point but a thousand separator. Some countries use "." to separate thousand and "," for decimals. This is my case in the previous example. I believe the link you sent me makes reference only to decimal rounding (I'm not proficient in PHP, so I might be wrong) I'm surprised that with so many countries with high devaluation of currency which causes rounding of prices in tens, hundreds, and in cases even thousands, that Prestashop has not made a provision for this. I love the platform don't take me wrong! Just a comment ;-) Thanks. Link to comment Share on other sites More sharing options...
El Patron Posted January 28, 2013 Share Posted January 28, 2013 Hi, I just got around to addressing this with new module (in beta testing)...see my signature for our site to see how I manipulate decimals, configured from module. I don't have the non-decimal currency enabled on our site yet...but works on my test systems. Can't wait to release this. Link to comment Share on other sites More sharing options...
kimy Posted March 12, 2014 Share Posted March 12, 2014 Released module, Price Charming Multiple currency psychological pricing for decimal and non-decimal currencies. Customize your product price endings: xx.90 x,xx.98 x,990 bu currency. http://www.etiendas.co/en/44-prestashop-price-charming-psychological-pricing.html Hi, can your module round only the second decimal? I would like to have € and $ in the format: xx.x9 is this possible? Link to comment Share on other sites More sharing options...
El Patron Posted March 12, 2014 Share Posted March 12, 2014 Hi, can your module round only the second decimal? I would like to have € and $ in the format: xx.x9 is this possible? you can specify the two or three digit ending, usd 16.99, cop 14,990 for example but not xx.x9. also note: this module is only for tax excluded shops. http://www.prestashop.com/forums/topic/221705-module-prestashop-price-charming-psychological-smart-product-pricing-x99-xxxx98-x499/ the module will replace the ending for two/three digit ending. 1 Link to comment Share on other sites More sharing options...
kimy Posted March 12, 2014 Share Posted March 12, 2014 you can specify the two or three digit ending, usd 16.99, cop 14,990 for example but not xx.x9. also note: this module is only for tax excluded shops. http://www.prestashop.com/forums/topic/221705-module-prestashop-price-charming-psychological-smart-product-pricing-x99-xxxx98-x499/ the module will replace the ending for two/three digit ending. Rounding the first decimal in € and $ is to much of a jump for my costumers, But I like your work, I'm interested in buying the module if u fix these things. Second Decimal and tax included countries. Link to comment Share on other sites More sharing options...
El Patron Posted March 12, 2014 Share Posted March 12, 2014 Rounding the first decimal in € and $ is to much of a jump for my costumers, But I like your work, I'm interested in buying the module if u fix these things. Second Decimal and tax included countries. jajajaja..fix these things, in my world, relates to free customization.nice try... .jajajaja... price charming is for the yank market...we won't buy anything unless you do a little charming...and we are not required to 'include taxes' when there even are taxes. on top of that there is 'no way' to cleanly charm prices with ps tax included... because of ps implementation of product class...hoping 1.6+ makes developing in this area easier, then we give you whatever you fancy...load I can do...but limited by my environment. if you want customization...I'd post in paid, you get some hot shots that fix you up no problem...at very reasonable rates. I'll do it or 1,000,000 euros, i know that sounds like a lot but then I only need one of those jobs. happy spring Link to comment Share on other sites More sharing options...
kimy Posted March 12, 2014 Share Posted March 12, 2014 jajajaja..fix these things, in my world, relates to free customization.nice try... .jajajaja... price charming is for the yank market...we won't buy anything unless you do a little charming...and we are not required to 'include taxes' when there even are taxes. on top of that there is 'no way' to cleanly charm prices with ps tax included... because of ps implementation of product class...hoping 1.6+ makes developing in this area easier, then we give you whatever you fancy...load I can do...but limited by my environment. if you want customization...I'd post in paid, you get some hot shots that fix you up no problem...at very reasonable rates. I'll do it or 1,000,000 euros, i know that sounds like a lot but then I only need one of those jobs. happy spring free customization, maybe, maybe not? but the module is useless for alot of webshops it it can't do this. I was just thinking that I was in your interest to sell the module? but if it's a hard thing to do, programming wise, I understand. Link to comment Share on other sites More sharing options...
dferbas Posted May 9, 2016 Share Posted May 9, 2016 Is there any module for shops with VAT? Link to comment Share on other sites More sharing options...
Plenka65 Posted September 12, 2016 Share Posted September 12, 2016 Released module, Price Charming Multiple currency psychological pricing for decimal and non-decimal currencies. Customize your product price endings: xx.90 x,xx.98 x,990 bu currency. http://www.etiendas.co/en/44-prestashop-price-charming-psychological-pricing.html Released module, Price Charming Multiple currency psychological pricing for decimal and non-decimal currencies. Customize your product price endings: xx.90 x,xx.98 x,990 bu currency. http://www.etiendas.co/en/44-prestashop-price-charming-psychological-pricing.html Will this module also round if I'm NOT using decimals? I.e, for $17 I want $19 as a result For £3 I want £5 as a result. Can it be set so? Please let me know. Link to comment Share on other sites More sharing options...
El Patron Posted September 12, 2016 Share Posted September 12, 2016 Released module, Price Charming Multiple currency psychological pricing for decimal and non-decimal currencies. Customize your product price endings: xx.90 x,xx.98 x,990 bu currency. http://www.etiendas.co/en/44-prestashop-price-charming-psychological-pricing.html Released module, Price Charming Multiple currency psychological pricing for decimal and non-decimal currencies. Customize your product price endings: xx.90 x,xx.98 x,990 bu currency. http://www.etiendas.co/en/44-prestashop-price-charming-psychological-pricing.html Will this module also round if I'm NOT using decimals? I.e, for $17 I want $19 as a result For £3 I want £5 as a result. Can it be set so? Please let me know. do you have a tax excluded shop? What currency are you working with. This module is for charming end of prices, if you use a decimal bases currency and don't display decimals then module for tax excluded shop would not work....because there is nothing to charm. 1 Link to comment Share on other sites More sharing options...
Plenka65 Posted September 13, 2016 Share Posted September 13, 2016 (edited) do you have a tax excluded shop? What currency are you working with. This module is for charming end of prices, if you use a decimal bases currency and don't display decimals then module for tax excluded shop would not work....because there is nothing to charm. Yes, I have tax excluded shop I'm working with $ and €. I do not have decimals on pricing tags. So I guess I need to create multi-shop settings for separate currencies, just to be able to 'round' separate currencies. Edited September 13, 2016 by Plenka65 (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted September 13, 2016 Share Posted September 13, 2016 for tax excluded, and where you use decimals you can use my Price Charming module. But you will need to use decimals. https://www.prestashop.com/forums/topic/221705-module-prestashop-price-charming-psychological-smart-product-pricing-x99-xxxx98-x499/ there would be no reason for a multishop whichever way you choose to go, you may have needs that require custom code if this or another rounding module or published technique does not fit your requirements. happy day, el 1 Link to comment Share on other sites More sharing options...
Experience of Design Posted October 7, 2017 Share Posted October 7, 2017 (edited) Easy solution for this problem, i solve problem in admin, where was screened only price witnout decimals. Function displayPrice scanned two different settings. Problem is in $c_decimal was 1 and _PS_PRICE_DISPLAY_PRECISION_ was ZERO. In version 1.6+ add condition (line 658-660, 666-668 when currency is object or array) for different currencies and works great in both, admin, front. public static function displayPrice($price, $currency = null, $no_utf8 = false, Context $context = null) { if (!is_numeric($price)) { return $price; } if (!$context) { $context = Context::getContext(); } if ($currency === null) { $currency = $context->currency; } elseif (is_int($currency)) { $currency = Currency::getCurrencyInstance((int)$currency); } if (is_array($currency)) { $c_char = $currency['sign']; $c_format = $currency['format']; $c_decimals = (int)$currency['decimals'] * _PS_PRICE_DISPLAY_PRECISION_; $c_blank = $currency['blank']; if ($currency["iso_code"] == "EUR") { $c_decimals = 2; } } elseif (is_object($currency)) { $c_char = $currency->sign; $c_format = $currency->format; $c_decimals = (int)$currency->decimals * _PS_PRICE_DISPLAY_PRECISION_; $c_blank = $currency->blank; if ($currency->iso_code == "EUR") { $c_decimals = 2; } } else { return false; } if ($context->currency->iso_code == "EUR") { $c_decimals = 2; } $blank = ($c_blank ? ' ' : ''); $ret = 0; if (($is_negative = ($price < 0))) { $price *= -1; } $price = Tools::ps_round($price, $c_decimals); ...and etc. Good luck all. Edited October 7, 2017 by Experience of Design (see edit history) 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