Home > Backend Development > PHP Tutorial > javascript - How to design product SKU table in PHP

javascript - How to design product SKU table in PHP

WBOY
Release: 2016-10-18 08:56:05
Original
2123 people have browsed it

Now there are four pieces of clothing, such as pants, jacket, underwear and socks

Then each product has different colors
For example, pants are available in black, blue and white

<code>外套有  白色 棕色  红色 
内衣有 黑色 白色  粉红色
袜子有 花色 藏青色 
</code>
Copy after login
Copy after login

Then each product is divided into men and women
The size is male X XL XXL

For women, size s (one size smaller than X) X XL

We also need inventory with different attributes for each product.
How to design such a table? Please give me some advice and design a database

Reply content:

Now there are four pieces of clothing, such as pants, jacket, underwear and socks

Then each product has different colors
For example, pants are available in black, blue and white

<code>外套有  白色 棕色  红色 
内衣有 黑色 白色  粉红色
袜子有 花色 藏青色 
</code>
Copy after login
Copy after login

Then each product is divided into men and women
The size is male X XL XXL

For women, size s (one size smaller than X) X XL

We also need inventory with different attributes for each product.
How to design such a table? Please give me some advice and design a database

Hope this article can help you, http://www.cnblogs.com/mmmjia...

The attributes are color and size

<code>颜色表
颜色id  颜色值

尺码表
尺码id  尺码

库存表
产品id  颜色id  尺码id  库存  价格</code>
Copy after login

Attributes are not fixed

<code>属性分类表
分类id  分类名

属性表
属性id  分类id  属性名

库存表
产品id  属性id(多个逗号隔开)  库存  价格</code>
Copy after login

Entity-Attribute-Value Model (EAV model)

First of all, there are two tables, namely the product table + product attribute table
The product table and the attribute table have a one-to-many relationship
So the product table saves some fixed attributes such as product name, total inventory, remaining inventory, etc. It depends on the specific situation, such as yours The pants, jackets, etc.
The attribute table saves the inventory under the current attributes of the color, size, etc.
I wonder if you have any ideas?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template