default currency depending on language

  • Posts: 19
  • Thank you received: 0
13 years 8 months ago #8776

Hi,

I am using Hikashop Essential so I have no option of using the geolocation plugin for this issue.

It would be very useful for me to change the displayed (default) currency according to the joomfish language the user switched to on my page.
e.g. If the user switches to czech language, the prices are shown in czech crowns.
In addition I will display the currency switcher module for languages that are not associated with only one currency (e.g. english).

Is there a possibility to "link" the language and the currency?

Thanx in advance

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
13 years 8 months ago #8777

Hi,

Just to avoid any misunderstanding: you can upgrade from hikashop essential to hikashop business on that page: www.hikashop.com/en/component/hikashop/product/show/cid-3.html

You would have to edit the joomfish code where the language is switched to force the currency_id. You could add something like this:
$app =& JFactory::getApplication();
$app->setUserState('com_hikashop.currency_id',XX);

where XX is the id of the currency.

Last edit: 13 years 8 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 19
  • Thank you received: 0
13 years 8 months ago #8888

Hi Nicolas,

maybe I will switch to business.

If I add that code, as you said, XX would be the id of the language (the Joomfish-language-code I assume).
But is XX not the specific currency_id value?

Thanx,
kohypon

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
13 years 8 months ago #8910

Sorry, it's a typo. It's the currency id and not the language id.

Please Log in or Create an account to join the conversation.

  • Posts: 34
  • Thank you received: 0
13 years 7 months ago #12116

It makes really good sense to be able to switch the currency when a different language is chosen. The mentioned code above I presume could do the job but in what joomfish file does it need inserted? I presume its somewhere in the mod_jflanguageselection?


David Craig
Hikashop 1.5.0 Business edition
www.charitycanvasprints.com

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
13 years 7 months ago #12119

I don't know but you might want to ask on the joomfish forum ? They are the specialists :)
Or maybe kohypon will answer you ?

Please Log in or Create an account to join the conversation.

  • Posts: 34
  • Thank you received: 0
13 years 7 months ago #12144

Thanks Nicolas, if I get a response from Joomfish forums I'll post back here.

Language and currency are by nature 'nearly' but not always linked...I know Spanish doesn't always link to Euros such as in latin America.
So here's another need; How can you change the language when the currency changes?

In my case this is to avoid a customer ordering a metric size using dollars when the imperial size is what he should see as that what is used and shipped to the US.


David Craig
Hikashop 1.5.0 Business edition
www.charitycanvasprints.com

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
13 years 7 months ago #12145

Well, the problem will be similar in the other way around.
There are a lot of languages in the euros zone so when someone selects the euro currency which language will you use ?

That's why we decided to use the geolocation of the user IP in order to select the currency automatically based on where the user is.
For the language selection, that should actually be handled automatically by joomfish based on the language of the browser.

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 0
13 years 1 month ago #25853

If anyone found/finds a solution to this please let me know! :)


Create your own style of luxury bespoke furniture online

Please Log in or Create an account to join the conversation.

  • Posts: 174
  • Thank you received: 2
  • Hikashop Business
12 years 7 months ago #44154

any news about this together with Falang? Stephane told to contact you nicolas about that...

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
12 years 7 months ago #44369

With Joomla 2.5, the language will be selected automatically based on the browser language.

Regarding the currency displayed, you can still do that with the geolocation system in HikaShop.

Please Log in or Create an account to join the conversation.

  • Posts: 174
  • Thank you received: 2
  • Hikashop Business
12 years 7 months ago #44393

geolocation does not answer this question in 100%
There must be possibility to assign currency to language.
Ofcourse you can paste this:

if ($lang->get('tag') == "lt-LT" ) {
$app->setUserState('com_hikashop.currency_id',XX);
}
elseif ($lang->get('tag') == "en-GB") {
$app->setUserState('com_hikashop.currency_id',XX);
 }
to 19th row of mod_falang.php (where XX is your currency ID) but the problem is not solved in 100% too.
Currency changes, but page needs to refresh before you actually can see it.

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
12 years 7 months ago #44398

You could just do a redirect like that:
header('Location: '.$_SERVER);

but you need to do it only when the currency was not set previously. So like that:

if(!$app->getUserState('com_hikashop.currency_id',0)){
if ($lang->get('tag') == "lt-LT" ) {
$app->setUserState('com_hikashop.currency_id',XX);
}
elseif ($lang->get('tag') == "en-GB") {
$app->setUserState('com_hikashop.currency_id',XX);
 }
header('Location: '.$_SERVER['REQUEST_URI']);
}

Please Log in or Create an account to join the conversation.

  • Posts: 174
  • Thank you received: 2
  • Hikashop Business
12 years 7 months ago #44413

nicolas, that doesn't work

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
12 years 7 months ago #44414

That was just a suggestion.
Why it doesn't ?

Please Log in or Create an account to join the conversation.

  • Posts: 174
  • Thank you received: 2
  • Hikashop Business
12 years 7 months ago #44422

i don't know :) your code doesn't do anything even if i refresh manually. Just nothing happens, where my code changes currency, but user needs to refresh or browse to somewhere to see changes.

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
12 years 7 months ago #44428

Ah yes, my code only works when you're a new user coming to the website. It won't change anything if you change the language of the website.

Please Log in or Create an account to join the conversation.

  • Posts: 174
  • Thank you received: 2
  • Hikashop Business
12 years 7 months ago #44430

any suggestions how to do that?

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
12 years 7 months ago #44431

I don't know.

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
12 years 2 months ago #62063

Where is the file mod_falang.php located? I can't find it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.135 seconds
Powered by Kunena Forum