我正在從事電子商務項目,在數據庫上創(chuàng)建表時我?guī)缀鯖]有困惑?,F在我正在電子商務中創(chuàng)建多種產品,例如 flikart。對于服裝,我需要不同的規(guī)格(顏色,尺寸),對于移動設備,我需要不同的規(guī)格(內存,存儲),并且每種產品都有不同的規(guī)格。如果我在前端查看頁面(如果我選擇移動設備意味著它應該只顯示基于手機的規(guī)范)。如何為此目的創(chuàng)建表。
1 回答

眼眸繁星
TA貢獻1873條經驗 獲得超9個贊
您需要研究EAV實體屬性值的概念。
你的桌子可能是:
categories (id, title, parent_id, status) ; here parent_id is to handle child categories
products (id, title, description, price, status, quantity)
attributes (id, title, status) ; attribute can have colors, sizes
attributevalues (id, attribute_id, value, status) ; it contains colors's attribute_id and values can be green, red, yellow etc
attributes_products (id, product_id, attribute_id, attributevalue_id, price, sign) ; it will be attaching attribute title with options to a product also how much price add or minus in case of products attributes
如有疑問,請多問
- 1 回答
- 0 關注
- 113 瀏覽
添加回答
舉報
0/150
提交
取消