Product discounts in Interchange can be set at any time. The discounts apply only to the customer receiving them, so you can set discounts based on membership in a club or other arbitrary means.
Discounts are defined using the [discount]
tag,
and are of the following types:
Discount on a specific item - a discount for one particular item.
Key to use with the [discount]
tag is the product's SKU
Discount on all items - a discount applying to all items.
Key to use with the [discount]
tag is ALL_ITEMS
Discount on a particular item at particular time -
a discount for an individual line item, applied if the mv_discount
attribute is set (usually with embedded Perl)
Order discount - a discount applied not to individual products, but to the
total order amount.
Key to use with the [discount]
tag is ENTIRE_ORDER
Discounts within the [discount]
tag are specified using a formula.
The formula is scanned for
the $q
and $s
variables which are
substituted for the item quantity and subtotal respectively.
The variable $s
is saved between
iterations, so that the discounts can be cumulative.
In case of individual item discounts, the formula must be constructed to
handle all instances of a particular SKU found in the user's basket.
There are many ways how same SKU might occur
multiple times in the user's basket (for example, with SeparateItems
enabled) — the same formula will be invoked on every occurrence and
it should always give out the correct individual subtotal.
In case of an entire order discount, the formula is usually simpler and defines a flat discount amount or percentage.
Discounts are applied to the effective price of the product, that is — the price obtained after applying price adjustments.
For examples, see the [discount]
reference page.
In April 2005, Interchange added support for "discount spaces" (using CGI
variable mv_discount_space
),
in a manner akin to values space (mv_values_space
) or
named shopping cart (mv_cartname
). See DiscountSpacesOn
and DiscountSpaceVar
for usage examples.