Difference between revisions of "VbzCart/pieces/checkout"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(moved code flow to archive)
(more obsolete code notes moved to archive)
Line 1: Line 1:
 
==About==
 
==About==
 
The checkout subsystem handles customer interaction from the point when the customer presses "check out" on the shopping cart up to the point where the order is placed ("finish" button in old system).
 
The checkout subsystem handles customer interaction from the point when the customer presses "check out" on the shopping cart up to the point where the order is placed ("finish" button in old system).
===Requirements===
+
==Requirements==
 
* Record shipping information
 
* Record shipping information
 
* Record payment information
 
* Record payment information
* Prevent customer from proceeding if required fields are missing or contain invalid data
+
** Allow customer to indicate that payment address is same as shipping.
* Send notification email to customer and store when order is placed
+
* Prevent customer from proceeding if required fields are missing or contain invalid data.
 +
* Keep records of customer information as entered and also as interpreted for order processing.
 +
* Send notification email to customer and store when order is placed.
 +
** Present customer with printable/saveable receipt.
 +
==Process==
 
===Conversion===
 
===Conversion===
 
Converting the cart data to order data seems to be one of the trickiest parts to get right.
 
Converting the cart data to order data seems to be one of the trickiest parts to get right.
 
Revised code flow:
 
* '''cart/cart.logic.php''': function ToOrder_Data(clsOrder $rcOrd)
 
** $tCust->CreateRecord_fromContact($idUser,$oBuyer);
 
** $tCust->CreateRecord_fromContact($idUser,$oRecip);
 
  
 
Basically, the Cart object now supervises the creation of new records as needed. Customer objects just create customer records, not address or name or whatever.
 
Basically, the Cart object now supervises the creation of new records as needed. Customer objects just create customer records, not address or name or whatever.
 
 
===Navigation===
 
===Navigation===
It looks like the best way to handle form navigation is to have constant control names for the "back" and "next" buttons and to include the name of the submitting form in a hidden field.
+
It looks like the best way to handle form navigation is to have constant control names for the "back" and "next" buttons and to include the name of the submitting form in a hidden field.<ref name=navbtns />
  
For the 2009 rewrite, I initially tried to have the "back" and "next" buttons specify the target form, removing the need for the submitting-form-identifier, but this causes problems under the following circumstances:
+
Where form data does not need to be saved, switching modes for a given page can be done with a clickable link rather than a button.
 +
==Related Pages==
 +
* [[/archive]]: outdated stuff
 +
==Footnote==
 +
<references>
 +
<ref name=navbtns>For the 2009 rewrite, I initially tried to have the "back" and "next" buttons specify the target form, removing the need for the submitting-form-identifier, but this causes problems under the following circumstances:
 
* determining if the user should be allowed to load the requested form when required fields in the current form have been left empty:
 
* determining if the user should be allowed to load the requested form when required fields in the current form have been left empty:
 
** If the user is moving forward, then NO - the submitting form should be re-displayed with a message listing the missing fields
 
** If the user is moving forward, then NO - the submitting form should be re-displayed with a message listing the missing fields
Line 27: Line 30:
 
** If this page has been submitted previously, then the stored data should be checked
 
** If this page has been submitted previously, then the stored data should be checked
 
** If this page is being re-loaded because the user requested a forward move while leaving one or more required fields blank, then the submitted data must be checked (this rule can be simplified by storing it first and then always checking stored data)
 
** If this page is being re-loaded because the user requested a forward move while leaving one or more required fields blank, then the submitted data must be checked (this rule can be simplified by storing it first and then always checking stored data)
 
+
</ref>
==Related Pages==
+
</references>
* [[/archive]]: outdated stuff
 

Revision as of 15:44, 16 September 2018

About

The checkout subsystem handles customer interaction from the point when the customer presses "check out" on the shopping cart up to the point where the order is placed ("finish" button in old system).

Requirements

  • Record shipping information
  • Record payment information
    • Allow customer to indicate that payment address is same as shipping.
  • Prevent customer from proceeding if required fields are missing or contain invalid data.
  • Keep records of customer information as entered and also as interpreted for order processing.
  • Send notification email to customer and store when order is placed.
    • Present customer with printable/saveable receipt.

Process

Conversion

Converting the cart data to order data seems to be one of the trickiest parts to get right.

Basically, the Cart object now supervises the creation of new records as needed. Customer objects just create customer records, not address or name or whatever.

Navigation

It looks like the best way to handle form navigation is to have constant control names for the "back" and "next" buttons and to include the name of the submitting form in a hidden field.[1]

Where form data does not need to be saved, switching modes for a given page can be done with a clickable link rather than a button.

Related Pages

Footnote

  1. For the 2009 rewrite, I initially tried to have the "back" and "next" buttons specify the target form, removing the need for the submitting-form-identifier, but this causes problems under the following circumstances:
    • determining if the user should be allowed to load the requested form when required fields in the current form have been left empty:
      • If the user is moving forward, then NO - the submitting form should be re-displayed with a message listing the missing fields
      • If the user is moving backward, then YES - the requested form should be displayed regardless
    • determining the status of the data on the target page, so as to display the proper status message (indicating what fields, if any, are missing):
      • If this page has never been submitted, then no message should be displayed
      • If this page has been submitted previously, then the stored data should be checked
      • If this page is being re-loaded because the user requested a forward move while leaving one or more required fields blank, then the submitted data must be checked (this rule can be simplified by storing it first and then always checking stored data)