PriceBreaks, discounts, and PriceAdjustment

### Index Up << >>

## PriceBreaks, discounts, and PriceAdjustment

There are several ways that MiniVend can modify the price of a product during normal catalog operation. Several of them require that the pricing.asc file be present, and that you define a pricing database. You do that by placing the following directive in catalog.cfg:

      Database  pricing pricing.asc 1

NOTE: PriceAdjustment is slightly deprecated by CommonAdjust, but will remain in use at least through the end of Version 3 of MiniVend.

Configurable directives and tags with regard to pricing:

- Quantity price breaks are configured by means of the PriceBreaks and MixMatch directives. They require a field named specifically price in the pricing database. The price field contains a space-separated list of prices that correspond to the quantity levels defined in the PriceBreaks directive. If quantity is to be applied to all items in the shopping cart (as opposed to quantity of just that item) then the MixMatch directive should be set to Yes.

- Individual line-item prices can be adjusted according to the value of their attributes. See PriceAdjustment and CommonAdjust. The pricing database must be defined unless you define the CommonAdjust behavior.

- Product discounts for individual products, specific product codes, all products, or the entire order can be configured with the [discount ...] tag. Discounts are applied on a per-user basis -- you can gate the discount based on membership in a club or other arbitrary means. See Product Discounts.

For example, if you decided to adjust the price of T-shirt part number 99-102 up 1.00 when the size is extra large and down 1.00 when the size is small, you would have the following directives defined in <catalog.cfg>:

      Database          pricing pricing.asc 1
      UseModifier       size
      PriceAdjustment   size

To enable automatic modifier handling, you define a size field in products.txt:

      code    description   price    size
      99-102  T-Shirt       10.00    S=Small, M=Medium, L=Large*, XL=Extra Large

You would place the proper tag within your `[item-list]` on the shopping-basket or order page:

        [item-accessories size]

In the pricing.asc database source, you would need:

      code      S       XL
      99-102    -1.00   1.00

As of MiniVend 3.06, if you want to assign a price based on the option, precede the number with an equals sign:

      code    S       M       L       XL
      99-102  =9.00   =10     =10     =11

IMPORTANT NOTE: Price adjustments occur AFTER quantity price breaks, so the above would negate anything set with the PriceBreaks directive/option.

Numbers that begin with an equals sign (`=`) are used as absolute prices and are interpolated for MiniVend tags first, so you can use subroutines to set the price. To facilite coordination with the subroutine, the session variables `item_code` and `item_quantity` are set to the code and quantity of the item being evaluated. They would be accessed in a global subroutine with `$Vend::Session-`>`{item_code}` and `$Vend::Session-`>`{item_quantity}`.

The pricing information must always come from a database because of security.

### Index Up << >>