Sunday 25 May 2014

How to create new category attribute in magento


Write below in your sql setup file in magento module
example file : mysql4-upgrade-0.2.8-0.2.8.1.php

$installer = $this;
/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */

$installer->startSetup();
// add category attributes for sub categories of coourse categories
$installer->addAttribute('catalog_category', 'new_category_attribute', array(
                        'group'    => 'General Information',
'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'New attribute label here',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'eav/entity_attribute_source_boolean',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ));
$installer->endSetup();

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home