Category Archives: Zen Cart

How-to for Zen Cart

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>

Zen Cart .. (35) error:14094410:SSL routines Error Message

Warning: If you are running Zen Cart, use PayPal and have not upgraded to Zen Cart 1.5.4, you need to make some changes. PayPal changed handling on for their transaction interface API to account for hackability of the SSLv3. Due to the POODLE security problem, SSLv3 is nolonger accepted by PayPal. Many people have adjusted, but, for those of your with Zen Cart that have not fixed the problem yet, be aware you have a problem.

This SSLv3 problem has been fixed in Zen Cart 1.5.4, but, many people have yet to move to that revision. If you have not upgraded, you are being rejected from PayPal transactions with a message similar to “(35) error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure.” If you are receiving this message, you will need to modify the all PHP files that contain a refer to SSLVERSION. Do a search for references to SSLVERSION, comment out all locations that look like this:

    CURLOPT_SSLVERSION => 3
         or 
    curl_setopt ($ch, CURLOPT_SSLVERSION, 3);

Your resulting code at those locations would look like this:

   //  CURLOPT_SSLVERSION => 3
         or 
   //  curl_setopt ($ch, CURLOPT_SSLVERSION, 3);

Among other locations you may find in your search, your search should find locations to change in the following files.

  • includes/modules/payment/paypal/paypal_curl.php
  • includes/modules/payment/linkpoint_api/class.linkpoint_api.php
  • includes/modules/payment/authorizenet_echeck.php
  • includes/modules/payment/authorizenet_aim.php
  • extras/curltester.php

Enjoy your day …

Adding js and css files to Zen Cart

If your doing some modifications to a Zen Cart template, you may need to add a css file or a javascript file to support the adjustment. There are simple ways to add new css and javascript files to a Zen Cart template.

Adding javascript files

To add a javascript file to all pages of a Zen Cart template,

  • Create a file or files with the naming convention jscript_.js
  • Place it(them) in a folder /includes/templates//jscript/

All jscript_<>.js files in the includes/templates//jscript/ will be loaded in the Zen Cart header.

Adding CSS files

To add a CSS file to all pages of a Zen Cart template,

  • Create a file or files with the naming convention stylesheet_.css
  • Place it(them) in a folder /includes/templates//css/

All stylesheet_.css files in the includes/templates//css/ will be loaded in the Zen Cart header.

5 Steps to Adding Sidebar Block in Zen-Cart

You may find that you want to add a block to the sidebar in Zen-Cart. The content may be text, image, or other feature to extend the content on the cart. The generic concept of adding a block involves 5 steps. This article explains the steps. For simplicity, we will only add a text block.

Step 1; Create Sidebox Template

Add a new file to the server in the following directory: /includes/templates/<template-name>/sideboxes/. Name the file something relating to the contents of the sidebox. We will be adding a support phone number to call in a sidebox, so, we might name the file tpl_support_number.php. The file will include what you want to display in the box and will be assigned to the variable $content variable. Below is an example of the contents of the file.


  <?php
     /* Side Box Template  */
     $content = "For information about products or services, call (888) 555-1212" ;
  ?>

Step 2; Create Sidebox

Now, to create the actual box; add a new file to the server in the following directory: /includes/modules<template-name>/sideboxes. Name the file something relating to the contents of the sidebox. In our sample, we will call it support_number.php. The contents of this file will look like the sample below, but, modify the variables to relate to your template.


  <?php
  /**
   *  Support Number Sidebox - used to display a support message 
   *  in a sidebox.
   *
   */
   $show_message = true ;
   if ($show_message == true) {
       require(
         $template->get_template_dir('tpl_support_number.php', 
            DIR_WS_TEMPLATE, $current_page_base,
           'sideboxes') . '/tpl_support_number.php');
       $title = BOX_HEADING_SUPPORT_NUMBER ;
       $title_link = false;
       require($template->get_template_dir($column_box_default, 
           DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . 
           $column_box_default);
   }
  ?>

Step 3; Add Language Variables

Modify the english.php language file in /includes/languages/ to include the definitions for any text variables you have used in either file. In this example we created a new variable called BOX_HEADING_SUPPORT_NUMBER. So, we will add the following to the english.php file.


  // welcome box text in sideboxes/welcome.php
  define('BOX_HEADING_SUPPORT_NUMBER', 'SUPPORT INFO');

Step 4; Enable Sidebox:

Activate the sidebox as follows:

  • Login into Zen-Cart administration.
  • Hover over Tools.
  • Select “Layout Boxes Controller” from the drop down, a list of boxes will appear …  including your new box
  • Double-click the name of the new box you have created, in this sample, it will say …  sideboxes//support_number.php. In the upper right of the window you will see fields that you can edit.
  • Select to edit the information, an editable form will appear
  • Fill in the form, by:
    • Selecting the radio button next to “on” in “Left/Right Column Status”
    • Selecting the radio button to place the box on the “left” or “right” sidebar
    • Typing the correct number is the sort order field to display the box
    • and then clicking the Update button.

The sidebox is now enabled on the site

Step 5; Verify Sidebox:

Now, visit your store in a browser and make certain the sidebox displays.