Jump to content
andersbirkenstam

currency in lang code

Recommended Posts

Just now, andersbirkenstam said:

i found that i could put a currency in lang code like this below, but were do i add the code?

as per the documentation, it's normally used in links, e.g if you want to specify a currency or a language used when a client sees a page / product... what do you want to do with it ?

Share this post


Link to post
Share on other sites
50 minutes ago, andersbirkenstam said:

when they choose a lang it  change the currency english will be pounds and german euro and so on...

the simplistic way to do that would be to edit header.tpl and change...

<a href="{$currentpagelinkback}language={$locale.language}">{$locale.localisedName}</a>

to...

<a href="{$currentpagelinkback}language={$locale.language}{if !$loggedin}{if $locale.language eq 'english'}&currency=1{elseif $locale.language|in_array:['catalan','dutch','french','german','italian','portuguese-pt','spanish']}&currency=14{/if}{/if}">{$locale.localisedName}</a>

you'd have to change the currency values to suit your own installation settings, but it would work and would only apply to clients who were not logged in - as clients cannot change their currency.

one problem with this solution would be those users that chose English as their language - are they from the UK (Pound), Ireland (Euro), USA (USD), Australia (AUD), New Zealand (NZD) ???

therefore, it might be better for you to use the free Geolocation Hook from ModulesGarden - with that, you can define a language and/or currency for each country and will therefore be more accurate than the above code.

Quote

Automate the switch of a currency, language or even the template of your WHMCS client area depending on the location of your audience. Upon detection of a country from where each of your visitors is, these crucial elements of your website will be adjusted instantly to secure customer experience that is personalized to perfection.

Under quick and very simple configuration, you will be able to benefit from MaxMind GeoIP2 or apply your own submodule to identify the location of not logged in users. As another option, you can choose the template to be changed according to the device used, be it a tablet or a mobile, or even the domain your visitor was redirected from. The hook will grant you the flexibility to select specific pages of your website where the alteration of its components should be performed. It will be also up to you whether to permit your clients to personally switch the currency.

Share this post


Link to post
Share on other sites
19 hours ago, andersbirkenstam said:

super thx Brian it works amazing 🙂

which one - my quick hack or the ModulesGarden hook ??

Share this post


Link to post
Share on other sites

Hello,

 

I need your help please. I already have English an Spanish versions of my website and I'm working on Portuguese translation. 

The link I normally use to provide a Spanish version of the order page looks like this: https://mywebsite.com/cart.php?a=add&pid=2currency=2&language=Spanish

That doesn't work for the Portuguese version when I make it  https://mywebsite.com/cart.php?a=add&pid=2currency=2&language=Portuguese

 

Waiting for your answer.

 

Thanks

Share this post


Link to post
Share on other sites
On 05/04/2019 at 12:58, ETS said:

That doesn't work for the Portuguese version when I make it  https://mywebsite.com/cart.php?a=add&pid=2currency=2&language=Portuguese

there are two different Portuguese language files in WHMCS - one for Portuguese and another for Portuguese (Brazil)..

  • for customers using Portuguese, the link would be -> https://mywebsite.com/cart.php?a=add&pid=2currency=2&language=portuguese_pt
  • if you have customers using Portuguese (Brazil), the link would be -> https://mywebsite.com/cart.php?a=add&pid=2currency=2&language=portuguese_br (you might need to change the currency value for Brazilian customers).

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated