If you are simply organizing new attribute groups, create a setup script:
$installer = Mage::getResourceModel('catalog/setup','catalog_setup');
$installer->startSetup();
//Categories typically only have one attribute set, this will retrieve its ID
$setId = Mage::getSingleton('eav/config')->getEntityType('catalog_category')->getDefaultAttributeSetId();
//Add group to entity & set
$installer->addAttributeGroup('catalog_category',$setId, 'My Extra Tab');
$installer->endSetup();
If you are adding one or more attributes as well, just specify the tab name in the group
configuration value for the attribute and the group will be added automatically:
$installer = Mage::getResourceModel('catalog/setup','catalog_setup');
$installer->startSetup();
//Add group to entity & all attribute sets
$installer->addAttribute(
'catalog_category',
'new_attribute',
array(
'label' => 'New Attribute',
'group' => 'My Extra Tab' //will be created if necessary
)
);
$installer->endSetup();
If you are trying to just add some generic content, adding a tab via the adminhtml_catalog_category_tabs
event - as noted in another answer - will be the way to go.
Best Answer
1. Extend Table
catalog_product_entity_media_gallery_value
with a setup Script2. Rewrite Ressource Model
Rewrite Method
_getLoadGallerySelect()
in ClassMage_Catalog_Model_Resource_Product_Attribute_Backend_Media
to add your new Field to both Joins3. Rewrite Model
Rewrite Method
afterLoad()
andupdateImage()
in ClassMage_Catalog_Model_Product_Attribute_Backend_Media
to add your new Field to Arraysand
4. Change Adminhtml Template
You habe to replace the Template with your version where you add your textarea
app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml
There is a lot of Javascript at the bottom the render the correct fields. In our project is jQuery included. If you don't have jQuery in your adminhtml you have to refactor the javascript part
5 Save Data
Now you can register an Observer an listen on the Event
catalog_product_save_after
. You get the Data via the ObserverYou have to foreach through every image and save the field in the Gallery