Jump to content

Change Language based on selected Currency


nimonogi

Recommended Posts

Hello,

 

Any help will be greatly appreciated...

 

I want the following form to change both language and currency when user change the selected currency.

 

Original form - changes currency:

<form method="post" action="{php}echo $_SERVER["REQUEST_URI"];{/php}">
 <p class="header">{$LANG.choosecurrency}</p>
 <p>
 <select name="currency" onchange="submit()">{foreach from=$currencies item=curr}
<option value="{$curr.id}"{if $curr.id eq $smarty.session.currency} selected{/if}>{$curr.code}</option>
{/foreach}</select>
   <input type="submit" value="{$LANG.go}" />
  </p>
</form>

 

 

Modified form - changes currency and language - not working:

<form method="post" action="{php}echo $_SERVER["REQUEST_URI"];{/php}">
 <p class="header">{$LANG.choosecurrency}</p>
 <p>
 <select name="currency" onchange="submit()">{foreach from=$currencies item=curr}
<option value="{$curr.id}&language=lang{$curr.id}"{if $curr.id eq $smarty.session.currency} selected{/if}>{$curr.code}</option>
{/foreach}</select>
   <input type="submit" value="{$LANG.go}" />
  </p>
</form>

Expected result: "?currency=2&language=lang2"

Any ideas on how to do this?

 

Needed files are already created and working fine when i'm visiting "domain.com/?currency=2&language=lang2".

 

Thanks.

Link to comment
Share on other sites

I have found this solution which is working:

<select name="currency" onchange="window.location.href='?currency='+this.options[this.selectedIndex].value+'&language=lang'+this.options[this.selectedIndex].value;">

Any suggestion/comment?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

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