corner black line corner
black line
the Hazel Logo Hazel Enterprise: The Internet Merchandising System The Netsville Logo
start red bar Home News Info Features Examples Purchase Support Contact Us end red bar
Documentation: Coupons and Credits

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!

Requirements

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:

CREDIT_REMAINING:100.00
NOTE:Birthday gift from Bob.
EXPIRES:20010628

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.

Displaying Credit

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:

<Hazel-True Token="%HZT_CREDIT">
<tr>
<th align="left" colspan=5 bgcolor="#dddddd">Pre-Credit Total</th>
<td align="right"><tt>%HZT_UNCREDITED</tt></td>
</tr>
<tr>
<th align="left" colspan=5 bgcolor="#dddddd">
Credits (see notes below; $%HZT_CREDIT_REMAINING remains on account)
</th>
<td align="right"><tt>- %HZT_CREDIT</tt></td>
</tr>
</Hazel-True>

credit.rules

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.

Getting Started HZML Rules Extras Advanced Reference
Walkthrough
Configuration
Products File
Order Reporting
Platforms
Upgrading
Known Problems
Actions
HZML Tokens
HZML Tags
HZML Loops
HZML & HAM
Overview
Shipping
Sales Tax
Discounts
Surcharges
Tweaking
Customization
Input Fields
Softgoods
Search Engine
Optioned Products
Plugins
Design Tips
Themes
Currency
Payment Methods
Coupons
Regular Expressions
Perl API
hazel.config
Templates
HTML Basics
CGI and You
ChangeLog

Hazel Home - Help Contents - Searchable Knowledge Base - Live Technical Support

black line
corner black line corner