Jump to content

[GUIDE] How to configure/customize your currency in Prestashop 1.7


BlackEdition

Recommended Posts

Hi,
 
I was struggling to find a solution in my previous thread and I couldn't find any help:
https://www.prestashop.com/forums/topic/601623-how-to-change-currency-symbol-that-appears-next-to-the-price-prestashop-v1706/
 
Before we begin, let me explain to you what's going on here...
 
As you all know, in previous Prestashop versions like 1.6, you were able to fully customize your currency in your back office as you can see:
post-1302518-0-29173000-1493808435_thumb.png
 
But currently, the new Prestashop 1.7 doesn't allow you to customize your currency in your own liking as you can see below:
post-1302518-0-42010900-1493808627_thumb.png
 
They decided to use cldr framework for currency formatting which basically means that they used default settings from an external database (or something like that), and you can't customize that easily. Like me and many others, we can't wait for an official update to fix this so we have to find a workaround for now until they decide to fix it in the next updates. Since PS1.7 is still fairly new and not many people have moved to it yet, I wasn't able to find help about how to configure the currency for my language. Also just to eliminate any confusion in the steps below, my store language is in Arabic and my currency is in Saudi Riyal or SAR. Our language is RTL (right to left) unlike most languages, so it is usually harder to find solutions that also works for our language, but you can relax as all the steps below should remain the same for every language.
 
Anyway now that I have finally found a way to customize my currency, I decided to write this post as I'm sure there are plenty of people out there looking for solutions and were struggling too just like me.
 
***IMPORTANT: PLEASE BACK UP THE FILES BEFORE YOU EDIT THEM IN CASE YOU MESS UP. I'M NOT RESPONSIBLE IF SOMETHING GOES WRONG IN YOUR STORE OR YOUR PRICES. ALWAYS REMEMBER TO SWITCH YOUR STORE TO MAINTENANCE MODE WHEN YOU ARE CUSTOMIZING ANYTHING RELATED TO PRICES/CURRENCY, AND CHECK YOUR PRICES AFTER YOU FINISH TO MAKE SURE EVERYTHING IS WORKING OK BEFORE YOUR STORE GOES LIVE.

 

Now let's begin...
 
In my case, the price in my store looks like this:
post-1302518-0-26023700-1493808934_thumb.png
 
There are a couple of things wrong about the default price/currency formatting for my ar-sa language.
 
1- We use decimals instead of commas (it should be 0.00 instead of 0,00).
2- We mostly round up the price meaning there's no need for decimals, so they have to give us the option to enable/disable decimals (it should be 0 instead of 0.00).
​3- We don't usually use letters in the currency, we use the word Riyal instead (just like Euro).
4- The currency is placed before the price, but it should be after the price (to the left).
 

​Forgive me as I'm not interested in using decimals in my store so I didn't bother to try and fix #1, but you can find all the other fixes below.

 

 

 

 

 

- How to fix #2: Disabling decimals. (Thanks to Poppy381)
https://www.prestashop.com/forums/topic/573475-tips-to-round-prices-with-no-decimals-displayed-with-prestashop-17/

 

NOTE: Please only do this when you want to completely remove decimals in your store and you don't plan to use them ever again because it will change the pricing for your store (example: if you set a product price to 99.99 it will show as 100 in your front office so be careful).

 

 

 

 

 

- How to fix #3: Configuring currency letters/symbol.
 
