patrmich Posted October 13, 2010 Share Posted October 13, 2010 Hi,I would like to add some javascript in the product description.My goal is to allow the client to open a link (written in javascript with the window open function) from the product description (I mean the main product description and not the short description).In the forum, I found the way to enable javascript in the short product description :http://www.prestashop.com/forums/viewthread/58560/general_discussion/unable_to_use_javascript_in_small_product_descriptionBut how to enable javascript from the main product description ?The Prestashop version I am suing is v1.3.1.1.Thank you in advance for any help.Patrick Link to comment Share on other sites More sharing options...
fitgura Posted October 13, 2010 Share Posted October 13, 2010 This was my lesson today, I suffered so mutch with it but it is very simple:Simple just search the product.tpl file in your template folder --> open in editor, and create two section like head and body and put the path of your javascripts in the head and all of the code in the tpl file to the body section --> save the file, but don't forget to make a safety copy of the original tpl fileaftet that in the product long description you can put the code what you want for example lightbox or anythinghope I help you Link to comment Share on other sites More sharing options...
patrmich Posted October 14, 2010 Author Share Posted October 14, 2010 Hi,Thank you for your fast reply.I am sorry to say that, as a beginner, I did not understand everything.1- Where is the product.tpl file ?Is it the product.tpl file in /themes/prestashop/ ?2- My goal is to put a javascript code in the product description of the following type :See image1This would allow my client to open the image1 image in a separate window that remains opened while the client is browsing the shopThe image to be opend could vary from one product to another3- Following to your reply, what part of the product.tpl file original code would be in the head section ?Following to your reply, what part of the product.tpl file original code would be in the body section ?4- Then, having created two sections in the product.tpl file, what would I have to do in relation with my javascript links ?5- Would it be necessary to amend the product.tpl file each time I add a different javascript link in a product description ?I apologize as some of my questions are related to my poor level in Prestashop and coding level.Thank you again in advance for any help.Patrick Link to comment Share on other sites More sharing options...
fitgura Posted October 14, 2010 Share Posted October 14, 2010 Hi Patrick!Sorry just now, but I worked all the day1. I made a modified product.tpl file for you, waht you have to open wit some html editor like nvu or dreamwea***er (I don't wanna advertise here you can see the head section in it like the example below <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="lightbox/lightbox.css" type="text/css" media="screen" /> and the js files goes here!!!! </head> 2 so you have to link your own javascript files like you see above3 save the product.tpl file and upload it to your server in the themes/prestashop folder4. open the desired product page in admin area and in the long description you can put what the script has to do...5. don't forget to upload your javascript files in the server root /yourdesiredfolder/ and in the head tag link them correctlyI hope it was enough detailed good luck product.zip Link to comment Share on other sites More sharing options...
Recommended Posts