且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

mysql***的方式来管理产品大小

更新时间:2022-12-31 08:27:29

似乎你正在将'服装尺寸','重量'和'长度'变成一个'尺寸'属性。

It seems like you're forcing 'clothing size', 'weight' and 'length' into one 'size' attribute.

这些表格:

  product (product_id, name)
    "Nike t-shirt"

  attribute_group (attribute_group_id, name)
    "Shirt size", "Weight", "Length", etc.

  attribute_value (attribute_value_id, attribute_group_id, name)
    "Shirt size" would have rows for "Small", "Large", etc.

  product_attribute (product_id, attribute_value)
     "Nike t-shirt" is "Large"

向attribute_value中添加显示顺序(因此Small可以在Large之前显示)。

Add a "display order" to attribute_value, too (so "Small" can be displayed before "Large").

为你的其他属性也这样做。

Do this for your other attributes, too.

我为一个生产站点做了这个,我认为它工作得很好。

I've done this for a production site, and I think it worked well.

祝你好运。