$attributeUtility = Mage::getModel('core/setup');
$attributeUtility->addAttribute('catalog_category', 'attribute_code',
array(
'sort_order' => '0',
'backend_type' => 'int',
'input' => "boolean",
'label' => 'Custom Attribute Label',
'source_model' => 'eav/entity_attribute_source_boolean',
'required' => '0',
'user_defined' => false,
'default_value' => '0',
'unique' => '0',
'note' => '',
'global' => '1',
'visible' => '1',
'searchable' => '0',
'filterable' => '0',
'comparable' => '0',
'visible_on_front' => '0',
'html_allowed_on_front' => '1',
'used_for_price_rules' => '0',
'filterable_in_search' => '0',
'used_in_product_listing' => '0',
'used_for_sort_by' => '0',
'configurable' => '0',
'apply_to' => 'configurable',
'visible_in_advanced_search' => '0',
'position' => '0',
'wysiwyg_enabled' => '0',
'used_for_promo_rules' => true,
'search_weight' => '1',
)
);
You'll need to keep in mind that your 'source_model' needs to match a data type that makes sense for your attribute. The other values below do various things that need to be looked into for your implementation. The first parameter in the 'addAttribute' call is 'catalog_category' this maps out to a value from the database table eav_entity_type. For more information on EAV attributes see: Advanced ORM - by Alan Storm
The attribute sets with attributes relates to the categories through the product. Cause the product has relations with a attribute set
and the categories
There isn't required to do any additional customizations. Just create a required attribute sets and take a look at the categories that assigned to the product.
Best Answer
create a module Yournamespace_CategoryAttribute.
===========================================
now if you want to use form, in the same module:
in Yournamspace/CategoryAttribute/Block/CategoryAttribute.php
put your form and the form-action should be $baseurl/categoryattribute/