discount preview

Zen Cart Discount Preview

A Zen Cart™ mod which allows you to display order total discounts on the shopping cart page (and in the shopping cart sidebox, if desired). In this way, discounts which are normally not visible until the second page of checkout are visible earlier.

Relevance: Zen Cart™ 1.3.5 and forward. Please specify your Zen Cart version when ordering.

Cost: $30 ($35 to show the revised subtotal). Buy Now!

Installation: click here

Support Thread: My commercial software is not supported on the Zen Cart forum. Please email me questions instead.

See it Live: Go to my demo shop and add ten of any item to your cart (excluding gift certificates). You will immediately see the discount because of Discount Preview. Without Discount Preview, the discount would not be visible until the second page of checkout.

Bugs: click here


Overview:

This mod permits customers to preview the order total discounts they will receive from the built-in Group Discount module, as well as from the Better Together and Quantity Discounts contributions and the Combination Discounts, Big Spender and Big Chooser extensions. You may preview whatever combinations of discounts is configured for your shop.


Shopping Cart Page With the Discount Preview Extension

Cart with the Discount Preview extension installed

Shopping Cart Sidebox With Discount Preview Extension

Sidebox with the Discount Preview extension installed

Ordinary Shopping Cart Page

Cart without the Discount Preview extension installed

The discounts are shown as line items below the subtotal on the shopping cart page. No summary computation is made, since these line items are designed to appear the way they will on page two of the checkout.

I charge $30 for the basic version of Discount Preview for Zen Cart, and $35 for the version which shows the revised subtotal. This money helps fund the work I do on free software, such as Quantity Discounts and Better Together.


Bugs

  • If you are running Zen Cart 1.3.8 and you are using Group Pricing, please make the following fix if your version of Discount Preview doesn't have it:
    edit the file includes/modules/<your template>/inc_gp.php, and change
         $gp = $discount->calculate_deductions($ot);
    
    to
         $gp = $discount->calculate_deductions($ot['total']);
    
    This fix applies to Zen Cart 1.3.8 ONLY.

Installation Instructions:

  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
  2. Copy the contents of the unzipped folder to the root directory of your shop.
    The names of these files reflect a template name of "custom." If you are using a different template name, please change file paths using "custom" to use your template name instead.
  3. If you use the Shipping Estimator feature to display an estimate of shipping costs in the cart, you MUST change the file
       includes/modules/shipping_estimator.php.  
    
    Look for a line that says
           require(DIR_WS_CLASSES . 'order.php');
    
    and change this to
           require_once(DIR_WS_CLASSES . 'order.php');
    
  4. If you have also ordered Checkout Candy or Checkout Candy for Combination Discounts from me, you will have to merge the files
       ./includes/templates/custom/templates/tpl_shopping_cart_default.php
       ./includes/templates/custom/css/shopping_cart.css
    

Installation Problems:

The most common installation problems for this module are as follows:
  1. Forgetting to copy the files from includes/modules/custom to includes/modules/YOUR_TEMPLATE if your template is not named "custom"
  2. If you see the message that looks something like, "Fatal error: Cannot redeclare class order in /var/www/web4/web/includes/classes/order.php on line 20", you need to look for statements that do
    require(DIR_WS_CLASSES . 'order.php');
    
    and change them to
    require_once(DIR_WS_CLASSES . 'order.php');
    
    This must be done in the following places:
    • includes/modules/shipping_estimator.php
    • includes/modules/payment/paypalwpp.php (if you are using PayPal Website Payments Pro).
If you are having trouble installing this module, you should also refer to my Guide to Mod Installation on Zen Cart. I'm also happy to install most of my mods for a fee.

Tips

  • If you've never installed a Zen Cart mod before, please read my Guide to Mod Installation on Zen Cart.
  • IMPORTANT! If you are using Quantity Discounts, and you're using the marketing suggestions on the product info page, please be sure you have the latest code:
    <?php
      $value = "ot_quantity_discount.php"; 
      include_once(zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . 
              '/modules/order_total/', $value, 'false'));
      include_once(DIR_WS_MODULES . "order_total/" . $value);
      $discount = new ot_quantity_discount();
      echo '<div class="content" id="discountPolicy">'; 
      echo '<h2>' . STORE_POLICY . '</h2>'; 
      echo $discount->get_html_policy();
      echo '<br /></div>'; 
    ?>
    
    (i.e. both "include" statements should be "include_once")
  • To place a message at the top of the shopping cart page near the undiscounted total, edit the file customize the file includes/languages/english/shopping_cart.php, and set TEXT_INFORMATION to something like "See bottom of page for discount information."
  • If you use the shopping cart sidebox, you should define the following new CSS class in includes/templates/custom/css/stylesheet.css
    .cartBoxDiscount {
            text-align: right;
            font-weight: bold;
            }
    
    This is how your discount information will appear in the shopping_cart sidebox.
  • If you have any problems after installing this mod, the first thing you should do is delete includes/templates/custom/sideboxes/tpl_shopping_cart.php Although this works well with a freshly installed cart, it is possible that the logic in this file will not interoperate with other modifications you have made. You may need to turn off the shopping cart sidebox or simply use some text in here telling the customer to go to the shopping cart page to see discount information. The next tip describes how to do this.
  • If you are using the shopping cart sidebox but would prefer not to indicate the amount of the discount (or have interoperability problems as described above), customize the file includes/templates/template_default/sideboxes/tpl_shopping_cart.php, copying it to includes/templates/custom/sideboxes/tpl_shopping_cart.php. At the bottom of the file, right before the line
       $content .= '</div>';
    
    insert the line
       $content .= CART_INFORMATION_SIDEBOX;
    
    If you have used CSS styling in the main page of shopping_cart.php, you can make the sidebox look the same by using this line instead:
       $content .= '<div id="cartInstructionsDisplay" class="content">';
       $content .= CART_INFORMATION_SIDEBOX; 
       $content .= '</div>';
    
    CART_INFORMATION_SIDEBOX is a string you have defined in includes/languages/english/extra_definitions/discount_preview.php like this:
    define('CART_INFORMATION_SIDEBOX','Discounts displayed in shopping cart');
    

  • The shopping cart sidebox will not display the discount information when the shopping cart page is being displayed.
  • If you use the shopping cart sidebox, my recommendation is to run with it not displayed on the shopping cart page. Use Admin->Configuration->Layout Settings->Shopping Cart Box Status, and set this value to 2.
  • Want to show off your discounts even more using red lettering, yellow background or some other effect? See my Highlighting your Discounts tip.

Showing the revised subtotal

Want see the subtotal after discounts? Some people like this and others don't, so I make it optional. Just ask if you want it.
I charge $30 for the basic version of Discount Preview for Zen Cart, and $35 for the version which shows the revised subtotal. The fee covers software only; installation is extra if you require help.


Want more Zen Cart?     Tips and Tricks     Contributions     Extensions     Custom Software     Newsletter

Terms | Privacy | SiteMap | Newsletter | Contact Me | Contents © 2003-2010 That Software Guy, Inc.
Zen Cart Project Home Page | Zen Cart Forum | Zen Cart™ is © Zen Ventures, LLC.