Difference between revisions of "Spreadsheet to sql asi sale"
m |
|||
Line 28: | Line 28: | ||
+ | Here are two key tables needed to hold categories which OC users define: | ||
+ | |||
+ | <pre> | ||
+ | oc_test_cart> describe oc_category; | ||
+ | ERROR 2006 (HY000): MySQL server has gone away | ||
+ | No connection. Trying to reconnect... | ||
+ | Connection id: 3451080 | ||
+ | Current database: oc_test_cart | ||
+ | |||
+ | +---------------+--------------+------+-----+---------+----------------+ | ||
+ | | Field | Type | Null | Key | Default | Extra | | ||
+ | +---------------+--------------+------+-----+---------+----------------+ | ||
+ | | category_id | int(11) | NO | PRI | NULL | auto_increment | | ||
+ | | image | varchar(255) | YES | | NULL | | | ||
+ | | parent_id | int(11) | NO | MUL | 0 | | | ||
+ | | top | tinyint(1) | NO | | NULL | | | ||
+ | | column | int(3) | NO | | NULL | | | ||
+ | | sort_order | int(3) | NO | | 0 | | | ||
+ | | status | tinyint(1) | NO | | NULL | | | ||
+ | | date_added | datetime | NO | | NULL | | | ||
+ | | date_modified | datetime | NO | | NULL | | | ||
+ | +---------------+--------------+------+-----+---------+----------------+ | ||
+ | 9 rows in set (0.01 sec) | ||
+ | |||
+ | oc_test_cart> describe oc_category_description; | ||
+ | +------------------+--------------+------+-----+---------+-------+ | ||
+ | | Field | Type | Null | Key | Default | Extra | | ||
+ | +------------------+--------------+------+-----+---------+-------+ | ||
+ | | category_id | int(11) | NO | PRI | NULL | | | ||
+ | | language_id | int(11) | NO | PRI | NULL | | | ||
+ | | name | varchar(255) | NO | MUL | NULL | | | ||
+ | | description | text | NO | | NULL | | | ||
+ | | meta_title | varchar(255) | NO | | NULL | | | ||
+ | | meta_description | varchar(255) | NO | | NULL | | | ||
+ | | meta_keyword | varchar(255) | NO | | NULL | | | ||
+ | +------------------+--------------+------+-----+---------+-------+ | ||
+ | 7 rows in set (0.00 sec) | ||
+ | </pre> | ||
<!-- comment --> | <!-- comment --> |
Revision as of 02:20, 21 July 2018
2018-07-20 Friday
Notes on terms of this article:
- spreadsheet columns are analogous to relational database fields,
- product or item attributes map to (get stored in) database fields,
ASI plant sale 2018 has plants listed in a spreadsheet with the following fields (columns):
price, name, description, image_filename, quantity
These item attributes map to Opencart table columns (fields) in the table oc_product and oc_product_description:
price --> oc_product.price name --> oc_product_description.name description --> oc_product_description.description image_filename --> oc_product.image quantity --> oc_product.quantity
So the info we've been given maps to two OC tables. There are two more tables we need update resepctively, to make given plant items appear in a given store and to make items searchable by one or more product (item) categories. These tables are oc_product_to_store and oc_product_to_category. These tables can be updated with the insertion of records which refer to the product ids of the items newly added to OC's table oc_products.
Here are two key tables needed to hold categories which OC users define:
oc_test_cart> describe oc_category; ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 3451080 Current database: oc_test_cart +---------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+--------------+------+-----+---------+----------------+ | category_id | int(11) | NO | PRI | NULL | auto_increment | | image | varchar(255) | YES | | NULL | | | parent_id | int(11) | NO | MUL | 0 | | | top | tinyint(1) | NO | | NULL | | | column | int(3) | NO | | NULL | | | sort_order | int(3) | NO | | 0 | | | status | tinyint(1) | NO | | NULL | | | date_added | datetime | NO | | NULL | | | date_modified | datetime | NO | | NULL | | +---------------+--------------+------+-----+---------+----------------+ 9 rows in set (0.01 sec) oc_test_cart> describe oc_category_description; +------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+--------------+------+-----+---------+-------+ | category_id | int(11) | NO | PRI | NULL | | | language_id | int(11) | NO | PRI | NULL | | | name | varchar(255) | NO | MUL | NULL | | | description | text | NO | | NULL | | | meta_title | varchar(255) | NO | | NULL | | | meta_description | varchar(255) | NO | | NULL | | | meta_keyword | varchar(255) | NO | | NULL | | +------------------+--------------+------+-----+---------+-------+ 7 rows in set (0.00 sec)