[ic] Advanced Multi-level Order Pages

interchange-users@lists.akopia.com interchange-users@lists.akopia.com
Wed Jul 25 23:02:01 2001


On Wed, Jul 25, 2001 at 08:34:54PM -0500, Interchange Admin wrote:
> The manual page for "OrderProfile" suggests "See Advanced Multi-level
> Order Pages."  I tried to see it but I couldn't find it.

Yeah it's right there in mv4.03 docs...  <yuck yuck>

See below sig.


-- 

Christopher F. Miller, Publisher                               cfm@maine.com
MaineStreet Communications, Inc           208 Portland Road, Gray, ME  04039
1.207.657.5078                                         http://www.maine.com/
Content/site management, online commerce, internet integration, Debian linux


<HTML>
<HEAD>
<TITLE>Advanced Multi-level Order Pages</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H3><A HREF="index.html">Index</A>&nbsp;&nbsp;<A HREF="13.00.THE_ORDER_PROCESS.html">Up</A>&nbsp;&nbsp;<A HREF="13.06.Multiple_Shopping_Carts.html">&lt;&lt;</A>&nbsp;&nbsp;<A HREF="13.08.Simple_Order_Report_File.html">&gt;&gt;</A>&nbsp;&nbsp;</H3>
<HR>
<H2><A NAME="Advanced_Multi_level_Order_Pages">Advanced Multi-level Order Pages</A></H2>
<P>
An unlimited number of order checking profiles can be defined with the
<EM>OrderProfile</EM> 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.

<P>
To custom-configure the error message, place it after the format check
requirement.

<P>
Specifications take the form of an order page variable (like name or
address), followed by an equals sign and one of five check types:

<DL>
<DT><STRONG><A NAME="item_required">required</A></STRONG><DD>

<FONT SIZE=-1>A</FONT> non-blank value is required

</DD><P><DT><STRONG><A NAME="item_mandatory">mandatory</A></STRONG><DD>
Must be non-blank, and must have been specified on this form, not a saved
value from a previous form

</DD><P><DT><STRONG><A NAME="item_phone">phone</A></STRONG><DD>
The field must look like a phone number, by a very loose specification
allowing numbers from all countries

</DD><P><DT><STRONG><A NAME="item_phone_us">phone_us</A></STRONG><DD>
Must have 
<FONT SIZE=-1>US</FONT> phone number formatting, with area code

</DD><P><DT><STRONG><A NAME="item_state">state</A></STRONG><DD>
Must be a 
<FONT SIZE=-1>US</FONT> state, including 
<FONT SIZE=-1>DC</FONT> and Puerto Rico.


</DD><P><DT><STRONG><A NAME="item_province">province</A></STRONG><DD>
Must be a Canadian province or pre-1997 territory.

</DD><P><DT><STRONG><A NAME="item_state_or_province">state_or_province</A></STRONG><DD>
Must be a 
<FONT SIZE=-1>US</FONT> state or Canadian province.

</DD><P><DT><STRONG><A NAME="item_zip">zip</A></STRONG><DD>
Must have 
<FONT SIZE=-1>US</FONT> postal code formatting, with optional 
<FONT SIZE=-1>ZIP+4.</FONT> Also called by the alias
 <CODE>us_postcode</CODE>.

</DD><P><DT><STRONG><A NAME="item_ca_postcode">ca_postcode</A></STRONG><DD>
Must have Canadian postal code formatting. Checks for a valid first letter.

</DD><P><DT><STRONG><A NAME="item_postcode">postcode</A></STRONG><DD>
Must have Canadian or 
<FONT SIZE=-1>US</FONT> postal code formatting.

</DD><P><DT><STRONG><A NAME="item_true">true</A></STRONG><DD>
Field begins with <STRONG>y</STRONG>, <STRONG>1</STRONG>, or <STRONG>t</STRONG> (Yes, 1, or True) - not case sensitive

</DD><P><DT><STRONG><A NAME="item_false">false</A></STRONG><DD>
Field begins with <STRONG>n</STRONG>, <STRONG>0</STRONG>, or <STRONG>f</STRONG> (No, 0, or False) - not case sensitive

</DD><P><DT><STRONG><A NAME="item_email">email</A></STRONG><DD>
Rudimentary email address check, must have an '@' sign, a name, and a
minimal domain

</DD><P></DL>
<P>
Also, there are pragmas that can be used to change behavior:

<DL>
<DT><STRONG><A NAME="item__amp_charge">&amp;amp;charge</A></STRONG><DD>
Perform a real-time charge operation. If set to any value but ``custom'', it will use MiniVend's CyberCash routines. To set to something else, use the value ``custom 
<FONT SIZE=-1>ROUTINE''.</FONT> The 
<FONT SIZE=-1>ROUTINE</FONT> should be a GlobalSub which will cause the charge operation to occur -- if it returns non-blank, non-zero the profile will have succeeded. If it returns 0 or undef or blank, the profile will return failure.


