码迷,mamicode.com
首页 > 其他好文 > 详细

How to change a product dropdown attribute to a multiselect in Magento

时间:2014-06-25 14:13:24      阅读:285      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   ext   color   

First, update the attribute input type to multiselect:

UPDATE eav_attribute SET
entity_type_id = 4,
attribute_model = NULL,
backend_model = eav/entity_attribute_backend_array,
backend_type = varchar,
backend_table = NULL,
frontend_model = NULL,
frontend_input = multiselect,
frontend_class = NULL
WHERE attribute_id = YOUR_ATTRIBUTE_ID_HERE;

 

 Next, copy the attribute values from the old table to the new:

INSERT INTO catalog_product_entity_varchar ( entity_type_id, attribute_id, store_id, entity_id, value)
SELECT entity_type_id, attribute_id, store_id, entity_id, value
FROM catalog_product_entity_int
WHERE attribute_id = YOUR_ATTRIBUTE_ID_HERE;

Finally,  remove the old values or they will conflict with the new setup (the old values will load, but Magento will save new values to the varchar table):

DELETE FROM catalog_product_entity_int
WHERE entity_type_id = 4 and attribute_id = YOUR_ATTRIBUTE_ID_HERE;

 

How to change a product dropdown attribute to a multiselect in Magento,布布扣,bubuko.com

How to change a product dropdown attribute to a multiselect in Magento

标签:style   class   blog   code   ext   color   

原文地址:http://www.cnblogs.com/fengliang/p/3806674.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!