我想创建三个不同的分类属性,一个自定义输入文本,一个wysiwyg文本区域和另一个分类图像上传。通过安装脚本在Magento 1.9.2中创建分类属性
我首先开始使用自定义输入文本,因为我觉得最简单但不起作用。我检查了core_resource,看看版本是否已经注册,但是没有,属性也没有出现在类别上。
这是我的代码
应用程序的/ etc /模块/ Rnd_Customheader.xml
<?xml version="1.0"?>
<config>
<modules>
<Rnd_Customheader>
<active>true</active>
<codePool>community</codePool>
</Rnd_Customheader>
</modules>
</config>
应用程序/代码/本地/赛第一轮/ Customheader /等
<?xml version="1.0"?>
<config>
<modules>
<Rnd_Customheader>
<version>0.1.0</version>
</Rnd_Customheader>
</modules>
<global>
<resources>
<Rnd_Customheader_setup>
<setup>
<module>Rnd_Customheader</module>
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
<connection>
<use>default_setup</use>
</connection>
</Rnd_Customheader_setup>
</resources>
</global>
</config>
应用程序/代码/本地/ Rnd/Customheader/sql/rnd_customheader_setup
<?php
$installer = $this;
$installer->startSetup();
$attribute = array(
'type' => 'text',
'label' => 'Custom Header (If you want different page header)',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'custom_header', $attribute);
$installer->endSetup();
?>
这是我引用
https://magento.stackexchange.com/questions/94833/add-custom-attribute-for-category
http://gauss-development.com/blog/tutorials/adding-custom-category-attributes-magento/
是否有遗漏或步骤我错过了什么?
如果我是对的,这个扩展将在页面刷新后运行?
http://stackoverflow.com/questions/33447763/creating-new-attribute-field-in-catalog-manage-categories-display-settings/33472607#33472607 –
@rodge可以请提一下安装脚本名称吗? – ROBIN
这是安装脚本的名称mysql4-install-0.1.0.php – rodge