RealCart UNIVERSITY
Courses [Home]  [Search]  [Index]  [Help]  [Help]

Higher Learning for the Internet’s most effective shopping cart - Attend On-line.

<<prev | 1 | 2 | next>>

Quantity Discounts based on total items purchased - Tweaking the Code

NOTE: The jsqtydiscount.snp does not exist in your common folder. It is a brand new snippit file that you will create and save to your current theme folder. If you desire, you may simply download the file at the bottom of this page instead of copying and pasting the code from these examples.

You will want to configure the variables at the top of the jsqtydiscount.snp file. The variables are:

  • qDiscount = 5; — Quantity of items shopper must purchase in order to receive the discount. The default is 5 but you may change this to any number you want. Keep in mind that only a number may be defined as the value for this variable. It must be followed by a semi-colon as shown here.
  • pDiscount = 0.15; — Discount percentage. This is the amount of the discount. A percentage of 5 would be entered as 0.05. A percentage of 10 would be entered as 0.1.
  • tDiscount = true; — Variable to specify whether the discount amount is taxable or not. We would recommend leaving this set to true even if none of your items are taxable.
  • strDiscountDesc = "Quantity Discount"; — The Item Short Name that will appear in the shopping cart for the line that shows the discount. We recommend leaving this value as is unless you have a specific reason to change it.
  • strDiscountStock = "qtydisc"; — Stock number for discount. We recommend leaving this value as is unless you have a specific reason to change it.
Here is the variable section as it appears in the jsqtydiscount.snp snippit file (in bright blue):

The code that follows can be found in the file called jsqtydiscount.snp v2.0.7.1

  This is the default snippit located in "[Settings_AppDir]\Templates\Common" folder

  begin file jsqtydiscount.snp - - - - - - - - - - - - - - - - - -

  Quantity discount JavaScript functions...
  */

  var qDiscount = 5;      // Quantity required for discount.
  var pDiscount = 0.15;    // Discount percentage set at 15% off.
  var tDiscount = true;    // Discount amount taxable?
  var strDiscountDesc = "Quantity Discount";
  var strDiscountStock = "qtydisc";  // Stock number for discount
  var numItems = parent.app.document.cart.GetItemCount();
  var nDiscount = 0;
  var noDiscount = true;    // discount has not been added yet
  var flag = 0;             // flag to tell RealCart not to dump discount.

if(isFramed)
{
  if ((strOrderTtl != "0.00") && (numItems >= qDiscount))

When you are finished configuring the variables in the snippit file simply save it, rebuild the checkout page and publish your store’s new checkout page.

To see the entire jsqtydiscount.snp file please click here. The variables that you can (and should) change are highlighted with red type. You may download the jsqtydiscount.zip file, extract it and then save the new jsqtydiscount.snp file to your current theme folder called jsqtydiscount.snp. Rebuild Checkout, republish and enjoy.

This concludes the Quantity Discounts based on total items purchased course.

<<prev | 1 | 2 | next>>


About RealCart U | Courses | Admissions | Administration | Alumni | Directories | Case Studies | Help

Contact the Webmaster staff
Copyright information
Privacy statement

Copyright © 1995-2002, RealCartUniversity.com