2019-06-12

Magento商品属性设置及存储方式

所有商品属性都以attribute形式设定,如图片,size等

Attribute Set与attribute对应关系:

一个attribute set 对应多个attribute,可以设定该attribute的位置,如General, Meat Information等

使用自已创建的商品属性:

将需要的attribute和新创建的attribute set关联,在创建商品时选用指定新创建的attribute set即可

attribute可以设定为多种类型,如text,textarea,date,boolean,multiselect,dropdown(select)等

后台表:

Attriubte 设定,注意attribute_type_id,类型可在eav_entity_type表查到,backend type为数据库中存储类形,如varchar等,对应到catalog_product_entity_类型(以商品为例)表中(Entity)

select * from eav_attribute;

Attribute 选项(Attribute)

select * from eav_attribute_option;

Attribute 选项值(Value)

select * from eav_attribute_option_value;

Attribute Set设定

select * from eav_attribute_set;

Attribute set 与attribute关联关系

select * from eav_entity_attribute;

 

商品属性的存储是一个典型的E(entity)-A(attribute)-V(value)设计,遵循第三范式

Magento 1.x后台处维护的attribute/attribute set都是针对商品的,其它模块(如customer)需要自行从数据库配置自义定属性,attribute_type_id需使用eav_entity_type中已定义的类型ID

没有评论:

发表评论