Hello folks,
If you want to add custom category attribute to Magento then you are at right place.
Today, I am going to show you how to create a custom attribute.
To create a custom attribute the first step is to create a module.
Step 1: Create a file app/code/local/Magemonkeys/Customattribute/etc/config.xml and paste the below code in that file.
<?xml version="1.0"?>
<config>
<modules>
<Magemonkeys_Customattribute>
<version>0.0.1</version>
</Magemonkeys_Customattribute>
</modules>
<global>
<resources>
<customattribute_setup>
<setup>
<module>Magemonkeys_Customattribute</module>
<class>Mage_Eav_Model_Entity_Setup</class>
</setup>
<connection>
<use>default_setup</use>
</connection>
</customattribute_setup>
</resources>
</global>
</config>
Step 2: Create a file app/etc/modules/Magemonkeys_Customattribute.xml and paste the below code in the file
<?xml version="1.0"?>
<config>
<modules>
<Magemonkeys_Customattribute>
<active>true</active>
<codePool>local</codePool>
</Magemonkeys_Customattribute>
</modules>
</config>
Step 3: Create a file app/code/local/Magemonkeys/Customattribute/sql/customattribute_setup/mysql4-install-0.0.1.php and paste the below code in it.
<?php
$installer = $this;
$installer->startSetup();
$attribute = array(
'type' => 'text',
'label'=> 'Another Descrtiption',
'input' => 'textarea',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'another_description', $attribute);
$installer->endSetup();
?>
After this you have to clear the cache and go to Catalog -> Manage Categories, you will see your new attribute in the “General Information” tab.
Let us know by making a comment if this article helped you in your Magento development journey.

