Jump to content
Ravingmad

Change default language programmatically?

Recommended Posts

Hello,

I saw this tutorial about changing the default currency using a popup. I bought the module and I'm now trying to change the code to change the default language instead.

Could someone help me modify the code to adapt it to my need?

 

Thanks.

 

Share this post


Link to post
Share on other sites

Which module are you using? It's really hard to guide you without seeing any code

Share this post


Link to post
Share on other sites

Which module are you using? It's really hard to guide you without seeing any code

I linked to the tutorial in my first post. I'm using PopUp Pro. And I'm using this tutorial :

 

https://mypresta.eu/en/art/developer/responsive-popup-with-currency-selection.html

 

I tried switching "setCurrency" to "countries" and to "setLanguage" and neither worked. I also tried this : 



     $id_lang=(int)Tools::getValue('id_lang');
    $default_lang =Configuration::updateValue('PS_LANG_DEFAULT',$id_lang);

And it didn't work.

 

I also tried changing the language cookie but for some reason when I type in "cookie->" the ">" changes into ">" in the Popup Pro module so I couldn't change the cookie.

 

The code that I'm trying to edit changes the currency perfectly but I'm trying to modify it to do the same to language.

 

The code in question : 

 

 

<h2 style="text-align: center;">Select your currency</h2>
<ul class="popupcurrencies">
<li onclick="setCurrency(1); $.closeOverlay();"><a rel="nofollow" title="Pound (GBP)">(GBP)<br />Pound</a></li>
<li onclick="setCurrency(2); $.closeOverlay();"><a rel="nofollow" title="Z�oty (PLN)">(PLN) <br />Z�oty</a></li>
<li onclick="setCurrency(3); $.closeOverlay();"><a rel="nofollow" title="Euro (EUR)">(EUR) <br />Euro</a></li>
<li onclick="setCurrency(4); $.closeOverlay();"><a rel="nofollow" title="Dollar (USD)">(USD) <br />Dollar</a></li>
</ul>
<style>
.popupcurrencies {
list-style:none;
margin:auto;
display:block;
min-width:450px;
clear:both; overflow:hidden;
}
.popupcurrencies li a {
display:inline-block;
background: #FE5F55;
color:#F0B67F;
font-size:14px;
font-weight:bold;
text-align:center;
padding:20px;
border-radius:4px;
width:100px;
float:left;
margin:5px;
cursor:pointer;
}
 
.popupcurrencies li a:hover {
background:#FF8077;
}
</style>

And by the way. By "didn't work" I mean it literally didn't do anything. Clicking the button didn't even close the overlay.

Edited by Ravingmad (see edit history)

Share this post


Link to post
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More