Onlinesales Help

Help and suggestions for Onlinesales e-commerce software

Monday, May 16, 2005

Upload New Products - CSV - database table design

The key tables for the adding a new product are given below.

In your CSV file you can add most fields (with the exception of IDs which are created automatically) and the admin_insert_csv_file.php page will take care of it.

A minimum amount of data would be:
product_code, product_name, price, gallery_id

If the "gallery_id" field is a numeric the system will add the product added to the gallery, if it is text it will look up the gallery_id, or if required, add a new gallery (always double check the text).

A more complex csv would be:
product_code, product_name, description, item_product_code, price, stock, size_id, colour_id, gallery_id, brand_id, image_use, filename, alt_text

As a shortcut for adding mroe than one image (a thumbnail and a display image) when adding a new product, you may use column headings of tb_filename and filename for each image on one line, thus:
product_code, product_name, description, item_product_code, price, stock, size_id, colour_id, gallery_id, brand_id, tb_filename, filename


product_tbl
+----------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+---------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| product_code | varchar(50) | YES | MUL | NULL | |
| product_name | varchar(255) | YES | | NULL | |
| description | text | YES | | NULL | |
| date_added | datetime | YES | | NULL | |
| product_status | tinyint(3) unsigned | YES | | 1 | |
+----------------+---------------------+------+-----+---------+----------------+

product_details_tbl;
+--------------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+---------------------+------+-----+---------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| product_id | int(10) unsigned | YES | MUL | NULL | |
| item_product_code | char(50) | YES | | NULL | |
| price | decimal(8,2) | YES | | NULL | |
| stock | int(11) | YES | | NULL | |
| size_id | int(10) unsigned | YES | | NULL | |
| colour_id | int(10) unsigned | YES | | NULL | |
| weight | int(10) unsigned | YES | | NULL | |
| height | int(10) unsigned | YES | | NULL | |
| width | int(10) unsigned | YES | | NULL | |
| depth | int(10) unsigned | YES | | NULL | |
| postage_local | decimal(8,2) | YES | | NULL | |
| postage_europe | decimal(8,2) | YES | | NULL | |
| postage_zone1 | decimal(8,2) | YES | | NULL | |
| postage_zone2 | decimal(8,2) | YES | | NULL | |
| next_delivery_date | datetime | YES | | NULL | |
| unit_price | decimal(8,2) | YES | | NULL | |
| sold_by | int(10) unsigned | YES | | NULL | |
| barcode | int(10) unsigned | YES | | NULL | |
| details_status | tinyint(3) unsigned | YES | | 1 | |
+--------------------+---------------------+------+-----+---------+----------------+

image_tbl;
+------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------------+------+-----+---------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| filename | char(255) | YES | | NULL | |
| product_id | int(10) unsigned | YES | | NULL | |
| image_use | tinyint(3) unsigned | YES | | NULL | |
| alt_text | char(255) | YES | | NULL | |
+------------+---------------------+------+-----+---------+----------------+

gallery_tbl;
+----------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+---------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| gallery | varchar(255) | YES | MUL | NULL | |
| gallery_text | text | YES | | NULL | |
| gallery_image | varchar(255) | YES | | NULL | |
| gallery_rows | tinyint(3) unsigned | YES | | 0 | |
| gallery_cols | tinyint(3) unsigned | YES | | 1 | |
| default_text | tinyint(3) unsigned | YES | | 1 | |
| gallery_status | tinyint(3) unsigned | YES | | 1 | |
+----------------+---------------------+------+-----+---------+----------------+

gallery_product_tbl;
+------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| gallery_id | int(10) unsigned | YES | MUL | NULL | |
| product_id | int(10) unsigned | YES | MUL | NULL | |
+------------+------------------+------+-----+---------+----------------+

brands_tbl;
+-------------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+---------------------+------+-----+---------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| brand | varchar(255) | YES | MUL | NULL | |
| brand_description | text | YES | | NULL | |
| brand_image | varchar(255) | YES | | NULL | |
| brand_rows | tinyint(3) unsigned | YES | | 0 | |
| brand_cols | tinyint(3) unsigned | YES | | 1 | |
| brand_status | tinyint(3) unsigned | YES | | 1 | |
+-------------------+---------------------+------+-----+---------+----------------+

0 Comments:

Post a Comment

<< Home