How would I go about setting currency accordingly to language?

I have just installed Commerce Multicurrency a great module, but I would also like to set currency accordingly to the chosen language setting.

So for example that if the user enters the Swedish site the currency is in SEK and if the user enters the Danish site the currency is in DKK. I have been clicking a lot in rules and I can say for sure that I'm not a rules master, but my question is, can this be done by rules?

In an ideal world I would like to have the multicurrency module overrule the language setting, that would mean that the if the cookie set by the commerce multicurrency module was set the language setting would be ignored.

So I was thinking if it would be a good way to check using hook_language_init which language was set and on behalf of the language setting convert the currency (only if the user cookie wasn't set by the commerce multicurrency module) and then store the current language setting as a user cookie which would be used next time the hook_init_language was called. And in the event of language change I would convert the currency and do the same all over.

Does this make any sense? Is there better ways of doing this?

Any input would be much appreciated.

Thanks, Chris

Posted: Jan 19, 2012


CosticaPuntaru on September 17, 2013

add a rule
ad event on calculate sell price
add condition for your desiered language(i so that rules extras has a condition for this)
for condition i used php condition :
global $language;
return $language->language=='en';

and for action use set user currency to the one you want

you need to make a rule for each language