The Product Database

### Index Up << >>

## The Product Database

Each product you are selling should be given a product code: A short code that identifies the product on the ordering page and in the catalog. You can use any combination of letters, digits, dashes, periods, hash signs, or underscores for the product code. The products.txt file is a ASCII-delimited list of all the product codes, along with an arbitrary number of fields which must contain at least the fields description and price (or whatever you set the PriceField and DescriptionField directives to). Any additional information you want in the catalog can be placed in any arbitrary field. See MiniVend Database Capabilityfor details on the format.

Field names are case-sensitive. Unless you have fields with the names ``description'' and ``price'' field, you will have to appropriately set the PriceField and DescriptionField directives to use the `[item-price]` and `[item-description]` tags.

The product code must be the first field in the line, and must be unique. Product codes can contain the characters A-Za-z0-9, along with hyphen (`-`), underscore (`_`), pound sign/hash mark (`#`), slash (`/`), and period (`.`).

The words should be separated by one of the approved delimiting schemes (TAB, PIPE, or CSV), and are case-sensitive in some cases. If you play with the case of the ``description'' or ``price'' field, you will have to appropriately set the PriceField and DescriptionField directives.

NOTE: CSV is not recommended as the scheme for the products database. It is much slower than TAB- or PIPE-delimited, and dramatically reduces search engine functionality -- no field-specific searches are possible. Don't use it unless you know exactly what you are doing -- you will be sorry if you do. Using CSV for any small database that will not be searched is fine.

IMPORTANT NOTE: The field names must be on the first line of the `products.txt` file. These field names must match exactly the field names of the `[item-field]` tags in your catalog pages, or the MiniVend server will not access them properly. Field names can contain the characters A-Za-z0-9, along with hyphen (`-`), underscore (`_`), pound sign/hash mark (`#`), slash (`/`), and period (`.`).

More than one database may be used as a products database. If the catalog directive ProductFiles is set to a space-separated list of valid MiniVend database identifiers, those databases will be searched (in the order specified) for any items that are ordered, or for product information (as in the `[price code]` and `[field code]` tags).

When the database table source file (i.e. products.txt) changes after import or edit, the DBM database is re-built upon the next user access. No restart of the server is necessary.

If changing the database on the fly, it is recommended that you lock the file while it is being modified.

### Index Up << >>