Magento custom tab of category edit page with custom attribute.How to create new category attribute with new group in magento.
Magento custom tab of category edit page with custom attribute.

In this tutorial I am going to show you how you can manage to create Magento custom tab of category edit page with custom attribute.That means you can create a from where you can set you attributes into that form and when you will save category then that value will saved into database.So for doing all this I will explain in two ways like first is if you want only to manage through category attribute and not want use your custom database table and second one is reverse of first one.For simple description how to create custom tab in category edit page you can follow magento custom tab of category edit page article,then after you can proceed for further.If you have seen the article magento custom tab of category edit page article then below description will be more easier for you.Lets see one by one how we can create Magento custom tabe of category edit page with custom attribute.

First method:

By attribute:

Either you can use below code in your module setup file or you can use it as a custom script to create category attribute in magento. So for creating custom attribute in magento you can follow how to create attribute by custom script.I have defined the group name in group section as ‘group’ => ‘My Custom Tab’ which defines the attribute will be placed under this group.If ther is no group present then magento will create automatically and assign the newly created attribute into this group.
Dir: app/code/[CodePool]/[NameSpace]/[ModuleName]/data/[modulename_setup]/mysql4-install-0.1.0.php
e.g: app/code/local/JRB/Customtab/data/customtab_setup/mysql4-install-0.1.0.php

So do not forget to add resource in config.xml file .SO please follow below code for declaring resource.

Config.xml:

Dir: app/code/[CodePool]/[NameSpace]/[ModuleName]/etc/config.xml
e.g: app/code/local/JRB/Customtab/etc/config.xml

Second method:

By custom table:

In this method if you will like to manage you data base table through this tab then fine you manage by the way.Here I am not explaining all possibilities to create custom tab in category edit page.For this you can follow magento custom tab of category edit page article.Lets se how we can do it.

Config.xml:

Dir: app/code/[CodePool]/[NameSpace]/[ModuleName]/etc/config.xml
e.g: app/code/local/JRB/Customtab/etc/config.xml

Form.php:

Dir: app/code/[CodePool]/[NameSpace]/[ModuleName]/Block/Adminhtml/Category/Form.php
e.g: app/code/local/JRB/Customtab/Block/Adminhtml/Category/Form.php

After declaring the block content then we can use the form for that block content. So if you see Observer.php file then you will be getting some code which declares the form location by:

Then see the Form.php file by the code below.

Observer.php:

Dir: app/code/[CodePool]/[NameSpace]/[ModuleName]/Model/Observer.php
e.g: app/code/local/JRB/Customtab/Model/Observer.php

Here I have taken two event one is two create custom tab that is adminhtml_catalog_category_tabs and other is to take param value when category will save that is catalog_category_prepare_save.

Hope you understand this tutorial and will never forget to share.

Magento custom tab of category edit page with custom attribute
Tagged on:                                     

3 thoughts on “Magento custom tab of category edit page with custom attribute

Leave a Reply

Your email address will not be published. Required fields are marked *