zwaantje89 Posted August 24, 2016 Share Posted August 24, 2016 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 More sharing options...
rocky Posted August 25, 2016 Share Posted August 25, 2016 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 More sharing options...
zwaantje89 Posted August 25, 2016 Author Share Posted August 25, 2016 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! 1 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