Basic coupon discounts |
home page std.css |
This simple example shows how to give a site a discount for things like promotions. Once you set it up you can turn on/off discounts by changing a single line of code - but only in simple cases...
This simple case thing must be defined. I am talking about small to medium sites where all items for sale are displayed on a single page. If you have a site where your products are strung out among many pages you have to go to cookies to be able to "remember" the discount across those pages. In my client-side shopping cart I use cookies for that, but this is a simple example to demnonstrate the basic concepts, only.
Many sites would like to offer something like a $5 discount, but this is difficult if the site has items that cost less than $5. To effectively offer an amount discount you need a 3rd party cart to insulate you from the customer's ability to make changes to the order once within the PayPal system.
If security is a concern then you should look into the ability to have private folders on the server you are using. The JavaScript should be put into its own file and that file then placed in a private folder. That way it cannot be read, or modified.
Again, we start with the PayPal button factory output and make a few changes to the FORM that contains each item. You should know the drill by now...
The first FORM just gives the discount with no questions. Your site would proclaim a 10% discount on all products for the next week. The pricing on the site remains the same, but a 10% discount is applied to all items ordered. The discount is set by changing the first line under the <script> tag. Setting it to zero turns the discount off.
var discnt = 0; // no default percent discount
The above setting requires a coupon entry to change.
var discnt = 10; // percent discount to offer customers
This setting gives a blanket 10% discount to everything on this page.
A little more difficult is to use a broadcast coupon method. A Broadcast Coupon is something like putting an add in the paper that anyone may see. You give them a coupon code, and if they enter it into your site then you give them a discount. If you want to give specific people a coupon then you are going to have to do that server-side where you have the ability to remember the code for a specific individual. This is client-side where no such memory exists (people regularly delete their cookies [at least I do]).
In this example we ask for a code, and if one of the proper codes is given it is reported to you, and the discount associated with that code is applied. Perhaps you place ads in several papers, each with a different coupon code to see which paper is giving the best advertising results. For this simple example the code entered is placed into the "item_number" field so you can see it. In reality you might want to place it into the "custom" field so no one but you can see it.
Contact me concerning this article at
paypalhelper@aol.com.
Mention "simple coups" in your note.
Individual help starting at $25.00 for simple JS solutions.