Back to Mal's forms page
<<< Clicking on this logo will return you to my Mal's Forms home page.

View the page source!


Offer a discount based on the total number of hours booked. This can be adapted for almost any criteria.

There is a javascript I've built below. In the script, if the total courses/products listed in the page/form is for example, 20, then increase the line for:
(i=1; i<20; i++) {
to 21
(i=1; i<21; i++) {
always increase the number by one to the total number of your courses/products per form.

The script can be easily altered by you to change the band the discount is applied for or the discount rate.

To change the band, look for this first band line:
if ((sumhrs >=10) && (sumhrs <=14)) {
The script is saying, the hours must be 10 or more and 14 or less. The last band is anything over 30, we do this by using:
if (sumhrs >=30) {
Which says, any number over 30.

Next we have the rate applied for the band, to do this we use:
var disc = sumprc*-.2;
This is applying a negative value (discount) of 20% (the minus sign then point two), the next discount for the 15 - 29 band is var disc = sumprc*-.25; which is 25% and the last discount range is 30%, var disc = sumprc*-.3;

We need to ensure the person cannot change the course number or hours at Mal's; if they have booked 30+ hours to get the discount, then remove courses from the cart, they would still get the remaining courses with the discount. To prevent this, you will see in each product section <input type="hidden" name="noqty1" value="1"> <input type="hidden" name="noqty2" value="1"> this prevents them from removing a course.

I have priced both courses at $100, this is so you can easily see the discount structure working.

In the first course, I have told the form that the hours number is 10, this is so you can test the script, the second course has the hours number of 20, so by choosing the first course, you will get a discount of 20%; uncheck that box and check the second course and you will get a discount of 25%; check both boxes and you will get 30% ($60) off the courses.

With all of the courses, you need to number all parts in number order, ignore changing the last one (discount), but the others you will need to change, for example; if you copy the first course and use it as a template for the next course in the page, then the numbers will need to be changed from qty1 to qty3, hours1 to hours3 etc as I've already used qty2 etc.

The bottom product (discount) has the link to the return page, currently this is set to this page, so you need to change this to where you want the buyer to return to from Mal's if they 'continue shopping'.

Hip shaking techniques with GT, 10 hours.


Egyptian hips with GT, 20 hours.


Your total hours is:  

We have a sliding scale of discounts based on the number of workshop hours you attend:
10 to 14 Hrs - 20% OFF
15 to 29 Hrs - 25% OFF
30 + Hrs - 30% OFF

Your discount is $

Your total order value is:

Clear my selection