Offering Discounts

Often when you are offering something for sale you want to be able to run an ad campaign where you offer a discount off of the regular price. With paper advertising you would ask your purchasers to bring in the ad in order to receive the discount. By offering a discount in this way you can track the effectiveness of your various advertising methods by keeping a count of the number of purchasers who turn up with each different ad.

When you advertise on the web you may also place ads in different places and would like to track their effectiveness the same way that you track the effectiveness of your paper advertising. Your purchasers can't bring a hard copy of the ad with them when they are buying electronically so instead what we do is to display a special code word in each ad that the purchaser must supply to us when they make their purchase. Entering a valid code word gets the purchaser a discount off of the purchase price and tells us where they saw the ad.

The Paypal IPN script that we provide that automatically emails purchased scripts to the purchaser once their correct payment has been received can now handle discounts like this allowing you to track the effectiveness of your various advertising.

To make use of this facility you need to create a $ds array in the payconf.php file. Each entry in this array contains a comma separated list consisting of the discount code word, the product code of the product to which the discount is to apply, the amount of the discount, the start date on which the discount applies, and the end date on which the discount applies. By providing these last two fields your discounts can start and finish on specific dates without your having to update the discount table immediately a given discount starts or finishers. Let's look at an example entry:

$ds[0] = 'hiflier,prod12,5.00,20050101,20050131';

In this example the code word hiflier will give a discount of $5.00 on the purchase of prod12 (whatever that is defined to be in the product array) during January 2005. The discount will not apply before the first of January or after the 31st of January because those are the start and end dates specified. If there isn't a direct link in the ad to purchase the product immediately from there then we would place information into the ad that tells those reading it that the discount applies if they enter the code word "hiflier" when purchasing the product during January from the appropriate page on our site.

If we are offering discounts by placing code words in ads then the page where the product can be purchased needs to have provision for the code word to be entered. To do this we replace the purchase link that calls "paypal1.php?prod=prod12" (or whatever the particular product code is) with a form that has a text field for the discount code word to be entered, a hidden field to pass the product code for the product being purchased, and a submit button to make the purchase. Example code for such a form is supplied with the script in the discount.txt file as well as a copy of the "Buy Now" image that the example form uses to submit the purchase to paypal1.php.

Of course if we are placing a purchase link directly into the ad itself then there is no need to even tell the purchasr what the codeword is because we can incorporate it into that version of the link. In the above example the link would be to "paypal1.php?prod=prod12&custom=hiflier". Anyone clicking on this link during January 2005 would receive the discount. Were the ad to be retained until a later date before an attempt to purchase was made then the discount would not be applied and the purchaser would be asked to pay the regular price.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow