|
<<prev |
1 |
2 |
next>>
Quantity Discounts based on total items purchased - The Basics
RealCart was designed to be infinitely customizable. Nowhere does this promise hold more true than in the JavaScript functions of RealCart. Although you do not need to know any JavaScript to customize RealCart or to participate in this course and subsequently modify RealCart JavaScript routines, it wouldnt hurt to read a book entitled JavaScript for the World Wide Web from Peachpit Press. It is only 195 pages long but it contains everything you need to become a weekend warrior JavaScript coder. Never-the-less, having zero JavaScript knowledge is just fine for the purpose of attending this course.
RealCart was designed to allow the end user (you) to customize it to do most anything. Since RealCart is based entirely on HTML and JavaScript you can customize it to do anything with virtually any HTML editor there is. For the purpose of this course we are going to focus on getting RealCart to give a quantity discount based on the number of items in the shoppers shopping cart.
This course, although fairly short, will completely explain how to get RealCart to apply a percentage discount of your chosing. RealCart will remove the discount if the shopper leaves the checkout page for any reason and then re-apply it if the conditions exist for the discount to be given again. You are in control of how many items are required to receive the discount as well as what the percentage to discount the order.
Clone your checkout page template
Clone the appropriate file template file and then open the cloned copy in your current theme folder in a text editor. Locate the following line of code. It will likely appear somewhere around the 230th to 250th line of the template file. You are looking for:
<body background="img/bg.jpg" rightmargin=0 leftmargin=0 topmargin=15 onUnload="SetCheckoutMode(false)">
TIP: A super quick way to find this line if using notepad or EditPad is to press the F3 button on your keyboard, type in the characters <body (left angle bracket-B-O-D-Y) and press the ENTER button on your keyboard. You should zip right to the line. We are only going to change the last part of this line. We are going to replace: SetCheckoutMode(false) with removeDiscount() like this:
<body background="img/bg.jpg" rightmargin=0 leftmargin=0 topmargin=15 onUnload="removeDiscount()">
The second change we need to make is further down the page. Now look for the line that reads:
[JavaScript_File:jspaytop.snp]
This line should only be a few lines below the <body ... tag that we just modified. If you are using one of the PayPal checkout methods you will be looking for the line that says [JavaScript_File:jspaypaltop.snp]. When you find it just insert the following line directly above it:
[JavaScript_File:jsqtydiscount.snp]
[JavaScript_File:jspaytop.snp]
of, if you use a PayPal checkout method (not PayPal plug-in)
[JavaScript_File:jsqtydiscount.snp]
[JavaScript_File:jspaypaltop.snp]
The entire block of code will now look something like this:
<script language="JavaScript">
<!--
/*
Do not remove or alter this script code or
this template may not function properly...
[JavaScript_File:jsqtydiscount.snp]
[JavaScript_File:jspaytop.snp]
*/
// -->
</script>
The third change we need to make is further down the page. Now look for the line that reads:
<form name="mail" action="[Projects_FormURL]" method=post onSubmit="return OrderClick()">
Change the last segment by adding flag = 1; right before return OrderClick() toward the very end of the line. The line of code now looks like this:
<form name="mail" action="[Projects_FormURL]" method=post onSubmit="flag = 1; return OrderClick()">
This change will prevent RealCart from dumping the discount when navigating to the thanks.html page. These are the only three modifications we need to make to your checkout page template. Save it and we will move on to the jsqtydiscount.snp snippit file on the next page.
<<prev |
<<prev |
1 |
2 |
next>>
|