Saturday, January 7, 2012

Magento: create category attribute

Create Category attribute magento from code.
<?php
    define('MAGENTO', realpath(dirname(__FILE__)));
  
 require_once MAGENTO . '/app/Mage.php';
    Mage::app();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');

$setup->addAttribute('catalog_category', 'sliderurl',  array(
    'group'    => 'General',
    'type'     => 'varchar',
    'label'    => 'Slider Url',
    'input'    => 'text',
    'global'   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible'           => 1,
    'required'          => 0,
    'user_defined'      => 1,
    'default'           => '#'
));

?>

No comments:

Post a Comment