Difference between revisions of "VbzCart/tables/shop cart line"
Jump to navigation
Jump to search
m (VbzCart/tables/shop cart lines moved to VbzCart/tables/shop cart line: changing table names to singular) |
m (fixed markup tags) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==About== | ==About== | ||
− | * '''Purpose''': individual items in a shopping cart | + | * '''Purpose''': individual items in a shopping cart |
+ | * '''Parent''': {{vbzcart|table|shop_cart}} | ||
+ | * '''History''': | ||
+ | ** '''2009-06-16''' Changing table name to singular | ||
+ | ** '''2009-07-12''' | ||
+ | *** Tentatively removed all "item presentation" fields -- they belong in {{vbzcart|table|ord_lines}} | ||
+ | *** Added '''Seq''' field | ||
+ | ** '''2009-09-10''' No reason for WhenEdited to be NOT NULL; it should be NULL if the cart item is never changed after being added. The only change would be quantity. Changes to cart lines should be in the cart log anyway, so this field is probably an unused frill. | ||
+ | * '''Fields''': | ||
+ | ** '''Seq''': unique incremental sequence number for each line in the cart, for identifying the record in contexts where it is exposed to outside manipulation. This way, URL/form hacking can never affect another cart's lines. | ||
==SQL== | ==SQL== | ||
− | < | + | <source lang=mysql>DROP TABLE IF EXISTS `shop_cart_line`; |
− | CREATE TABLE ` | + | CREATE TABLE `shop_cart_line` ( |
− | `ID` INT NOT NULL | + | `ID` INT NOT NULL AUTO_INCREMENT, |
− | `ID_Cart` | + | `Seq` INT NOT NULL COMMENT "sequence # within cart", |
− | `ID_Item` | + | `ID_Cart` INT NOT NULL COMMENT "shop_cart.ID", |
− | `Qty` | + | `ID_Item` INT NOT NULL COMMENT "cat_items.ID", |
− | `WhenAdded` | + | `Qty` INT NOT NULL COMMENT "quantity ordered; 0 = removed from order", |
− | `WhenEdited` DATETIME | + | `WhenAdded` DATETIME NOT NULL COMMENT "when this item was first added to the order", |
− | + | `WhenEdited` DATETIME DEFAULT NULL COMMENT "when the quantity for this item was last changed", | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
PRIMARY KEY(`ID`) | PRIMARY KEY(`ID`) | ||
− | ) ENGINE = | + | ) ENGINE = InnoDB;</source> |
− | < | + | ==Removed== |
+ | I'm inclined to think that these don't belong here, but rather in {{vbzcart|table|ord_lines}}: | ||
+ | <source lang=mysql> | ||
+ | /* The remaining fields preserve a record of how the item was presented to the customer, and should be used | ||
+ | at shipping time -- overriding any possible changes to the item's catalog record. */ | ||
+ | |||
+ | `PriceItem` DECIMAL(9,2) NOT NULL COMMENT "price of item quoted at order time", | ||
+ | `PriceShItm` DECIMAL(9,2) NOT NULL COMMENT "per-item shipping quoted for this item at order time", | ||
+ | `PriceShPkg` DECIMAL(9,2) NOT NULL COMMENT "per-package shipping quoted for this item at order time", | ||
+ | `CatNum` VARCHAR(63) COMMENT "cat_items.CatNum of item as sold", | ||
+ | `ID_Title` INT NOT NULL COMMENT "cat_titles.ID", | ||
+ | `DescText` VARCHAR(255) NOT NULL COMMENT "plain-text description of item being ordered (e.g. for emails)", | ||
+ | `DescHtml` VARCHAR(255) NOT NULL COMMENT "HTML description of item being ordered, for web-page display", | ||
+ | </source> |
Latest revision as of 21:20, 7 August 2019
About
- Purpose: individual items in a shopping cart
- Parent: shop_cart
- History:
- 2009-06-16 Changing table name to singular
- 2009-07-12
- Tentatively removed all "item presentation" fields -- they belong in ord_lines
- Added Seq field
- 2009-09-10 No reason for WhenEdited to be NOT NULL; it should be NULL if the cart item is never changed after being added. The only change would be quantity. Changes to cart lines should be in the cart log anyway, so this field is probably an unused frill.
- Fields:
- Seq: unique incremental sequence number for each line in the cart, for identifying the record in contexts where it is exposed to outside manipulation. This way, URL/form hacking can never affect another cart's lines.
SQL
DROP TABLE IF EXISTS `shop_cart_line`;
CREATE TABLE `shop_cart_line` (
`ID` INT NOT NULL AUTO_INCREMENT,
`Seq` INT NOT NULL COMMENT "sequence # within cart",
`ID_Cart` INT NOT NULL COMMENT "shop_cart.ID",
`ID_Item` INT NOT NULL COMMENT "cat_items.ID",
`Qty` INT NOT NULL COMMENT "quantity ordered; 0 = removed from order",
`WhenAdded` DATETIME NOT NULL COMMENT "when this item was first added to the order",
`WhenEdited` DATETIME DEFAULT NULL COMMENT "when the quantity for this item was last changed",
PRIMARY KEY(`ID`)
) ENGINE = InnoDB;
Removed
I'm inclined to think that these don't belong here, but rather in ord_lines:
/* The remaining fields preserve a record of how the item was presented to the customer, and should be used
at shipping time -- overriding any possible changes to the item's catalog record. */
`PriceItem` DECIMAL(9,2) NOT NULL COMMENT "price of item quoted at order time",
`PriceShItm` DECIMAL(9,2) NOT NULL COMMENT "per-item shipping quoted for this item at order time",
`PriceShPkg` DECIMAL(9,2) NOT NULL COMMENT "per-package shipping quoted for this item at order time",
`CatNum` VARCHAR(63) COMMENT "cat_items.CatNum of item as sold",
`ID_Title` INT NOT NULL COMMENT "cat_titles.ID",
`DescText` VARCHAR(255) NOT NULL COMMENT "plain-text description of item being ordered (e.g. for emails)",
`DescHtml` VARCHAR(255) NOT NULL COMMENT "HTML description of item being ordered, for web-page display",