First open the file: translations/cldr/main--ar-SA--currencies​ (choose the language file that you want to edit, in my case it's ar-sa).
Now search for the currency that you want to customize (example USD, EUR, GBP...etc) for me it's SAR and this is the entire code that corresponds to it:
post-1302518-0-59302500-1493811455_thumb.png

"SAR":{"displayName":"\u0631\u064a\u0627\u0644 \u0633\u0639\u0648\u062f\u064a","displayName-count-zero":"\u0631\u064a\u0627\u0644 \u0633\u0639\u0648\u062f\u064a","displayName-count-one":"\u0631\u064a\u0627\u0644 \u0633\u0639\u0648\u062f\u064a","displayName-count-two":"\u0631\u064a\u0627\u0644 \u0633\u0639\u0648\u062f\u064a","displayName-count-few":"\u0631\u064a\u0627\u0644 \u0633\u0639\u0648\u062f\u064a","displayName-count-many":"\u0631\u064a\u0627\u0644 \u0633\u0639\u0648\u062f\u064a","displayName-count-other":"\u0631\u064a\u0627\u0644 \u0633\u0639\u0648\u062f\u064a","symbol":"\u0631.\u0633.\u200f"}

However we are only interested in the code at the last of the line, right after "symbol":

"symbol":"\u0631.\u0633.\u200f"

It is using Unicode characters and you can use this website to find the right characters for yourself http://graphemica.com

The above default symbol for my currency will show as "ر.س." and to change that to "ريال" replace the characters with the following:

"symbol":"\u0631\u064a\u0627\u0644\u200f"

Now save the file. It will now look like this:

post-1302518-0-80573600-1493812267_thumb.png

 

 

 

 

 

- How to fix #4: Changing currency position. (Right/left and with/without spaces).

 

First open the file: translations/cldr/main--ar-SA--numbers​ (choose the language file that you want to edit, in my case it's ar-sa).

This is similar to fix #3, all you have to do is search for the following "currencyFormats-numberSystem-latn" -OR- "currencyFormats-numberSystem-arab" (it's the second one for me because I'm using Arabic language, but most people should edit latn instead).

 

Now in the same line that corresponds to it look for the code "standard" because that's the only thing we have to edit:

"standard":"\u00a4\u00a0#,##0"

The above default position for my currency will be before the price, and to correct that and make it appear after the price just replace the characters with the following:

"standard":"#,##0\u00a0\u00a4\u00a0"

Now don't forget to save the file. It will now look like this:

post-1302518-0-57797900-1493810601_thumb.png

 

Perfect! and that's it! everything about numbers and currency formatting in PS1.7 will be related to both files "currencies" & "numbers", so don't waste your time looking elsewhere.

 

Congratulations...now you finally know how to customize your currency in Prestashop 1.7! I hope this works for everybody and I hope I was able to provide some help for this community :D

Edited by BlackEdition (see edit history)
  • Like 7
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
Hi, I follow your instruction step by step but the problem still persist. I want to change rupiah so it use it's symbol instead of it's iso code. But the code inside cldr appears already using symbol Rp, but why it is displayed differently (using it's iso code). I also try http://graphemica.com/ to retype Rp. but the problem still persist. Looking forward to your help. Thank You...

 

IDR":{"displayName":"Rupiah Indonesia","displayName-count-other":"Rupiah Indonesia","symbol":"Rp","symbol-alt-narrow":"Rp"},

 

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

I found the following solution:
1) Enter cpanel and enter file manager
2) I followed this path (public_html / translations / cldr), and enter the file main - es - ES - currencies, I actually see two the first one I just wrote and this other main - es - PE - currencies , However enter the first as it is the language version that I am using in my store since in the second comes a mixture of Spanish with English, attached the first image.
3) Look for the symbol that was trying to change that in my case was the PEN and after a certain time I found it, it's a shame that I do not have an eagle eye, attached second image
4) As my goal is to change the symbol that you see PEN say now that you say Soles, inside the bracket where I have selected in the image attached above look for this "symbol": "PEN" and now change it to "symbol ":" Soles "and I gave you save, attached third image
5) Finally it came to change, as you can see in the last image attached.

Note: on the main page of my shop the prices of the products does not appear the word Soles, before starting all this showed me indicating PEN but since I make the change appears in the rest of pages but not in the main page, for more Cache cleaning I have performed does not show it, attached image

 

It is for version 1.7.1.2 that I am currently using I imagine it will be the same for all other versions of 1.7

post-1391352-0-14998000-1501617440_thumb.jpg

post-1391352-0-96945800-1501617456_thumb.jpg

post-1391352-0-10462000-1501617474_thumb.jpg

post-1391352-0-65603300-1501617481_thumb.jpg

post-1391352-0-58500000-1501617489_thumb.jpg

Edited by suplemaxperu89 (see edit history)
Link to comment
Share on other sites

  • 7 months later...
  • 3 months later...
On 03.05.2017 at 3:10 PM, BlackEdition said:


1- We use decimals instead of commas (it should be 0.00 instead of 0,00).

 

 

I have solved it by edit /translations/cldr/main--es-ES--numbers    

I changed:

"symbols-numberSystem-latn":{"decimal":".","group":","

to

"symbols-numberSystem-latn":{"decimal":".","group":"."

 

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
On 5/4/2017 at 12:44 PM, BlackEdition said:

I just figured out how to change the currency position to appear after the price. I updated my original post with all the information.

 

Do you know how to change the digits as well from 1,2,3 to ١,٢,٣?

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

There seems to be a change in Prestashop 1.7.6
https://devdocs.prestashop.com/1.7/modules/core-updates/1.7.6/

Quote

The CLDR is a component responsible of displaying data such as the date & time, prices depending on a given language. It was reworked during several versions of PrestaShop 1.7, and will be enabled with 1.7.6. The previous one has been removed, and trying to use it will end to an exception.

A new variable is now available in the Context when going through a controller:

Does anybody know how to change the decimal dot in Prestashop 1.7.6  (0.00 instead of 0,00) ?

Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...
On 6/26/2018 at 2:55 AM, Yuriy said:

I have solved it by edit /translations/cldr/main--es-ES--numbers    

I changed:

"symbols-numberSystem-latn":{"decimal":".","group":","

to

"symbols-numberSystem-latn":{"decimal":".","group":"."

 

In the current version of Prestashop 1.7.8.* you can find it in your corresponding language xml file in the following folder:

\localization\CLDR\core\common\main

image.thumb.png.bfd5e7615851e939e6397557895d31df.png

  • Thanks 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...