Adding jQuery library to Zen Cart

You’ve found that you want to use jQuery features to help include affects in your Zen Cart site. Adding Javascript or jQuery to Zen Cart can be easy.

First, you must find the following template directory ….


includes/templates/TEMPLATE-NAME/jscript

(Replace TEMPLATE-NAME with the name of the template you are using.)

Create a file to contain your javascript, The file name must have the prefix “jscript_,” in the form jscript_xxxx.php. For example you might create jscript_my.js. Store it in the jscript directory. For example:


includes/templates/TEMPLATE-NAME/jscript/jscript_my.php

Once you have the file, include whatever you would like in the site header area, loaded with the other other script files. The file will look contain at least:


  <?php
  // Jscript_my.php
  //
  // The following is an example of including jQuery and using jQuery 
  // in Zen Cart.
  //
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  <script type="text/javascript">
    $(function() {
      $(".wrapperAttribsOptions option[value='63']").remove() ;
      $(".wrapperAttribsOptions option[value='67']").remove() ; 
      $(".wrapperAttribsOptions option[value='65']").remove() ;  
      $(".wrapperAttribsOptions option[value='64']").remove() ; 
      $(".wrapperAttribsOptions option[value='68']").remove() ;
    }) ;
  </script>

Leave a Reply