Magento1.9x 修改属性类型

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"; 删掉搜到的结果。刷新即可。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值