VbzCart/docs/tables/shop cart: Difference between revisions

From Woozle Writes Code
< VbzCart‎ | docs‎ | tables
Jump to navigation Jump to search
imported>Woozle
(+ShipZone field)
imported>Woozle
(ID_Sess field)
Line 8: Line 8:
* '''Fields''':
* '''Fields''':
** '''ID_Cust''' is for future use when customers can log in to retrieve their personal data before checking out
** '''ID_Cust''' is for future use when customers can log in to retrieve their personal data before checking out
** '''ID_Session''' is the ID of the session ({{vbzcart|table|shop_session}}) where the cart was created & accessed
** '''ID_Sess''' is the ID of the session ({{vbzcart|table|shop_session}}) where the cart was created & accessed
*** Different sessions cannot access the same cart. (Is there a good reason for this, or does it just ''sound'' good?)
*** Different sessions cannot access the same cart. (Is there a good reason for this, or does it just ''sound'' good?)
*** One session may have multiple carts.
** '''ShipZone''' represents the string-code for the shipping zone, which is used to determine shipping cost
** '''ShipZone''' represents the string-code for the shipping zone, which is used to determine shipping cost
*** currently, this is hard-coded to apply a different multiplier for each zone - {US shipping cost}x{zone multiplier}
*** currently, this is hard-coded to apply a different multiplier for each zone - {US shipping cost}x{zone multiplier}
Line 16: Line 17:
** '''2009-07-10''' removing ID_Session: each session ties to a cart, not vice-versa
** '''2009-07-10''' removing ID_Session: each session ties to a cart, not vice-versa
** '''2009-07-16''' added ShipZone field
** '''2009-07-16''' added ShipZone field
** '''2009-07-18''' added ID_Sess field (field documentation seems to think it was already there...)
==SQL==
==SQL==
<section begin=sql /><mysql>DROP TABLE IF EXISTS `shop_cart`;
<section begin=sql /><mysql>DROP TABLE IF EXISTS `shop_cart`;
Line 24: Line 26:
   `WhenUpdated` DATETIME  DEFAULT NULL COMMENT "when the cart's contents were last changed",
   `WhenUpdated` DATETIME  DEFAULT NULL COMMENT "when the cart's contents were last changed",
   `WhenOrdered` DATETIME  DEFAULT NULL COMMENT "when the cart's contents were transferred to an order",
   `WhenOrdered` DATETIME  DEFAULT NULL COMMENT "when the cart's contents were transferred to an order",
  `ID_Sess`    INT            NOT NULL COMMENT "shop_session.ID which used this cart",
   `ID_Order`    INT        DEFAULT NULL COMMENT "core_orders.ID of order into which cart was transferred",
   `ID_Order`    INT        DEFAULT NULL COMMENT "core_orders.ID of order into which cart was transferred",
   `ID_Cust`    INT        DEFAULT NULL COMMENT "core_custs.ID of customer for this order",
   `ID_Cust`    INT        DEFAULT NULL COMMENT "core_custs.ID of customer for this order",

Revision as of 00:52, 19 July 2009

About

  • Purpose: Shopping cart data is kept separate from order data because we end up with a lot of carts that never become orders; eventually they get cleaned out. Order data may eventually get cleaned out too, but with different criteria; for now, we are keeping order data indefinitely.
  • Relations:
  • Fields:
    • ID_Cust is for future use when customers can log in to retrieve their personal data before checking out
    • ID_Sess is the ID of the session (Template:Vbzcart) where the cart was created & accessed
      • Different sessions cannot access the same cart. (Is there a good reason for this, or does it just sound good?)
      • One session may have multiple carts.
    • ShipZone represents the string-code for the shipping zone, which is used to determine shipping cost
      • currently, this is hard-coded to apply a different multiplier for each zone - {US shipping cost}x{zone multiplier}
  • History:
    • 2009-06-16 Changing names to singular (tables not in use yet, so this is the time to do it)
    • 2009-07-10 removing ID_Session: each session ties to a cart, not vice-versa
    • 2009-07-16 added ShipZone field
    • 2009-07-18 added ID_Sess field (field documentation seems to think it was already there...)

SQL

<section begin=sql /><mysql>DROP TABLE IF EXISTS `shop_cart`; CREATE TABLE `shop_cart` (

 `ID`          INT            NOT NULL AUTO_INCREMENT,
 `WhenCreated` DATETIME       NOT NULL COMMENT "when the cart was first created",
 `WhenViewed`  DATETIME   DEFAULT NULL COMMENT "when the cart's contents were last displayed by the customer",
 `WhenUpdated` DATETIME   DEFAULT NULL COMMENT "when the cart's contents were last changed",
 `WhenOrdered` DATETIME   DEFAULT NULL COMMENT "when the cart's contents were transferred to an order",
 `ID_Sess`     INT            NOT NULL COMMENT "shop_session.ID which used this cart",
 `ID_Order`    INT        DEFAULT NULL COMMENT "core_orders.ID of order into which cart was transferred",
 `ID_Cust`     INT        DEFAULT NULL COMMENT "core_custs.ID of customer for this order",
 `ShipZone`    VARCHAR(3) DEFAULT NULL COMMENT "shipping cost zone",
  PRIMARY KEY(`ID`)
) ENGINE = MYISAM;</mysql>

<section end=sql />