【发布时间】:2016-09-22 06:44:22
【问题描述】:
我想创建三个不同的类别属性,一个自定义输入文本,一个所见即所得的文本区域,以及另一个类别图像上传。
我首先从自定义输入文本开始,因为我认为这是最简单的,但它不起作用。我检查了 core_resource 以查看版本是否已注册,但未注册,并且该属性不存在于类别中。
这是我的代码
app/etc/modules/Rnd_Customheader.xml
<?xml version="1.0"?>
<config>
<modules>
<Rnd_Customheader>
<active>true</active>
<codePool>community</codePool>
</Rnd_Customheader>
</modules>
</config>
app/code/local/Rnd/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>
app/code/local/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/
是否有遗漏或我遗漏的步骤?
如果我是对的,这个扩展程序会在页面刷新后运行?
【问题讨论】:
-
@rodge 可以请提及安装脚本名称吗?
-
这是安装脚本mysql4-install-0.1.0.php的名称