Add custom category attribute

How to add custom category attribute in magento?

We have created two category attribute (i) Category Small Details1 (ii) Category Small Details2
(i) Category Small Details1 value must be required.
(i) Category Small Details2 value is not required.

Note:- you can download extension from this rar_image
Add custom category attribute in magento through custom module.
Note:- Firstly disable the cache from Cache Management tab which is in System tab.
there are many steps to create the extension.
Step1:- Create Mywork_AddCustomCategoryAttribute.xml file in app/etc/modules/.
where Mywork is Namespace and AddCustomCategoryAttribute is Modulename.
[php]
<?xml version="1.0"?>
<config>
<modules>
<Mywork_AddCustomCategoryAttribute>
<active>true</active>
<codePool>local</codePool>
<version>1.0.0</version>
</Mywork_AddCustomCategoryAttribute>
</modules>
</config>
[/php]

Note:- 1) If you want to active the extensions then use true otherwise false.
2) there are three code pool (a) local (b) core (c) community
when we create the own extension then we use local code pool.

Step2:- Now create the config.xml file in app/code/local/Mywork/AddCustomCategoryAttribute/etc/
[php]
<?xml version="1.0"?>
<config>
<modules>
<Mywork_AddCustomCategoryAttribute>
<version>1.0.0</version>
</Mywork_AddCustomCategoryAttribute>
</modules>

<global>
<helpers>
<AddCustomCategoryAttribute>
<class>Mywork_AddCustomCategoryAttribute_Helper</class>
</AddCustomCategoryAttribute>
</helpers>
<models>
<AddCustomCategoryAttribute>
<class>Mywork_AddCustomCategoryAttribute_Model</class>
<resourceModel>AddCustomCategoryAttribute_mysql4</resourceModel>
</AddCustomCategoryAttribute>
</models>
<resources>
<AddCustomCategoryAttribute_setup>
<setup>
<module>Mywork_AddCustomCategoryAttribute</module>
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</AddCustomCategoryAttribute_setup>
<AddCustomCategoryAttribute_write>
<connection>
<use>core_write</use>
</connection>
</AddCustomCategoryAttribute_write>
<AddCustomCategoryAttribute_read>
<connection>
<use>core_read</use>
</connection>
</AddCustomCategoryAttribute_read>
</resources>
</global>
</config>
[/php]

Step3:- Now create the mysql4-install-1.0.0.php file in app/code/local/Mywork/AddCustomCategoryAttribute/sql/AddCustomCategoryAttribute_setup/
[php]
<?php
$installer = $this;
$installer->startSetup();

$installer->addAttribute("catalog_category", "catsmalldetails1", array(
"type" => "varchar",
"backend" => "",
"frontend" => "",
"label" => "Category Small Details1",
"input" => "text",
"class" => "",
"source" => "",
"global" => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
"visible" => true,
"required" => true,
"user_defined" => false,
"default" => "",
"searchable" => false,
"filterable" => false,
"comparable" => false,

"visible_on_front" => false,
"unique" => false,
"note" => ""

));

$installer->addAttribute("catalog_category", "catsmalldetails2", array(
"type" => "varchar",
"backend" => "",
"frontend" => "",
"label" => "Category Small Details2",
"input" => "text",
"class" => "",
"source" => "",
"global" => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
"visible" => true,
"required" => false,
"user_defined" => false,
"default" => "",
"searchable" => false,
"filterable" => false,
"comparable" => false,

"visible_on_front" => false,
"unique" => false,
"note" => ""

));

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

Step4:- Now create the Data.php file in app/code/local/Mywork/AddCustomCategoryAttribute/Helper/
[php]
<?php
class Mywork_AddCustomCategoryAttribute_Helper_Data extends Mage_Core_Helper_Abstract
{
}
[/php]

After extension uploaded then you can see your custom category attribute on click the category.
AddCustomCategoryAttribute