AJAX Shopping Cart with Coupons

This document outlines the installation, usage, and uninstallation instructions for the AJAX Shopping Cart with Coupons module for Zen Cart.

Important Links


  1. Install CSS JS Loader
  2. Patch your database by copying and pasting the contents of install.sql into ADMIN->TOOLS->INSTALL SQL PATCHES.
  3. Rename all folders named YOUR_TEMPLATE to your custom template name.
  4. If your shopping cart template has been previously modified, merge the changes or follow the merging instructions below.
  5. Upload all files and folders within /catalog/ to your store’s root while maintaining the directory structure.

Merging Instructions (unless using supplied files)

  1. Open includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart_default.php
    1. find:
      <div id="cartSubTotal"><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $cartShowTotal; ?></div>
      And replace with:
      <div id="orderTotal">
      <div id="cartSubTotal">
      <div class="totalBox larger forward"><?php echo $cartShowTotal; ?></div>
      <div class="lineTitle larger forward"><?php echo SUB_TITLE_SUB_TOTAL; ?></div>
      // begin ajax cart
      if(isset($_SESSION['promotion_code'])) {
      <br class="clearBoth" />
      <div id="otcoupon">
      <div class="totalBox larger forward">-<?php echo $_SESSION['discount_in_cart'];?></div>
      <div class="lineTitle larger forward"><?php echo DISCOUNT_COUPON_CODE . '(' . $_SESSION['promotion_code'] . ')';?>:</div>
      <br class="clearBoth" />
      <div id="ottotal">
      <div class="totalBox larger forward"><?php echo $_SESSION['total_in_cart'];?></div>
      <div class="lineTitle larger forward"><?php echo SHOPPING_CART_TOTAL;?></div>
      <br class="clearBoth" />
      } // end ajax cart
    2. Place the following code in any place outside of the shopping cart form:
      <?php if (MODULE_ORDER_TOTAL_COUPON_STATUS == 'true' && AC_SHOPPING_CART_COUPONS == 'true') { ?>
      <!-- bof ajax cart -->
      <div id="coupon_code">
      <?php echo zen_draw_form('coupon', 'index.php?main_page=shopping_cart', 'post', '', true);?>
      <?php echo 'Coupon Code: '.zen_draw_input_field('promotion_code', '', 'size="18" id="promotion_code"');?>
      <?php echo zen_image_submit(BUTTON_IMAGE_UPDATE, BUTTON_UPDATE_ALT, 'class="btnUpdate"')?>
      <!-- eof ajax cart -->
      <?php } ?>


  1. Unmerge changes to /includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart_default.php.
  2. Replace /includes/modules/order_total/ot_coupon.php with the default from the Zen Cart package.
  3. Replace /includes/modules/shopping_cart/*.* with the default folder from the Zen Cart package.
  4. Delete all other files from the package on your server.
  5. Patch your database by copying and pasting the contents of uninstall.sql into ADMIN->TOOLS->INSTALL SQL PATCHES.


Go to ADMIN->CONFIGURATION->AJAX SHOPPING CART CONFIGURATION and configure the module as follows:

AJAX Shopping Cart Status: setting this to true will allow AJAX to be used on the cart. If set to false, the cart will reload the page for each action.

Coupons on Shopping Cart: setting this to true will display the coupons form for adding a coupon.

Selectors: for a standard Zen Cart template, these will not need to be changed. If the AJAX isn’t working, then incorrect selectors is a likely culprit. Selectors are referenced the same way as selectors are referenced in CSS.

Block Message: these options pertain to the message that is displayed when an AJAX request is being made to the server. For faster servers, this message may not be required. For slower servers, it may be a good idea to let customers know that some changes are being made behind the scenes. If turned on, use these settings for altering the display of the block message.


  • In order to use Ajax for the shipping estimator, make sure that your shipping estimator is set to display on the shopping cart page, not as a pop-up, by activating the form in ADMIN->CONFIGURATION->SHIPPING/PACKAGING.
  • It is recommended you set ADMIN->CONFIGURATION->LAYOUT SETTINGS->Shopping Cart Box Status to 0.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.