VbzCart/tables/cat depts

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

About

  • Purpose: catalog departments within a supplier. Not all suppliers split things into departments, but they still need one department record with a NULL PageKey.
  • Future: I was hoping that this table could eventually go away, and its functionality be replaced by Topics, but now (2016-03-28) I'm not so sure. It may be too difficult to do lookups in a reasonable amount of time.
    • The thought was that if there are still any suppliers that use departments consistently as part of their catalog numbers, then we'll find a way to handle that using special topic fields.

Fields

  • CatKey: the keystring which gets added to the catalog number for Titles in this Department.
    • Each Title's catalog number is: [Supplier CatKey]-[Department CatKey]-[Title CatKey], unless Department.CatKey is NULL.
    • May be NULL, in which case Department is just being used as a way of grouping Titles, and Title catalog number is [Supplier CatKey]-[Title CatKey].
  • PageKey: the keystring which is used to build the folder for exhibiting this Department. Does not affect catalog number.
    • If NULL, use CatKey.
    • CatKey and PageKey should only both be NULL if there is only one Department for the Supplier. (In that case the Supplier should be able to have zero Departments, but I'm not sure if the code has been tested for this.)

SQL

<mysql> CREATE TABLE `cat_depts` (

  `ID` INT  NOT NULL AUTO_INCREMENT,
  `Name` varchar(64) COMMENT 'name of department as displayed',
  `ID_Supplier` INT DEFAULT NULL COMMENT 'cat_suppliers.ID',
  `isActive` BOOL COMMENT 'items.ID' COMMENT 'department is available for adding titles',
  `Sort` varchar(8) COMMENT 'listing order; default to CatKey',
  `CatKey` varchar(4) COMMENT 'use for building title catalog numbers',
  `PageKey` varchar(4) COMMENT 'use for building URL of Dept page',
  `Descr` varchar(255) COMMENT 'descriptive text for Dept page',
  PRIMARY KEY(`ID`)
)
ENGINE = MYISAM;</mysql>