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: Discounts

Hazel discounts range from "10% off everything on Fridays" store-wide discounts via her discount rules to "Buy 1 Get 1 Free!" volume discounts. Neither is particularly difficult once you get the hang of them.

If you haven't read the rules files, absorb them now, as we'll first discuss the peculiarities of discount rules, then get into per-item exemptions and volume discounts.

The total calculated discount can be accessed in your templates via the HZML token %HZT_DISCOUNT.


discount.rules

Discount rules are defined in the discount.rules file under the rules directory in your catalog root.

The discount rules file included with the Hazel distribution is named discount.sample, because some folks were going live with KRAZY DISCOUNTS. If you plan to use discounts, be sure to rename the file to discount.rules.

[Header] Type Description number below is the numeric part of the rule's action
+ x (default)
PRICE
WEIGHT
QUANTITY
ITEMS
NUM The price, weight, total quantity, or total unique SKUID of items without a custom DISCOUNT field in the products file. add number to total replace total if number is greater
STATE
COUNTRY
STR The state or country of the billing address. add number to total replace total if number is greater
POSTAL_CODE ZIP The postal code of the billing address. add number to total replace total if number is greater
WEEKDAY WDAY The day of the week. SUN, MON, TUE, WED, THU, FRI, SAT. add number to total replace total if number is greater
DATE DATE The date. Eg. 19971010 is "October 10, 1997." add number to total replace total if number is greater
TIME TIME The time of day. Eg. 175543 is "5:55 pm, 43 seconds." add number to total replace total if number is greater
  • total is the total discount calculated thus far. It always begins at 0.00.
  • Note that special volume discounts such as "two for one" do not exempt an item from the discount rules. Only a products file DISCOUNT field value of "none" or "0" or another percentage rate will exclude an item from rates derived from discount rules.
  • Please note that all discounts are percentile-based (ie. 0.50 is "50% off"). Unless you're giving away your merchandise, the total discount should never be greater than 1.

Discount Exemptions

You can exempt a product from rules file discounts by adding a DISCOUNT field to its entry in the products file with a value of "0" or "none". Here's an example products file entry, featuring the ubiquitous "FOO".


# Foo

SKUID: FOO     # The product code.
PRICE: 1.00    # The base price.  (unused because of our discounts)
NAME: Foo      # The product name.
DISCOUNT: 0.00 # No discount for Foo!

You can also define a discount such as "0.50" to offer 50% off a particular product.

Volume Discounts

Furthermore, that discount field can define volume discounts based on the quantity ordered. There are three basic types of volume discounts. The first two operate on specific quantities. The last operates on either a specifiy quantity or a range of quantities, and for that gets its very own table.

Format Description Example Explanation
bxgzf Buy x items, get z free. b2g1f Buy two items, get one free!
bxfz Buy x items for $z. b3f10.00 Buy three item for ten dollars!

Format Description Example Explanation
bxfze Buy x items for $z each. b4f1.00e Buy four items for a dollar each!
bx-yfze Buy x-y items for $z each. b4-10f1.00e Buy four to ten items for a dollar each!
b-yfze Buy y or fewer items for $z each. b-10f1.00e Buy 10 or fewer items for a dollar each!
bx+fze Buy x or more items for $z each. b11+f0.50e Buy 11 or more items for 50 cents each!

Some things to know about volume discounts...

  • You may define as many volume discounts as you like for a product, separated by semicolons. Only the best price will be used.
  • An order note will be added for each item which triggers a volume discount, explaining how the item was discounted.
  • Volume discounts will not not be added to the %HZT_DISCOUNT "total discount".
  • Items which trigger volume discounts can further be discounted by rules.

Here's an example of a product file entry for the product "FOO", with several tiers of volume discounts. The comments (everything after the octothorpe, hash mark, number sign, pound sign, the "#") are solely for the benefit of the lowly human readers. The first few describe to us what the DISCOUNT field describes to Hazel -- how discounts are to be applied.


# Foo
# Buy 5 or less for $1.00 each.
# Buy 6-10 for 75 cents each.
# Buy 11 or more for 50 cents each.

SKUID: FOO   # The product code.
PRICE: 1.00  # The base price.  (unused because of our discounts)
NAME: Foo    # The product name.
DISCOUNT: b-5f1.00e;b6-10f0.75e;b11+f0.50e  # The discount!

To add your own volume discounts, just add a DISCOUNT line to the product you wish to be discounted.

Because of the flexibility of volume discounts, their display on the checkout templates can be somewhat troublesome. As of the current 3.0 version of Hazel, the per-item price (the HZML token %HZI_PRICE) is the same, but the line item total (%HZI_TOTAL_PRICE) reflects the discounts. The volume discount is explained in an order note, which is currently not customizable by the merchant. If you wish the individual item price to reflect the total price divided by quantity, add ADJUST_DISCOUNTED_ITEM_PRICE:1 to your hazel.config file. We welcome any suggestions for improving the volume discount mechanism. Send them to hazel@netsville.com

.
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