Hazel provides a file-based system of offering coupons to customers. `Coupons' is possibly a misnomer, in that these files specify more than just a simple discount. They are actually lines of credit redeemable by a user aware of the coupon's code (its filename.)
Because there is no password or other protection associated with coupons at this time, care must be taken when using them. You should be sure to keep your coupons directory unreadable by anyone other than your own userid. If someone knows a coupon filename and nobody else is using it at the time, they can enter it themself and redeem the credit. You've been warned!
To use coupons, you should have the latest Hazel--at least 3.354. Be sure to check out notes in the upgrade docs.
Adding a Coupon
To make a coupon, add a hazel-cat/coupons directory and a file with the name of the coupon code (case /is/ sensitive) and an extension of `txt'. For example, a coupon code FOO would have a file hazel-cat/coupons/FOO.txt like so:
NOTE:Birthday gift from Bob.
CREDIT_REMAINING is how much credit remains on the coupon (duh), NOTE is a note to be displayed in the notes loop, and EXPIRES is when it expires. Hazel will decrement the CREDIT_REMAINING when a coupon is redeemed.
Be sure to make the coupons directory unreadable by everyone but your domain user. Otherwise, anyone could redeem a coupon by its filename! It is recommended that you do not use the coupons feature of Hazel unless you have a tight server setup.
Using a Coupon
Hazel receives a coupon code via the HAZEL_COUPON input field. If it matches the basename of a file in her hazel-cat/coupons directory, she will apply its value to the order credit, and reduce the credit remaining by the amount used.
Once a particular shopper enters a coupon-id, it is attached to that order until it is processed, to avoid several people trying to redeem the same coupon at the same time.
Coupons are added to the CREDIT total of an order, so you can use %HZT_UNCREDITED to access the pre-credit total, %HZT_CREDIT to access the actual credit, and %HZT_ORDER for the grand total, as usual. For example, a block like this amongst the line items of your payment template:
<th align="left" colspan=5 bgcolor="#dddddd">Pre-Credit Total</th>
<th align="left" colspan=5 bgcolor="#dddddd">
Credits (see notes below; $%HZT_CREDIT_REMAINING remains on account)
<td align="right"><tt>- %HZT_CREDIT</tt></td>
A credit.rules file can be used similiarly to the discount and surcharge rules to apply credit to an order. While similiar to discounts, credit differs in that it is treated as cash by Hazel. The credit is taken off the order after everything else--including taxes.