The Product edit section (Catalog->Manage Products -> edit) I want to display only the Inventory tab for a particular admin user role.

For instance an admin user with "test" as user role should only see Inventory tab while trying to edit a product.

Currently I use core_block_abstract_prepare_layout_after event to add a custom tab.

My observer function is as follows:

public function addTestBlock($observer){
$block = $observer->getEvent()->getBlock();
$product = Mage::registry('product');
if ($block instanceof Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs && $this->_canAddTab($product)){
    $block->addTab('myentity', array(
    'label' => Mage::helper('mymodule')->__('Test'),
    'url'   => Mage::helper('adminhtml')->getUrl('adminhtml/marketplace_tendor_catalog_product/tendors', array('_current' => true)),
    'class' => 'ajax',
return $this;


I have planned to use adminhtml_catalog_product_edit_prepare_form event to display only the "Inventory" tab for test admin user.

  1. Can I do this using event observer?
  2. If yes, How?

Can anyone guide me pls?

[EDIT: ] as suggested by mpaepper I used controller_action_layout_generate_blocks_after event and my observer function was like below:

public function vendorLayout($evt){
        $tabBlock =$evt->getEvent()->getBlock('product_tabs');
        $tab_ids = $tabBlock->getTabsIds();
        foreach ($tab_ids as $tab){
            if($tab != 'inventory'){
  1. checking the user role is not a problem I can add it later.
  2. removing the "General" tab results in the following.
  3. If i allow "General" (group_4) and "Inventory" (inventory) tabs, then it's working fine, but the requirement is only to display Inventory tab.

enter image description here

nothing happens if I click on that tab, I think the js script isn't loading. what am i doing wrong?

2 Answers 2


I used core_block_abstract_prepare_layout_after event and the observer was as follows:

public function vendorLayout($evt){ // for removing unallowed tabs and buttons from product information edit page.
        $tabBlock = $evt->getEvent()->getBlock();
        if ($tabBlock instanceof Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs) {
            $tab_ids = $tabBlock->getTabsIds();
            $tabs_to_show = array('inventory');
            foreach ($tab_ids as $tab){
                if(!in_array($tab, $tabs_to_show)){
        elseif($tabBlock instanceof Mage_Adminhtml_Block_Catalog_Product_Edit){
            $buttonsToBeRemoved = array('back_button', 'reset_button', 'delete_button', 'duplicate_button', 'save_and_edit_button');
            foreach($buttonsToBeRemoved as $button){

first condition removes all the tabs but "inventory", second condition removes all buttons but "save".

Thanks to @mpaepper and @Alex.

  • 1
    Is possible use this observer only for virtual product type? I tried several ways but I failed. Thanks.
    – Eduardo
    Jul 24, 2014 at 10:45
  • @shathish How can I set custom inventory.phtml? Dec 19, 2018 at 11:41

We developed a module which can configure for each user which tabs he/she can edit in the product backend.

To remove the tabs which are not allowed, we are subscribing to the event 'controller_action_layout_generate_blocks_after' and do something like this:

        if ($customHelper->getFullActionName() === 'adminhtml_catalog_product_edit') {
            if ($customHelper->isRestrictedUser()) {
                $tabNames = $tabModel->getForbiddenTabs(Mage::getSingleton('admin/session')->getUser()->getId());
                $tabBlock = Mage::app()->getLayout()->getBlock('product_tabs');

                foreach ( $tabNames as $tabName ) {
                    // Removes forbidden tabs
                    $tabBlock->removeTab( $tabName );

                // Added this to select the top-most tab
                $firstTab = current($tabBlock->getTabsIds());

The $tabModel is our model which fetches the permissions from the database, but this is all custom code. Instead, you could just provide a method here which fetches all tab names except the one for the stock, so all others will be removed.

EDIT: $customHelper is also custom, but you will need to implement sth. similar, i.e. detect whether the current user has restricted access, because otherwise all users will have the stripped view ;)

I think this should point you in the right direction, but if you are interested in buying a fully working module which handles all this out of the box with a GUI where you can configure the tab permissions per user, then contact me.

  • I can remove all tabs using your code except the "General" tab, If I remove general tab, the page doesn't work (I've edited my question). So am I doing anything wrong
    – Shathish
    Nov 6, 2013 at 5:46
  • @Shathish If you remove so many tabs, you might need to set the inventory tab as the active tab. I added some code to my answer.
    – mpaepper
    Nov 6, 2013 at 11:01

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.