General Topics > General Discussion

Is .– instead of .00 commonly used worldwide for displaying round prices?

(1/1)

OneMore:
In my country, it is common not showing cents for round prices, and replacing them with a dot and a dash, like 59.– instead of 59.00 .

Is this way of displaying prices is commonly understood worldwide or only in my country?

If known at international level, I will implement it in the templates used by my shop with code like:

--- Code: ---<?php echo str_replace('.00','.&ndash;',$price); ?>
--- End code ---

Nuno Neff:
Portugal  uses 55.00€

Although I think it looks ugly, it should be 55€

llegrand:
You can set the number of decimal places showing within the System > Settings> localization > currencies
https://abantecart.atlassian.net/wiki/spaces/AD/pages/15270043/Add+or+Edit+Currency

OneMore:
Thank you Nuno.

So here's my quick implementation of a price beautifier.

A) Removing decimals in prices on PRODUCT PAGES
In 'storefront/view/default/template/pages/product/product.tpl', after line 94 (i.e. after the "if ($display_price){}" sandwich), add:

--- Code: ---// Remove decimals for prices ending with ".00", for both special and normal prices.
           if (strpos($special,'CHF')) {
                $special=  str_replace('.00','.&ndash;',$special);
              } else {
                $special = str_replace('.00','',$special);
              }
          if (strpos($price,'CHF')) {
                $price=  str_replace('.00','.&ndash;',$price);
              } else {
                $price = str_replace('.00','',$price);
              }
--- End code ---

How does it work
If the product price contains "CHF" (Swiss Franc), it will replace ".00" by ".–".
For all other currencies, it will replace ".00" by nothing.
This assumes you are only using the dot as separator for the trailing decimals".

Added 2024/02/27
B) Removing decimals in prices for FEATURED PRODUCTS
In 'storefront/view/default/template/blocks/product_list.tpl', after line 70:
1. Add

--- Code: ---$special = $product['special'];
$price = $product['price'];
--- End code ---
2. Copy and paste the aforementioned code that removes the decimals.
3. In the <div class="price"> ... </div> sandwich right after, replace echoed instances of $product['special'] by $special, and $product['price'] by $price.

Added 2024/02/27
C) Removing decimals in prices of products on CATEGORY PAGES
In 'storefront/view/default/template/pages/product/product_listing.tpl', after line 63, do the same as above for featured products.

Added 2024/02/27
Requirements
For the code above to work you need the decimal delimitor being the dot and not the comma.
Else, you would need to adapt the code.
To set the decimal delimitor:

* Go to "System -> Localization -> Language Definitions"
* In the "Key" field, write "decimal_point" and filter.
* Set the "decimal_point" as "." and save it.Suggestion for a better implementation
A better implementation would be creating an method, or modifying existing method, so that the same code can be re-used for all price formatting.
Another improvement would be adapting the code to deal with the effective decimal delimitor.

@llegrand: Sorry, but my question was about if the ".–" was international or used only in some countries like Switzerland.
Furthermore, setting the decimals to 0 is not what I wanted to do : 99.95 CHF must remain unchanged. Only 99.00 CHF should be displayed as 99.– CHF.

Burlesque:
The practice of omitting cents and using a dash to represent rounded prices is not a universal standard. It varies across different regions and cultures. In many countries, prices are commonly displayed with cents, and the use of a dash may not be a familiar convention.

If your target audience is primarily local and accustomed to this practice, implementing it in your templates could make sense for a more familiar and user-friendly experience. However, if your shop caters to an international audience, it's advisable to display prices in a way that aligns with broader expectations, which typically include showing cents.

Always consider the preferences and expectations of your specific audience to enhance their understanding and usability of your e-commerce platform.

Navigation

[0] Message Index

Go to full version
Powered by SMFPacks Social Login Mod