Jump to content

Live Chat HTML script per language


Recommended Posts

Hello,

 

I want to use a live chat software in my multi language prestashop webshop (1.6). 

Per language there is a chat widget with its corresponding html code, which I need to place inside the body tag of the webshop.

 

This is the code I placed in my header.tpl

 

<script>

(function() {
 var hostname, insertScript, widget_com, widget_nl;
 widget_nl = "bb3dbbbf230546b";
 widget_com = "dc818cfdfb5376e";
 insertScript = function(id) {
 var src;
 src = "//s3-eu-west-1.amazonaws.com/userlike-cdn-widgets/" + id + ".js";
 return document.write('\x3Cscript type="text/javascript" src="' + src + '">\x3C/script>');
 };
 hostname = document.location.hostname;
 if (hostname.match(/\.com$/)) {
 return insertScript(widget_com);
 } else {
 return insertScript(widget_nl);
}
})();
</script>
</body>
 
However I can only make one language widget work for both language in my webshop. 
I don't know much about html and such, so can someone pleas help me?
 
kind regards,
Kristof
Link to comment
Share on other sites

So there's different script code for each language? You can use code like the following:
{if $cookie->id_lang == 1}
Put script code for language 1 here
{elseif $cookie->id_lang == 2}
Put script code for language 2 here
{/if}

 Add as many {elseif} statements as needed.

Link to comment
Share on other sites

 

So there's different script code for each language? You can use code like the following:
{if $cookie->id_lang == 1}
Put script code for language 1 here
{elseif $cookie->id_lang == 2}
Put script code for language 2 here
{/if}

 Add as many {elseif} statements as needed.

 

 

 

Hey Rocky,

 

It is working.

Thanks for the help! 

  • Like 1
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...