Reputation: 1783
I know that I can add form elements via install scripts using method addAttribute(). However, now I'd like to get a whole new tab next to General, Display Settings and such. I wonder what's the simpliest way to do it without overcomplicating.
Upvotes: 1
Views: 2410
Reputation: 2072
An alternative to rewriting the block would be to listen to the event adminhtml_catalog_category_tabs
and then in your observer doing something like.
$tabs = $observer->getTabs();
$tabs->addTab('myextratab', array(
'label' => Mage::helper('catalog')->__('My Extra Tab'),
'content' => 'Here is the contents for my extra tab'
));
This would help stop rewrite conflicts that could occur between different extensions.
Upvotes: 2
Reputation: 2790
Assuming you already know how to do other parts of module. You need overriding the:
Mage_Adminhtml_Block_Catalog_Category_Tabs
On your config.xml you do:
<blocks>
<adminhtml>
<rewrite>
<catalog_category_tabs>YouModule_Block_Catalog_Category_Tabs</catalog_category_tabs>
</rewrite>
</adminhtml>
</blocks>
You'll need overriding the _prepareLayout function.
And you'll write this code:
$this->addTab('idname', array(
'label' => Mage::helper('catalog')->__('Tab name'),
'content' => $this->getLayout()->createBlock('yourmodule/yourblock')->toHtml(),
));
return parent::_prepareLayout();
Upvotes: 3