Jump to content

[SOLVED] Adding an external link to the headerlinks dependent on language


Recommended Posts

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 by sshare (see edit history)
Link to comment
Share on other sites

  • 6 months later...

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

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...