Magento里面的系统属性只要新建完成属性展示类型就无法变更了,这个设定很让人无语。
我们肯定是不希望删了重建的。特别是数据库里面已经有产品了,属性只要被产品用过肯定是删不掉的。最近我就碰到这个问题了。
解法:执行以下mysql脚本:
UPDATE eav_attribute SET
entity_type_id = 4,
attribute_model = NULL,
backend_model = 'eav/entity_attribute_backend_array',
backend_type = 'text',
backend_table = NULL,
frontend_model = NULL,
frontend_input = 'multiselect',
frontend_class = NULL,
source_model = NULL
WHERE attribute_id = YOUR_ATTRIBUTE_ID;
-- Next, copy the attribute values from the old table to the new one
INSERT INTO catalog_product_entity_text ( 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;
-- 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;
过程中遇到的其他坑:我新建Multiple Select类型的属性保存时遇到了Input type “Multiple Select” not found in the input types list的提示。
解法:mySql执行:SELECT * FROM core_config_data WHERE path="general"; 删掉搜到的结果。刷新即可。