QuantityDiscount
Previous  Top  Next

This page does not apply to the Lite version of the cart.

This section will walk you through implementing quantity based discounts on selected products, this is a feature of the cart that allows you to offer a multi step percentage discount based on the number of units ordered, begin opening the database and adding a field to the tblProducts table, call this field "QuantityDiscount".

After you have added the new field you will also have to add it to the "web_Products" query, for details on how to add additional fields to this query refer to the Weights and Carriage section where is explains how to add the "Weight" field and follow the same procedure to add the "QuantityDiscount" field.

Now run the table and for any product you with to define a QuantityDiscount on type a comma separated string that represents the products discount steps, this string should take the format of:

10=5,20=15,30=20

Breaking this string up at the comma and looking at each part shows:

10=5
20=15
30=20

So this QuantityDiscount string will give a 5% discount if 10 or more units are ordered, a 15% discount if 20 or more units are ordered and a 20% discount if 30 or more units are ordered.

Further study of the string with a little colour coding (below) also shows that the quantity markers shown in blue are in a numerically ascending order, this is important because it will not work correctly if the they are not numerically ascending.

10=5,20
=15,30=20

Once you have defined a discount string for any product you want to have quantity discounts for you can move onto intigrating it into the sites pages.
The first page we will edit is "products/AddFromDB.aspx", edit the "Add To Cart From Database" control clip0009 add the QuantityDiscount field to the Field Mappings as shown in the following dialog image:

clip0110

Save this page and then do precisely the same procedure on the "Add To Cart From Database" control found in the "products/BatchAdd.aspx" page.

If you have already set-up the "products/multiple.aspx" page as outlined in the Multiple Additions section then you will have to add an additional "webxelcart:formfield" control to the field collection. First of all you will have to refresh the dataset so that the QuantityDiscount field appears in the bindings panel field list, do this by double clicking the dataset and then clicking the "OK" button, this will re-apply the dataset and make the QuantityDiscount field visible. Then you should insert the new webxelcart:formfield control by clicking the clip0012 icon and defining the following values in the FormField dialog

FieldName = QuantityDiscount  
FieldValue = <%# DataSet1.FieldValue("QuantityDiscount", Container) %>  
FieldType = hidden  

Now the site will automatically adjust the totals of the cart based on the quantity discounts defined.