MiniVend can send order emails and perform custom credit card charges
and/or logging for each individual item. The Route directive is used to control this behavior, along with the mv_order_route
item attribute and mv_order_route
form variable.
Routes are established with the Route directive, which is similar to the Locale directive. Each route is like a locale, in that you can set key-value pairs. Here is an example setting:
Route VEN pgp_key 0x67798115 Route VEN email orders@minivend.com Route VEN reply service@minivend.com Route VEN encrypt 1 Route VEN encrypt_program "/usr/bin/pgpe -fat -q -r %s" Route VEN report etc/report_mail
This route would be used whenever the value VEN
was contained in the form variable mv_order_route
.
The last route that is defined provides the defaults for all other routes. For example, if encrypt_program is set there then the same value will be the default for all routes.
The attributes that can be set are:
OrderCounter
for this route. It will generate a different value for mv_order_number
for the route.
Route VEN cybermode mauthonly Route VEN CYBER_CONFIGFILE config/vendor1_cfg Route VEN CYBER_VERSION 3.2
address(es)
where the order should be sent. Set just
like the MailOrderTo directive, which is also the default.
%s
will be replaced with the pgp_key. Default is pgpe -fat -r %s
.
Errors-To:
email header so that bounced orders will go to the proper address. Default
is the same as MailOrderTo.
mv_order_number
. This can be useful for batching orders via download.
.
) if that is desired.
individual_track_ext .pgp
pgpk -l
.
pgpk -l
.
Reply-To
header that should be set. Default is the same as email.
If there are only word characters (A-Za-z0-9 and underscore) then it describes a MiniVend variable name where the address can be found.
An individual item routing causes all items labeld with that route to be
placed in a special sub-cart which will be used for the order report. This
means that the [item-list] LIST [/item-list]
will only contain those items, allowing operations to be performed on
subsets of the complete order.
Here is an example of an order routing:
Route HARD pgp_key 0x67798115 Route HARD email hardgoods@minivend.com Route HARD reply service@minivend.com Route HARD encrypt 1 Route HARD encrypt_program "/usr/bin/pgpe -fat -q -r %s" Route HARD report etc/report_mail Route SOFT email "" Route SOFT profile create_download_link Route SOFT empty 1
Route main cybermode mauthonly Route main CYBER_VERSION 3.2 Route main CYBER_CONFIGFILE etc/cybercash.cfg Route main pgp_key 0x67798115 Route main email orders@minivend.com Route main reply service@minivend.com Route main encrypt 1 Route main encrypt_program "/usr/bin/pgpe -fat -q -r %s" Route main report etc/report_all To tell MiniVend that order routing is in effect, the variable mv_order_route is set on the B<final> order submission form:
<INPUT TYPE="hidden" NAME="mv_order_route" VALUE="main">
To set the order routing for individual items, some method of determining
their status must be made and the mv_order_route
attribute must be set. This could be set at the time of the item being
placed in the basket, or you can have a database field called goods_type
set to the appropriate value. We will use this Perl routine on the final
order form:
[perl arg=carts interpolate=1] my $string = <<'EOF'; [item-list][item-code] [item-field goods_type] [/item-list] EOF my @items; my %route; @items = grep /\S/, split /\n+/, $string; for(@items) { my ($code, $keycode) = split /\t/, $_; $route{$code} = $keycode; } my $cart = $Carts->{'main'}; my $item; foreach $item ( @{ $Carts->{'main'} } ) { $item->{mv_order_route} = $route{$item->{'code'}} || undef; } return ''; [/perl]
Now the individual items are labeled with a mv_order_route
value which will cause their inclusion in the appropriate order routing.
Upon submission of the order form, any item labeled HARD
will be accumulated and sent to the email address hardgoods@minivend.com
, where presumably the item will be pulled from inventory and shipped.
Any item labeled SOFT
will be passed to the order profile
create_download_link
, which will place it in a staging area for customer download. (This would
be supported by a link on the receipt, perhaps by reading a value set in
the profile).
The main
order routing will use CyberCash to charge the order, and will be
completely encrypted for emailing.