checkout

The check-out process consists of users filling in information via HTML forms, and Interchange verifying their input on arbitrary number of levels using so-called profiles.

Profiles can be defined in external files (and activated using OrderProfile) or in scratch variables. External files are, by convention, kept in CATROOT/etc/ and begin with profiles.. Multiple profiles can be defined in each file.

You can learn about the principle and syntax of the profile files in the profile glossary entry. Only when the input "passes" the profile check, is the check-out process able to proceed.

Simple Order Report File

Most of the time, you will want the successful check-out operation (order completion) to generate some kind of notification. In most common setups, this will include e-mailing order reports.

Simple order report file, CATROOT/etc/report, defines the layout (template) of the order report. All form variables are accessible from the report file by using the familiar Perl $ syntax.

         Order Date: $date
  
               Name: $name
      Email address: $email
  
   Shipping address: $addr
   Town, State, Zip: $town, $state $zip
            Country: $country

Fully-configurable Order Reports

You can specify fully-configurable order reports by setting the hidden form variable mv_order_report to an existing Interchange catalog page. This page will be processed (interpolated and all) as standard Interchange page before being sent by email. That said, you see you could include HTML in the file. Although many mail clients will parse HTML, it seems that the initial excitement among the ordinary people vanished and they again prefer plain-text e-mails. If you wanted to provide a HTML version, you could always provide a link to a copy on your web server.

Order Counter

An order counter can be enabled simply — just set the OrderCounter directive to the appropriate file name. An incrementing count of all orders will be kept and assigned as orders are placed. By default, the number starts at 0, but you can edit the file and change the starting or current number at any time. This feature is made possible by the File::CounterFile Perl module.

Custom Form Fields

The default basket and order pages contain a number of form fields, allowing customers to enter the necessary information. This, however, can't satisfy all individual needs. To remove some of the fields, simply delete them from the HTML pages (or, better yet, disable by using the [comment] tag). Do not forget to also deactivate any entries in the profile files.

To add new fields, simply add them to the pages. The information will automatically be included in the report files. Here's a template you could re-use for your own fields, replacing town with your values:

<input type="text" name="town" value="[value town]" size="30" maxlen="40" />

[Note]Note

Using maxlen HTML <input> attribute to limit the length of incoming input is insecure, since that check is performed client-side only. It is surely an element of good programming on all levels, but don't forget to perform real length check in the appropriate form profile.

DocBook! Interchange!