《Magento添加自定义分类属性.doc》由会员分享,可在线阅读,更多相关《Magento添加自定义分类属性.doc(3页珍藏版)》请在三一文库上搜索。
1、通过数据库操作给分类添加属性,以短描述 为例。首先进入数据库,(这边我使用的是管理工具phpMyAdmin )首先查看表 eav_entity_type ,确认分类的 type_id不过通常 安装完 magento时 默认都是 3,基本可以忽略。进入表 eav_attribute ,插入欲添加的属性INSERT INTO eav_attribute( entity_type_id ,attribute_code ,backend_type ,frontend_input ,frontend_labelVALUES ('3', 'short_description'
2、;, 'text', 'textarea', 'Short Description'(以上语句只保留了关键字段,可以自行在数据库中查看详细设置,建议参考 默认的分类 描述的 属性设置)记录下新插入的属性生成的id ,这边的 id 为 121进入表 eav_entity_attribute 进行新属性的基本设置INSERT INTO eav_entity_attribute(entity_type_id ,attribute_set_id ,attribute_group_id ,attribute_id ,sort_orderVALUES ( &
3、#39;3', '3', '3', '121', '4'(以上语句略有删减,可以自行在数据库中查看详细设置,建议参考描述 的属性设置)默认的 分类进入表 catalog_eav_attribute,设置属性基本控制选项使之生效INSERT INTO catalog_eav_attribute(attribute_id ,is_visible ,is_searchable ,is_used_for_price_rules ,is_configurable ,position ,is_wysiwyg_enabledVALUES
4、 ('121','1', '1', '1', '1', '1', '1'(以上语句只保留了关键设置,可以自行在数据库中查看详细设置,建议参考 默认的 分类描述 的属性设置)到这边就基本完成了,清理缓存 进入后台看看效果吧数据调用方法 最终目的使用方法 getData('attribute_code'获取数据修改 catalog/category/view.phtml 添加以下代码进行测试getData('short_description' ?>