</DD><P><DT><STRONG><A NAME="item__amp_credit_card">&amp;amp;credit_card</A></STRONG><DD>
Checks the mv_credit_card_* variables for validity. If set to ``standard'',
it will use Minivend's <CODE>encrypt_standard_cc</CODE> routines. This destroys the 
<FONT SIZE=-1>CGI</FONT> 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 <CODE>keep</CODE> on the end.

<P>
Example:

<P>
<PRE>    # Checks credit card number and destroys number after encryption
    # The charge operation can never work
 
    &amp;credit_card=standard
    &amp;charge=custom authorizenet
  
    # Checks credit card number and keeps number after encryption
    # The charge operation can now work
 
    &amp;credit_card=standard keep
    &amp;charge=custom authorizenet
</PRE>
<P>
You can supply your own check routine with a GlobalSub:

<P>
<PRE>    &amp;credit_card=check_cc
</PRE>
<P>
The <CODE>GlobalSub</CODE> check_cc will be used to check and encrypt the credit card number, and its
return value will be used to determine profile success.

</DD><P><DT><STRONG><A NAME="item__amp_fail">&amp;amp;fail</A></STRONG><DD>
Sets the mv_failpage value.

<P>
<PRE>    &amp;fail=page4
</PRE>
<P>
If the submit process succeeds, the user will be sent to the page <CODE>page4</CODE>.

</DD><P><DT><STRONG><A NAME="item__amp_fatal">&amp;amp;fatal</A></STRONG><DD>
Set to '&amp;fatal=yes' if an error should generate the error page.

</DD><P><DT><STRONG><A NAME="item__amp_final">&amp;amp;final</A></STRONG><DD>
Set to '&amp;final=yes' if a successful check should cause the order to be
placed.

</DD><P><DT><STRONG><A NAME="item__amp_return">&amp;amp;return</A></STRONG><DD>
Causes profile processing to terminate with either a success or failure
depending on what follows. If it is non-blank and non-zero, the profile
succeeds. 

<P>
<PRE>    # Success :)
    &amp;return 1
</PRE>
<P>
<PRE>    # Failure :\
    &amp;return 0
</PRE>
<P>
Will ignore the <CODE>&amp;fatal</CODE> pragma, but <CODE>&amp;final</CODE>
is still in effect if set.

</DD><P><DT><STRONG><A NAME="item__amp_set">&amp;amp;set</A></STRONG><DD>
Set a user session variable to a value, i.e. <CODE>&amp;set=mv_email [value email]</CODE>. This will not cause failure if blank or zero.

</DD><P><DT><STRONG><A NAME="item__amp_setcheck">&amp;amp;setcheck</A></STRONG><DD>
Set a user session variable to a value, i.e. <CODE>&amp;set=mv_email [value
email]</CODE>. This <STRONG>will</STRONG> cause failure if set to a blank or zero. It is usually placed at the end
after a <CODE>&amp;fatal</CODE> 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.

</DD><P><DT><STRONG><A NAME="item__amp_success">&amp;amp;success</A></STRONG><DD>
Sets the mv_successpage value. Example:

<P>
<PRE>    &amp;success=page5
</PRE>
<P>
If the submit process succeeds, the user will be sent to the page <CODE>page5</CODE>.

</DD><P></DL>
<P>
As an added measure of control, the specification is evaluated for the
special MiniVend tags to provide conditional setting of order parameters.
With the <CODE>[perl]</CODE>  <CODE>[/perl]</CODE> capability, quite complex checks can be done. Also, the name of the page to
be displayed on an error can be set in the <A HREF="#item_mv_failpage">mv_failpage</A> variable.

<P>
The following file specifies a simple check of formatted parameters:

<P>
<PRE> 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
 &amp;fatal=yes
 email=email Email address missing the domain?
 &amp;set=mv_email [value email]
 &amp;set=mv_successpage ord/shipping
</PRE>
<P>
The profile above only performs the <CODE>&amp;set</CODE> directives if all
of the previous checks have passed -- the &amp;fatal=yes will stop
processing after the check of the email address if any of the previous
checks failed.

<P>
If you want to place multiple order profiles in the same file, separate them with 
<FONT SIZE=-1>__END__,</FONT> which must be on a line by itself.


<P>
<HR>

<P ALIGN=CENTER><H3><A HREF="index.html">Index</A>&nbsp;&nbsp;<A HREF="13.00.THE_ORDER_PROCESS.html">Up</A>&nbsp;&nbsp;<A HREF="13.06.Multiple_Shopping_Carts.html">&lt;&lt;</A>&nbsp;&nbsp;<A HREF="13.08.Simple_Order_Report_File.html">&gt;&gt;</A>&nbsp;&nbsp;</H3></BODY></HTML>