2

I'm creating an attribute like this

$installer = new Mage_Eav_Model_Entity_Setup('core_setup');

$installer->startSetup();
$entityTypeId = 'catalog_product';
$installer->addAttribute($entityTypeId, 'ask_a_pharmacist', array(
    'group'             => 'SEO',
    'label'             => 'Ask A Pharmacist',
    'note'              => "Add lots of rows",
    'type'              => 'text',
    'input'             => 'textarea',
    'input_renderer'     => 'categoryatribute/adminhtml_helper_jcf',
    'default'           => '{"controls":{"locked":true,"maxrows":-1,"fields":["question","answer","author","date"]},"data":[]}',
    'visible'           => true,
    'required'          => false,
    'searchable'        => false,
    'filterable'        => false,
    'comparable'        => false,
    'user_defined'      => true,
    'visible_on_front'  => true,
    'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,));
$installer->endSetup();

And the attribute is created, but the catalog_eav_attribute value remains null for this attribute. If I manually update frontend_input_renderer in the database to categoryatribute/adminhtml then it works fine, but not until then.

I need it working without this extra step but can't figure out what I need to change.

Here's my config.xml

<?xml version="1.0"?>
<config>
<adminhtml>
    <layout>
         <updates>
              <categoryatribute>
                    <file>innoxcategoryatribute.xml</file>
              </categoryatribute>
         </updates>
    </layout>
</adminhtml>
<modules>
    <Innox_CategoryAtribute>
        <version>0.0.8</version>
    </Innox_CategoryAtribute>
</modules>
 <global>
    <helpers>
        <categoryatribute>
            <class>Innox_CategoryAtribute_Helper</class>
        </categoryatribute>
    </helpers>   
    <models>
        <categoryatribute>
            <class>Innox_CategoryAtribute_Model</class>
        </categoryatribute>
    </models>
    <blocks>
        <categoryatribute>
            <class>Innox_CategoryAtribute_Block</class>
        </categoryatribute>
    </blocks>    
    <resources>
        <add_category_attribute_setup>
            <setup>
                <module>Innox_CategoryAtribute</module>
                <class>Innox_CategoryAtribute_Model_Resource_Setup</class>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </add_category_attribute_setup>
        <add_category_attribute_write>
            <connection>
                <use>core_write</use>
            </connection>
        </add_category_attribute_write>
        <add_category_attribute_read>
            <connection>
                <use>core_read</use>
            </connection>
        </add_category_attribute_read>
    </resources>
</global>

1

Okay, solved this.

My /Model/Resource/Setup.php

class Innox_CategoryAtribute_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup

to

class Innox_CategoryAtribute_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup 

And in my SQL file,

$installer = new Mage_Eav_Model_Entity_Setup('core_setup');

to

$installer = $this;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.