An unlimited number of order checking profiles can be defined with the OrderProfile directive, or by defining order profiles in scratch variables. This allows a multi-level ordering process, with checking for format and validity at every stage.
To custom-configure the error message, place it after the format check requirement.
Specifications take the form of an order page variable (like name or address), followed by an equals sign and one of five check types:
us_postcode
.
Also, there are pragmas that can be used to change behavior:
encrypt_standard_cc
routines. This destroys the
CGI value of mv_credit_card_number -- if you don't
want that to happen (perhaps to save it for sending to CyberCash) then add
the word keep
on the end.
Example:
# Checks credit card number and destroys number after encryption # The charge operation can never work &credit_card=standard &charge=custom authorizenet # Checks credit card number and keeps number after encryption # The charge operation can now work &credit_card=standard keep &charge=custom authorizenet
You can supply your own check routine with a GlobalSub:
&credit_card=check_cc
The GlobalSub
check_cc will be used to check and encrypt the credit card number, and its
return value will be used to determine profile success.
&fail=page4
If the submit process succeeds, the user will be sent to the page page4
.
# Success :) &return 1
# Failure :\ &return 0
Will ignore the &fatal
pragma, but &final
is still in effect if set.
&set=mv_email [value email]
. This will not cause failure if blank or zero.
&set=mv_email [value
email]
. This will cause failure if set to a blank or zero. It is usually placed at the end
after a &fatal
pragma would have caused the process to
stop if there was an error -- can also be used to determine pass/fail based
on a derived value, as it will cause failure if it evaluates to zero or a
blank value.
&success=page5
If the submit process succeeds, the user will be sent to the page page5
.
As an added measure of control, the specification is evaluated for the
special MiniVend tags to provide conditional setting of order parameters.
With the [perl]
[/perl]
capability, quite complex checks can be done. Also, the name of the page to
be displayed on an error can be set in the mv_failpage variable.
The following file specifies a simple check of formatted parameters:
name=required You must give us your name. address=required Oops! No address. city=required state=required zip=required email=required phone_day=phone_us XXX-XXX-XXXX phone-number for US or Canada &fatal=yes email=email Email address missing the domain? &set=mv_email [value email] &set=mv_successpage ord/shipping
The profile above only performs the &set
directives if all
of the previous checks have passed -- the &fatal=yes will stop
processing after the check of the email address if any of the previous
checks failed.
If you want to place multiple order profiles in the same file, separate them with __END__, which must be on a line by itself.