I'm writing my custom module, and i'me searching the possibility to add a custom grid to admin tag edit form to handle my_entity-to-tag relation. Anyone knows how to implement that?

  • Does default magento has similar solution anywhere? Do you need smth like Catalog / Category / <tab Products> ? – zhartaunik Apr 15 '15 at 8:42
  • No, i need section exactly in tag edit form in admin – Styopchik Apr 15 '15 at 8:46
  • Like this? prntscr.com/6tyk98 "Products 1111111" – zhartaunik Apr 15 '15 at 8:52
  • Yes, exactly. I need section like "Products tagged by Administrator" – Styopchik Apr 15 '15 at 8:54
  • Ok, give me some time. I'm writing solution – zhartaunik Apr 15 '15 at 9:04

Assigning tabs magento do in _prepareLayout method.

You can see an example here:


To add your own tab you need to use, for example event core_block_abstract_prepare_layout_after

add following to your module etc/config.xml :


Don't forget include in your event check like this:

$yourBlock instanceof Mage_Adminhtml_Block_Tag_Edit_Assigned

At all code of your observer will be like this:

public function addTabToTag($observer)
    $block = $observer->getBlock();
    if($block instanceof Mage_Adminhtml_Block_Tag_Edit_Assigned)
        $tagModel = Mage::registry('current_tag');

        $block->addItem('custom_tab', array(
            'title'         => Mage::helper('tag')->__('Custom Tag'),
            'ajax'          => true,
            'content_url'   => $block->getUrl('*/*/assigned', array('ret' => 'all', 'tag_id'=>$tagModel->getId(), 'store'=>$tagModel->getStoreId())),

As you can see you have here $this->getUrl('*/*/assigned'

You need to replace it with some another controller action.

To be continued ....

As far as I can see this controller/action has only load and render layout. You need to rewrite this controller (if you need help - just tell) and add following method:

public function customAction()

Then you need to add content to this block. It makes by layout. Open /app/design/adminhtml/default/default/layout/tag.xml and you can see examples there:

    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/tag_product_grid" name="adminhtml.tag.product.grid"/>

    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/tag_customer_grid" name="adminhtml.tag.customer.grid"/>

In block class Mage_Adminhtml_Block_Tag_Customer_Grid you can see an example how to create your own grid.

If you have any question - just ask.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.