croc Posted March 11, 2015 Share Posted March 11, 2015 Hello all, could somebody help me with this? I would like to insert script of chat form to any cms page, but via "Source code" in editor no success - in cms page is nothing displayed. (iframe are ON) script should be: <script type="text/javascript" id="ab_123456" src="//mydomain.com/chat/scripts/track.js"></script> <img src="//mydomain.com/chat/scripts/pix.gif" onLoad="LiveAgentTracker.createForm('g645h1g5', this);"/> After i save editation and check "source code" then its reduced to: <script src="//mydomain.com/chat/scripts/track.js"></script> <img src="//mydomain.com/chat/scripts/pix.gif" alt="pix.gif" /> (And each languague on website on cms page should have unique script.) Thanks for any helpfull tip. Link to comment Share on other sites More sharing options...
rocky Posted March 12, 2015 Share Posted March 12, 2015 I suggest that you add the JavaScript to the end of cms.tpl in your theme's directory. If you need to put it on a specific language of a CMS page, you can use code like the following: {if $smarty.get.id_cms == 4 && $cookie->id_lang == 1} English language Javascript goes here {elseif $smarty.get.id_cms == 4 && $cookie->id_lang == 2} French language Javascript goes here {/if} This will let you add different JavaScript for the English and French "About us" pages only. Change 4 to the ID of the page you want the JavaScript added and add more {elseif} statements for each language required. 1 Link to comment Share on other sites More sharing options...
croc Posted March 12, 2015 Author Share Posted March 12, 2015 I suggest that you add the JavaScript to the end of cms.tpl in your theme's directory. If you need to put it on a specific language of a CMS page, you can use code like the following: {if $smarty.get.id_cms == 4 && $cookie->id_lang == 1} English language Javascript goes here {elseif $smarty.get.id_cms == 4 && $cookie->id_lang == 2} French language Javascript goes here {/if} This will let you add different JavaScript for the English and French "About us" pages only. Change 4 to the ID of the page you want the JavaScript added and add more {elseif} statements for each language required. Hi rocky, thanks for your tip, it seems that you exactly understand my issue But I tried this and it do not work for me. It maybe it wants little customization. Could you check it please? Thanks Link to comment Share on other sites More sharing options...
rocky Posted March 12, 2015 Share Posted March 12, 2015 I just tested the code on my PrestaShop v1.6.0.14 test site and it works fine. When I add the code to the bottom of cms.tpl, it says "English language Javascript goes here" on my "About Us" page when English is selected and it says "French language Javascript goes here" when I switch to the French language. When I go to the "Terms and Conditions" page, there is no extra text at the bottom. Does this not happen on your website? If you can get the text to display like it did for me, then you should be able to replace the text with your script code. If you still can't get it to work, then you can send me a private message with your website details so I can check it out. Link to comment Share on other sites More sharing options...
croc Posted March 12, 2015 Author Share Posted March 12, 2015 (edited) Hi, I added this in the end and not working (using PS 1.6.0.9) {if $smarty.get.id_cms == 6 && $cookie->id_lang == 1} <script type="text/javascript" id="ab_123456" src="//mydomain.com/chat/scripts/track.js"></script> <img src="//mydomain.com/chat/scripts/pix.gif" onLoad="LiveAgentTracker.createForm('g645h1g5', this);"/> {elseif $smarty.get.id_cms == 6 && $cookie->id_lang == 2} <script type="text/javascript" id="ab_123456" src="//mydomain.com/chat/scripts/track.js"></script> <img src="//mydomain.com/chat/scripts/pix.gif" onLoad="LiveAgentTracker.createForm('abc12354', this);"/> {/if} by the way when i add it just single without languague sorting then it works (see code below): <script type="text/javascript" id="ab_123456" src="//mydomain.com/chat/scripts/track.js"></script> <img src="//mydomain.com/chat/scripts/pix.gif" onLoad="LiveAgentTracker.createForm('g645h1g5', this);"/> Edited March 12, 2015 by croc (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted March 12, 2015 Share Posted March 12, 2015 I just tested the code on my website and it is correctly being added. I am only getting a broken image, most likely because //mydomain.com doesn't actually exist. Try removing //mydomain.com from the URLs and make sure that the /chat/scripts/track.js and /chat/scripts/pix.gif exist on your server. Link to comment Share on other sites More sharing options...
croc Posted March 12, 2015 Author Share Posted March 12, 2015 (edited) hmmm, I really tried different things, but it do not work . pix.gif really exist, cause also by single script it works and displays... (btw, my links are cleared from IDs - using link rewriter, and override is now other as default ) - could this be the reason? Edited March 12, 2015 by croc (see edit history) Link to comment Share on other sites More sharing options...
croc Posted March 12, 2015 Author Share Posted March 12, 2015 (edited) Hi rocky, I changed id_cms == 6 to id_cms = 6 and it works now. Thanks for your help. Edited March 12, 2015 by croc (see edit history) Link to comment Share on other sites More sharing options...
croc Posted March 13, 2015 Author Share Posted March 13, 2015 (edited) HI, one additional question: how to change (create similar) code to use it for footer.tpl ? (this script in footer will be displayed on each page of web) {if $smarty.get.id_cms == 6 && $cookie->id_lang == 1} <script> {elseif $smarty.get.id_cms == 6 && $cookie->id_lang == 2} <script> {/if} Thanks Edited March 13, 2015 by croc (see edit history) Link to comment Share on other sites More sharing options...
croc Posted March 13, 2015 Author Share Posted March 13, 2015 (edited) Hi rocky, I changed id_cms == 6 to id_cms = 6 and it works now. Thanks for your help. ehm, as I checked it better with this "customization" that script displays on each CMS page Any tip where can be the problem? Edited March 13, 2015 by croc (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted March 14, 2015 Share Posted March 14, 2015 The same code that works in cms.tpl should also work in footer.tpl. You should be using == instead of =. That's what worked on my website. I have no idea why it isn't working for you. If you still can't get it to work, you can send me a private message with your FTP details so I can check your code. Link to comment Share on other sites More sharing options...
croc Posted March 14, 2015 Author Share Posted March 14, 2015 Hi, I ment - how should look the code when I would like to put similar scripts to footer.tpl and to display it on whole website (all pages not just cms pages) with same lang s switching... Thanks Link to comment Share on other sites More sharing options...
rocky Posted March 14, 2015 Share Posted March 14, 2015 Just take out the id_cms part: {if $cookie->id_lang == 1} English content here {elseif $cookie->id_lang == 2} French content here {/if} 1 Link to comment Share on other sites More sharing options...
croc Posted March 15, 2015 Author Share Posted March 15, 2015 Hi, This works good. Thanks. Link to comment Share on other sites More sharing options...
croc Posted March 15, 2015 Author Share Posted March 15, 2015 I suggest that you add the JavaScript to the end of cms.tpl in your theme's directory. If you need to put it on a specific language of a CMS page, you can use code like the following: {if $smarty.get.id_cms == 4 && $cookie->id_lang == 1} English language Javascript goes here {elseif $smarty.get.id_cms == 4 && $cookie->id_lang == 2} French language Javascript goes here {/if} This will let you add different JavaScript for the English and French "About us" pages only. Change 4 to the ID of the page you want the JavaScript added and add more {elseif} statements for each language required. Hi, yes this code is really right by default prestashop settings. Thanks. 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