All pastes #194163 Raw Edit

Stuff

public text v1 · immutable
·published 2006-10-07 16:29 UTC
rendered paste body
Database.

Every ID should be non-zero, zero is used for default values

Table Name: Company_"Company Name"
Table Description: A table for each company represented
Table colss: ItemID, Link, Price
	col ItemID: A unique identifier for an item. Must be unique and non-zero
		0 ID Means we only have an adress to site homepage, or that adress is /a
	col Link: The link associated with the item
	col Price: The price of the item

Table Name: Categories
Table Description: Hold all categories and theyre parent directory
Table cols: ID, Name, Parent
	col ID: An unique identifier for each category
	col Name: The string name representing the category
	col Parent: The unique ID of a parent category, 0 if there is no parents

Table Name: Items
Table Description: Hold information about all available items
Table cols: ItemID, CategoryID, CompanyIDArray
	col ItemID: Unique Item Identifier
	col CategoryID: The ID of the category this item is located in
	col CompanyIDArray: A serialized array of company ID's from wich this product is available

Table Name: UIDs
Table description: Hold all used UIDs to make sure of the uniqueness (usefull if we remove etc..)
Table cols: ItemID, CompanyID, CategoryID

Deal with the Tables:

Edit:
Add Company ( string Company Name ) Creates a new company table
	new Company (table Company_ + "Company Name" )
Add Category ( Dropdown Sub, string Category ) Create a new company, Unique ID is assigned automatically
	new Category ( Automatically generate the UID, Category_ + "Category", int( Sub ) )
Add Item ( string Item Name, dropdown Category ) Create a new item in the desired category
	new Item( Automatically Generate UID, int (Category), 0 for no-company in item, default)
Add Item_Company ( string ItemName OR TreeView choose by category, dropdown Company )
	Retrieve existing Company Array, if not 0, append Company ID of the dropdown to the ItemID entry in Item table

Read:
GetItemsByCategory ( Category ID )
	return an array of Item ID.
	foreach ( Item in Items ) If (Item.CategoryID == this.CategoryID) { Resize + Append the ItemID to array returned}
	then deal with ItemID. Get Companies by retrieving ItemID.CompanyID's.
	Get Price by using the retrieved Company ID in Company table
	retrieve the lowest price, show it on product list page

maby a func like: GetCompany's ( GetItemsByCategory[ x ] )
	eg: 	array rItems = GetItemsByCategory ( this.Category )
		foreach ( item in rItems ) { array currItemAvailability = GetCompany's ( rItems[x] )  }
		display on page now :D 


categories

    * Ordinateurs + Périphériques et Composants + Logiciels (Ordinateurs)
	/TODO Ne pas prendre en consideration les categories ci-dessous
    * Photo + Développement photo
    * Téléviseur et vidéo
    * Audio
    * Radio par Satellite
    * Audio / Video pour l’auto
    * Lecteurs MP3 / Électroniques portatif
    * Téléphones et assistants personnels
    * Électroménagers
    * Accessoires
    * Cartes-cadeaux

    * Divertissement

    * Films DVD
    * Musique
    * Jeux video et Jouets
      Téléchargements de musique