0

Sysnopsis

I am trying to change a tab on the admin products page (grouped); However for some obscure reason I cannot get my module to work. The problem seems to be my module is completely ignored.

Code

app/etc/modules/Vendor_Catalog.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Vendor_Catalog>
            <active>true</active>
            <codePool>local</codePool>
        </Vendor_Catalog>
    </modules>
</config>

Vendor/Catalog/etc/config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Vendor_Catalog>
            <version>1.0.0</version>
        </Vendor_Catalog>
    </modules>
    <global>
        <blocks>
            <vendor_catalog>
                <class>Vendor_Catalog_Block</class>
            </vendor_catalog>
            <adminhtml>
                <rewrite>        
                    <catalog_product_edit_tabs_grouped>Vendor_Catalog_Block_Adminhtml_Catalog_Product_Edit_Tabs_Grouped</catalog_product_edit_tabs_grouped>
                </rewrite>
            </adminhtml>
        </blocks>
    </global>
</config>

Vendor/Catalog/Block/Adminhtml/Catalog/Product/Edit/Tabs/Grouped.php:

<?php
class Vendor_Catalog_Block_Adminhtml_Catalog_Product_Edit_Tabs_Grouped
    extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs
{
}
1
  • remove grouped form your tab and try below one because you have to directory structure same path as overridden block.
    – Keyul Shah
    Commented Jan 23, 2014 at 17:04

2 Answers 2

1

During my sleep I must have subconsciously thought of the solution; it would appear that I was overriding the wrong block for this scenario.

Also it appears to me that Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Grouped is either deprecated or just not used any more.

Nevertheless I added a die; statement inside the cores' protected function _prepareLayout() method - lo and behold nothing stopped processing. So I consult my best friend grep and found the following:

$ grep -r -e 'Associated Products' "app/code/core/Mage/"

A core block Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Group which I then decided to override - this worked (source attached for anyone else that has this problem).


Vendor/Catalog/etc/config.xml:

<config>

    ...

    <global>
        <blocks>
            <vendor_catalog>
                <class>Vendor_Catalog_Block</class>
            </vendor_catalog>
            <adminhtml>
                <rewrite>
                    <catalog_product_edit_tab_super_group>Vendor_Catalog_Block_Adminhtml_Catalog_Product_Edit_Tab_Super_Group</catalog_product_edit_tab_super_group>
                </rewrite>
            </adminhtml>
        </blocks>
    </global>

    ...

</config>

Vendor/Catalog/Block/Adminhtml/Catalog/Product/Edit/Tab/Super/Group.php:

<?php

class Vendor_Catalog_Block_Adminhtml_Catalog_Product_Edit_Tab_Super_Group
    extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Group
{
    public function getTabUrl()
    {
        // Override the tab Url with my controller/action.
        return $this->getUrl('*/vendor_catalog_product/superGroup', array('_current' => true));
    }
}
0

Change the Block as per Below code

...

<global>
    <blocks>
        <vendor_catalog>
            <class>Vendor_Catalog_Block</class>
        </vendor_catalog>
        <adminhtml>
            <rewrite>
                <catalog_product_edit_tab_super_group>Vendor_Catalog_Block_Adminhtml_Catalog_Product_Edit_Tab_Super_Group</catalog_product_edit_tab_super_group>
            </rewrite>
        </adminhtml>
    </blocks>
</global>

...

And the File structure like as below path

\app\code\local\Vendor\Catalog\Block\Adminhtml\Catalog\Product\Edit\Tabs.php

<?php
class Vendor_Catalog_Block_Adminhtml_Catalog_Product_Edit_Tab_Super_Group
extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Group
{
    public function getTabUrl()
    {
    // Override the tab Url with my controller/action.
        return $this->getUrl('*/vendor_catalog_product/superGroup', array('_current' => true));
    }
}
3
  • I don't see how this would work because <catalog> is not my module. Also I do not want to extend Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs But override Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Grouped which so happens to extend the former.
    – Ash
    Commented Jan 23, 2014 at 17:08
  • chat.stackexchange.com/rooms/12634/takingsides join this room
    – Keyul Shah
    Commented Jan 23, 2014 at 17:11
  • we will discuss on chat.
    – Keyul Shah
    Commented Jan 23, 2014 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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