Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Add Custom Javascript With My Changes Addon Rate Topic   * * * * * 2 votes

  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10,140 posts

Posted 24 November 2017 - 08:38 PM #21

A custom theme could impact it if it does not support the hooks for 'scripts'.  However, I would expect that if that were the case that you'd have all sorts of problems.


Verify that you in fact have a js/addons/my_changes/your_script_name.js file in place.

Add the following line to your scripts.post.tpl file:

<script type="text/javascript">
console.log("Loaded scripts.post.tpl");

and add this to your js/addons/my_changes/your_script_name.js file:

<script type="text/javascript">
console.log("Loaded JS file");


Clear your cache by manually removing/moving var/cache.

Clear your browser cache too.


Then open the browser inspector for your site by right-clicking and selecting "inspect".

You should see the messages in the console area related to the files that have loaded.


If not then either my_changes is not active or you have a typo in the pathname to the scripts.post.tpl file.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.

  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 16,123 posts

Posted 27 November 2017 - 05:40 AM #22

I'm assuming this is the scripts.tpl in the design/themes/[my theme]/templates/common folder? If so, my js files are not linked in there.


Would it affect it if I'm using a third party purchased theme?


No, check source code for similar file



GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration

Certified CS-Cart RU Developer | Сертифицированный разработчик на CS-Cart Русская Версия

  • SwimShady
  • Advanced Member
  • Members
  • Join Date: 05-Aug 14
  • 73 posts

Posted 27 November 2017 - 07:01 PM #23

Thanks tbirnseth & eCom.  I figured out the issue.  The first issue I had was that it wasn't showing up in my source code of the page so I thought it wasn't getting included, but then I looked for that compiled "script-[random number].js" file that you mentioned eCom, and it was all in there.


And the reason it wasn't working, is because there seemed to have a conflict with some of the other javascript code. It's all fixed and it works fine now.


Thanks guys!