sshare Posted January 19, 2015 Share Posted January 19, 2015 (edited) Hi Guys,I'm trying to add a link to the headerlink to a plain HTML site, however I would like it to send the people to the page in the language that they are already on in Prestashop. For example if they are using the shop in French I want to send them to domain.com/fr/index.html, English to go to domain.com/en/index.html, and so on. I've tried a couple of things trying to use an if statement as follows, but no luck as of now; <li><a href="http://www.domain.com/{if $language->id == 1}en/index.html{/if}{if $language->id == 3}es/index.html{/if}">{l s='distribution'}</a></li> Also: <li><a {if $language->id == 1}href="http://www.domain.com/en/index.html"{/if}{if $language->id == 3}href="http://www.domain.com/es/index.html"{/if}>{l s='distribution'}</a></li> I then got desperate and tried: {if $language->id == 1}<li><a href="http://www.domain.com/en/index.html">{l s='distribution'}</a></li>{/if} {if $language->id == 3}<li><a href="http://www.domain.com/es/index.html">{l s='distribucion'}</a></li>{/if} But same no luck. Some of you will probably laugh at the above code Is it possible to do something like this? Any input is highly appreciated. Edited January 19, 2015 by sshare (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 19, 2015 Share Posted January 19, 2015 {if $lang_iso=="en"} <a href="link english">english</a> {elseif $lang_iso=="it"} <a href="link italian">italian</a> {elseif $lang_iso=="es"} <a href="link spanish">spanish</a> {/if} Link to comment Share on other sites More sharing options...
sshare Posted January 19, 2015 Author Share Posted January 19, 2015 Thanks Milos, I'll give it a go. I found another "solution" on the French forum where someone used the translation files to edit the link, although not sure if that would be considered correct? Link to comment Share on other sites More sharing options...
vekia Posted January 19, 2015 Share Posted January 19, 2015 if your url will contain special chars - it can generate some problems :-) anyway, if it works now, don't worry about that :-) Link to comment Share on other sites More sharing options...
sshare Posted January 19, 2015 Author Share Posted January 19, 2015 (edited) Am trying it now, will report back. Off Topic, do you have any idea on this please? ( https://www.prestashop.com/forums/topic/393140-voucher-problem-amount-added-to-tax/ ) Edited January 19, 2015 by sshare (see edit history) Link to comment Share on other sites More sharing options...
sshare Posted January 19, 2015 Author Share Posted January 19, 2015 It works Milos, many thanks for the super quick help on this one. I will mark my topic as solved. Link to comment Share on other sites More sharing options...
wiseprt Posted July 30, 2015 Share Posted July 30, 2015 Hello, I have a custom .html file in my prestashop and want to show different content depending on language. So tried to use inside .html file the following but is not working. I got errors. <?php {if $lang_iso=="el"} ?> <div>the greek content </div> <?php {else} ?> <div> the english content</div> <?php {/if} ?> As this is not a .php or .tpl file i don't know how to make it works. Please if is possible i want a quick answer. Thank you Best Regards Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now