CGI and Perl

Use and Customization

The best way to start using MiniVend is to look at the demo files and tailor them to your own needs. You need to complete the following steps to get your site up and running:

  1. Design and create your base HTML document(s) and images.
  2. Set up your product catalog.
  3. Set up your minivend.cfg file.
  4. Set up your catalog search pages.
  5. Set up your search result pages.
  6. Set up your order page.
  7. Set up other miscellaneous pages.

The demo sample catalog contains examples of all these items; using it is also a great way to get started. All accesses into your catalog besides your base HTML files are through the vlink CGI executable. This program looks for the MiniVend tags within your catalog pages and substitutes items for sale according to your product database and MiniVend configuration file.

Your base HTML document and images can be designed without any knowledge of the MiniVend package. This will simply be your virtual storefront window, and it will be the attraction that brings the user into your store. The links on this page will be to your MiniVend catalog and search pages described a bit later. Before I get into those pages, however, you should understand more about how the product catalogs are designed.

Setting Up Your Product Catalog

First, you need to set up your product catalog. The product catalog is contained in a database file called products.asc, which is an ASCII text file in which each row is a product item whose fields are delimited using TAB, PIPE, or CSV. The field names are contained on the first line of the file. These names must consist entirely of the characters hyphen, underscore, the digits 0 through 9 and the letters A through Z in upper- or lowercase form; they are case sensitive, and they must match the field names of the [in_field] tags in your catalog HTML files.

The default TAB delimiter says to separate each field using a hard tab character ^I. For example,

code    description    price     image
 HA_001  Stereo         150.95    stereo.jpg
 HV_001  Television     500.95    tv.jpg

The PIPE delimiter separates each field using the pipe character |. For example,

code|description|price|image
 HA_001|Stereo|150.95|stereo.jpg
 HV_001|Television|500.95|tv.jpg

And the CSV delimiter specifies fields enclosed in quotation marks and separated by commas. For example,

"code","description","price","image"
 "HA_001","Stereo","150.95","stereo.jpg"
 "HV_001","Television","500.95","tv.jpg"

You must set the delimiter directive appropriately for the delimiter format you choose. A set of fields such as code, description, and price is required. You may define as many additional fields as you need; however, the product code must be the first field in the line. You can extract customized field values using the [data] tag in your catalog pages.

by BrainBellupdated
Advertisement: