Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing an Item from Magento's Admin Panel Navigation

Using the Magento Ecommerce system, is is possible to remove an item from the Admin Panel Navigation menu? More generally, is there a way to use the config override system to remove existing elements from a configuration?

I know I can add to the navigation with an override that looks something like this

<?xml version="1.0"?>
<config>
    <modules>
        <Company_Module>
            <version>
                0.1.0
            </version>
        </Company_Module>
    </modules>

    <adminhtml>
        <menu>
             <cms translate="title" module="cms">
                <title>The CMS</title>
                <sort_order>70</sort_order>
                <children>
                    <foo translate="title" module="cms">
                        <title>Foo Item</title>
                        <action>adminhtml/foo</action>
                    </foo>
                </children>
             </cms>
        </menu>    
    </adminhtml>
</config>

but how would/could I completely suppress the CMS navigation item?

like image 446
Alan Storm Avatar asked Apr 07 '09 01:04

Alan Storm


3 Answers

Cleaner way to do this:

Add a adminhtml.xml (e.g. to an existing modules that keeps all other customization stuff, or create a new module)

<?xml version="1.0" ?>
<config>
    <menu>
        <xmlconnect>
            <disabled>1</disabled>
        </xmlconnect>
    </menu>
</config>
like image 176
fbrnc Avatar answered Oct 16 '22 21:10

fbrnc


You could inject a bogus module dependency into the menu item in your config.xml.

In your case,

<adminhtml>
  <menu>
    <cms translate="title" module="cms">
      <depends><module>HideMe</module></depends>
    </cms>
  </menu>
</adminhtml>
like image 11
Scott Moorhouse Avatar answered Oct 16 '22 22:10

Scott Moorhouse


I don't think Alan would still need anyone to ask this question, but for anyone else that might end up reading this, it would be a bit better to use:

<adminhtml>
  <menu>
    <cms translate="title" module="cms">
      <depends><config>some/configuration/flag</config></depends>
    </cms>
  </menu>
</adminhtml>
like image 4
dsueiro Avatar answered Oct 16 '22 22:10

dsueiro