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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?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
1 2 3 4 5 6 7 8 9 |
<?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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?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.
[crayon-63d3e455e6839194112712/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.