首页 > 代码库 > How to change a product dropdown attribute to a multiselect in Magento
How to change a product dropdown attribute to a multiselect in Magento
First, update the attribute input type to multiselect:
UPDATE eav_attribute SETentity_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 = NULLWHERE 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, valueFROM catalog_product_entity_intWHERE 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_intWHERE entity_type_id = 4 and attribute_id = YOUR_ATTRIBUTE_ID_HERE;
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。