简体   繁体   English

每个类别的产品属性

[英]Product attributes per category

I have a category table with category id, name and parent. 我有一个带有类别ID,名称和父类别的类别表。 I have a products table with a link to the category table named cat_id . 我有一个带链接到名为cat_id的类别表的产品表。

Now I have diffrent kind of products and not every product has the same kind of attributes like colour or pieces. 现在,我有不同种类的产品,并不是每个产品都具有相同的属性,例如颜色或碎片。 So my problem is: How to setup that I can have different attributes per category? 所以我的问题是:如何设置每个类别可以具有不同的属性?

I am stuck at how I can best link this. 我一直在坚持如何最好地链接到此。 Now I have a column in the products table with all the attributes, but also the ones that are not used per category. 现在,我在products表中有一列,其中包含所有属性,但还有每个类别未使用的属性。

Make an attribute category table: 制作一个属性类别表:

attcat_id attcat_name attcat_id attcat_name

Make an attribute table: 制作一个属性表:

att_id attcat_id (foreign key) att_name att_id attcat_id (外键) att_name

This way these two will be linked 这样这两个将被链接

Now in category table associate each category with attribute category 现在在类别表中将每个类别与属性类别相关联

cat_id cat_name attcat_id (foreign key) cat_id cat_name attcat_id (外键)

So idea is to group attributes as per attribute category and link attribute category to Product Category. 因此,想法是按照属性类别对属性进行分组,然后将属性类别链接到“产品类别”。 For example, an attribute category mobile will have attributes as price screensize camera flashlight . 例如,属性类别mobile将具有属性,如price screensize camera flashlight

Now link mobile ie attribute category to your product category Mobiles . 现在将mobile即属性类别)链接到您的产品类别“ Mobiles

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 根据类别为每个产品向 WooCommerce 添加费用 - Add a fee to WooCommerce per product, based on category 每个产品类别的总价格 - Woocommerce - Total price value per product category - Woocommerce 如何在opencart中按类别向产品添加属性 - How to add attributes to product by category in opencart 购物车中每个产品类别只允许一个产品 - Allow only one product per product category in cart 如何根据产品类别在woocommerce产品页面上添加链接? - How to add a link on woocommerce product page as per the product category? 在特定的 Woocommerce 产品类别档案页面上显示产品属性 - Display product attributes on specific Woocommerce product category archives page 显示特定产品类别的术语或产品属性(woocommerce) - Display the terms or product attributes for a specific product category(woocommerce) 在自定义主页和产品类别档案中显示 WooCommerce 产品属性 - Show WooCommerce product attributes in custom home and product category archives 根据类别,为每种产品向WooCommerce添加百分比费用 - Add a percent fee to WooCommerce per product, based on category 将 Woocommerce 购买重定向到每个产品类别的唯一页面 - Redirecting Woocommerce purchase to a unique page per product category
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM