Categories
Programming

Magento – Adding a Custom Category Attribute (EAV)

[php]
$setup = new Mage_Eav_Model_Entity_Setup(‘core_setup’);

$setup->startSetup();

$setup->addAttribute(Mage_Catalog_Model_Category::ENTITY, ‘show_sale_icon’,
array(
‘backend’ => ”,
‘default’ => 0,
‘global’ => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
‘group’ => ‘General’,
‘input’ => ‘select’,
‘label’ => ‘Show Category Sale Icon’,
‘position’ => 100,
‘required’ => false,
‘source’ => ‘eav/entity_attribute_source_boolean’,
‘type’ => ‘int’,
‘user_defined’ => true,
‘visible’ => true,
‘visible_on_front’ => true,
)
);

$setup->endSetup();
[/php]

[php]
$setup = new Mage_Eav_Model_Entity_Setup(‘core_setup’);

$setup->startSetup();

$setup->addAttribute(Mage_Catalog_Model_Category::ENTITY, ‘additional_description’,
array(
‘backend’ => ”,
‘global’ => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
‘group’ => ‘General’,
‘input’ => ‘textarea’,
‘is_html_allowed_on_front’ => true,
‘is_wysiwyg_enabled’ => true,
‘label’ => ‘Additional Description’,
‘position’ => 100,
‘required’ => false,
‘type’ => ‘text’,
‘user_defined’ => true,
‘visible’ => true,
‘visible_on_front’ => true,
)
);

$setup->endSetup();
[/php]

One reply on “Magento – Adding a Custom Category Attribute (EAV)”

I want to know that in adding select box where is the values of select box and how to set its default value…….

Comments are closed.