Jump to content

Change default language programmatically?


Recommended Posts

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)
Link to comment
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
×
×
  • Create New...