Update magento attribute

Update magento attribute and set source type as category

<?php
$updater = $this;

$updater->startSetup();

$updater->addAttribute('catalog_product', 'category_type', array(
    'group'             => 'General',
    'label'             => 'Category Label',
    'note'              => '',
    'type'              => 'int',    //backend_type
    'input'             => 'select',    //frontend_input
    'frontend_class'    => '',
    'source'        => 'categoryattr/attribute_source_type',
    'backend'           => '',
    'frontend'          => '',
    'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
    'required'          => true,
    'visible_on_front'  => true,
    'apply_to'          => 'simple,configurable',
    'is_configurable'   => false,
    'used_in_product_listing'    => true,
    'sort_order'        => 5,
));

$updater->endSetup();

Share this Tutorial