Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Currency and Language display

Currency and Language display

Views: 2,184

Results 1 to 6 of 6
24 Mar 2012, 3:21 PM
#1
athens_collectibles avatar

athens_collectibles

Zen Follower

Join Date:
May 2010
Location:
Athens, Greece
Posts:
293
Plugin Contributions:
0

Currency and Language display

I am puzzled with the way Zen Cart displays currencies. I have two languages installed, English and Greek and want prices to be displayed in GBP when in English and in EUR when in Greek pages.

I have set the default currency for each language as follows:

includes/languages/my_template/english.php

define('LANGUAGE_CURRENCY', 'GBP');

includes/languages/my_template/greek.php

define('LANGUAGE_CURRENCY', 'EUR');

I also have these settings in Admin:

Admin > Localization > Languages > English (default)
Admin > Localization > Currencies > Euro (default)
Admin > Configuration > My Store > Language Selector = Browser
Admin > Configuration > My Store > Switch To Default Language Currency = true

The idea behind the settings is:

  1. If a visitor's browser is in Greek, the Greek home page will load and prices will be displayed in EUR.

  2. If a visitor's browser is in English or any other language, the English home page will load with prices displayed in GBP.

What happens though is that calling https://www.athenscollectibles.info loads the English home page but with prices in EUR. Prices change to GBP only if English language is selected from the header. In this case, if the page is refreshed after a period of inactivity, the page remains in English but currency changes to EUR by itself.

I assume that this has to do with cookies expiring after a few minutes and, refreshing the page, causes the default currency to display rather than the currency defined in the language file. Although I don't know the inside workings of Zen Cart, I believe that the solution is to automatically reselect the language with each page refresh.

If this is the case, is there a way to force language selection with each page refresh? If this is only a false assumption, can anyone explain what's going on and how I can achieve the desired display of currencies?

P.S. I am on ZC 1.5 but the same happened before upgrading from 1.3.9h. I also have the Language/Currency Links in Header add on.

Thanks in advance for any help.

24 Mar 2012, 5:31 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

Re: Currency and Language display

Athens Collectibles:

...
I also have these settings in Admin:

Admin > Localization > Languages > English (default)
Admin > Localization > Currencies > Euro (default)
Admin > Configuration > My Store > Language Selector = Browser
Admin > Configuration > My Store > Switch To Default Language Currency = true

So, the default language is English and the default currency is Euro? Shouldn't the defaults match (i.e. English/Pound or Greek/Euro)?

24 Mar 2012, 5:54 PM
#3
athens_collectibles avatar

athens_collectibles

Zen Follower

Join Date:
May 2010
Location:
Athens, Greece
Posts:
293
Plugin Contributions:
0

Re: Currency and Language display

Shouldn't the defaults match (i.e. English/Pound or Greek/Euro)?This is done with the definitions in the language files and it works correctly once the language is selected with the relative flag. The problem is that the currency returns to Euro when the page is refreshed after some time, probably when cookies expire. :shocking:

24 Mar 2012, 7:14 PM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Currency and Language display

What if a Greek-speaking person, living in the UK, wants to see the site in GREEK, but the currency in GBP?

And what if an English-speaking person, living in Greece, wants to see the site in ENGLISH, but the currency in EURO?

Just let the viewer make their own choices... I know most customers are stupid, but I think they will know how to set a different language or currency.

24 Mar 2012, 7:37 PM
#5
athens_collectibles avatar

athens_collectibles

Zen Follower

Join Date:
May 2010
Location:
Athens, Greece
Posts:
293
Plugin Contributions:
0

Re: Currency and Language display

The first person would click on the Greek flag to change language and would select British Pound from the currency drop-down.

The second would click on the Union Jack to change language and would select Euro from the currency drop-down.

However, if all worked as intended, they would both have to change the currency only, assuming that their browsers were set in their native language.

Additionally, Britons living in the UK would not be required to do anything as they would see the site in English and Pound as the default currency. The same applies to Greeks living in Greece.

I understand that not everything can be automated but I'm trying to make things easier for as many people as possible, on the understanding that most customers are not very bright (that's a more elegant definition of stupid but has the same meaning).

Regardless of desired and available functionality, is my suspicion about expired cookies correct? If no, there must be something else causing the auto-change of currency. :cry:

24 Mar 2012, 7:38 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

Re: Currency and Language display

Athens Collectibles:

This is done with the definitions in the language files and it works correctly once the language is selected with the relative flag. The problem is that the currency returns to Euro when the page is refreshed after some time, probably when cookies expire. :shocking:

Right, but my unstated point is that your admin settings have the default of English and Euro; that might the the root cause of the refresh problem you described.

P.S. I do agree with schooboy's "let the customer choose" ...