Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过安装脚本在Magento 1.9.2中创建类别属性_Php_Mysql_Magento - Fatal编程技术网

Php 通过安装脚本在Magento 1.9.2中创建类别属性

Php 通过安装脚本在Magento 1.9.2中创建类别属性,php,mysql,magento,Php,Mysql,Magento,我想创建三个不同的类别属性,一个自定义输入文本,一个所见即所得文本区域,和另一个类别图像上传 我首先开始自定义输入文本,因为我认为这是最简单的,但它不起作用。我检查了core_资源,查看该版本是否已注册,但未注册,并且该属性在类别中不存在 这是我的密码 app/etc/modules/Rnd_Customheader.xml <?xml version="1.0"?> <config> <modules> <Rnd_Customheader>

我想创建三个不同的类别属性,一个自定义输入文本,一个所见即所得文本区域,和另一个类别图像上传

我首先开始自定义输入文本,因为我认为这是最简单的,但它不起作用。我检查了core_资源,查看该版本是否已注册,但未注册,并且该属性在类别中不存在

这是我的密码

app/etc/modules/Rnd_Customheader.xml

<?xml version="1.0"?>
<config>
<modules>
    <Rnd_Customheader>
        <active>true</active>
        <codePool>community</codePool>
    </Rnd_Customheader>
</modules>
</config>

是否有遗漏或我遗漏的步骤


如果我是对的,该扩展将在页面刷新后运行?

尝试以下更改:

    <?xml version="1.0"?>
    <config>
      <modules>
         <Rnd_Customheader>
             <version>0.1.0</version>
         </Rnd_Customheader>
      </modules>
      <global>
        <resources>
    <customheader_setup>
      <setup>
           <module>Rnd_Customheader</module>
           <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
      </setup>
      <connection>
        <use>default_setup</use>
      </connection>
  </customheader_setup>
</resources>  

0.1.0
Rnd_自定义标题
Mage\u目录\u模型\u资源\u Eav\u Mysql4\u设置
默认设置

将Rnd_Customheader_设置更改为Customheader_设置,并将目录重命名为app/code/local/Rnd/Customheader/sql/Customheader_设置

<?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();
?>

另外,请确保安装脚本名称应为mysql4-install-0.1.0.php,此处0.1.0是您的模块版本。

尝试以下更改:

    <?xml version="1.0"?>
    <config>
      <modules>
         <Rnd_Customheader>
             <version>0.1.0</version>
         </Rnd_Customheader>
      </modules>
      <global>
        <resources>
    <customheader_setup>
      <setup>
           <module>Rnd_Customheader</module>
           <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
      </setup>
      <connection>
        <use>default_setup</use>
      </connection>
  </customheader_setup>
</resources>  

0.1.0
Rnd_自定义标题
Mage\u目录\u模型\u资源\u Eav\u Mysql4\u设置
默认设置

将Rnd_Customheader_设置更改为Customheader_设置,并将目录重命名为app/code/local/Rnd/Customheader/sql/Customheader_设置

<?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();
?>

另外,请确保安装脚本名称应为mysql4-install-0.1.0.php,这里0.1.0是您的模块版本。

@rodge能否提及安装脚本名称?这是安装脚本mysql4-install-0.1.0的名称。php@rodge请提及安装脚本名称?这是安装脚本mysql4-install-0.1.0.php的名称