You may have multiple problems in the future if you hard-coded JavaScript code in product description. For example, you need to change all the codes for all products at once. I'd suggest to modify your theme's product template and add generic JavaScript code there. You have all product information in that template and you can customize your script for a particular product using Razor syntax.
Why don`t you use templates as suggest @ilich_x86? At your admin panel System >> Templates >> Product templates add new (for example ProductTemplate.SimpleScript), then at your theme made copy of the ProductTemplate.Simple.cshtml and save it with ProductTemplate.SimpleScript.cshtml, add required script to the code of new file.
Next, to each product which should have that script, just assign new template. If you would like to remove script from specific product, just apply default template at your admin panel. If you would like to change script, just open file and change it directly. Clean and easy way, without modify any source code. And to edit code, you need only open one file.
Regards, Tomasz
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.