How to hide top menu and disable my custom module, if field "enabled" is 0(no). Magento version 1.9

<?xml version="1.0"?>
    <plumrocket translate="title">
    <productlabels translate="title">
        <label>Product Labels</label>
                <label translate="title">Settings</label>
                        <label translate="title">Enabled</label>

  • Why you don't disable the module from xml file under app/etc/modules? it will remove every configurations from the admin. Commented Feb 27, 2018 at 0:19

2 Answers 2


In your etc/adminhtml.xml, in which you define your top menu item, you can use the <depends></depends> node in the same way as you would do in system.xml to make one option depend on another one.

This means, in your etc/adminhtml.xml you can do something like this (note: you need to adapt vendor_module by yourself as it is not declared in your question):

        <vendor_module module="vendor_module">
                <config>productlabels/global/enabled</config> <!-- as defined in your system.xml -->
            <title>Vendor Module Title</title>

The magic part in this is the <depends><config>productlabels/global/enabled</config></depends> which makes Magento check for whether this option is set to Yes or No in System -> Configuration -> Your Module -> Your Option.

Important note: This does not mean that your controller action is not reachable! If you want to hinder the user to reach the page behind by entering its direct URL you'll have to cover this separately.

  • Thank you, it working but section in top menu make hidden when i am refrashe cache. I try clean cache on event "admin_system_config_changed_section_productlabels" but i dont know how do it. Commented Feb 27, 2018 at 8:06
  • I'm sorry, @ПетроЧайківський, I think I can not follow. You mean you set the visibility flag to "no" but the menu item is still visible until you clear the cache? Commented Feb 28, 2018 at 0:54

This is not the top menu, it's configuration settings, but you can hide them by commenting on the <tab> ... </ tab> tag. Then the Magento will not know which module these settings belong to. The top menu settings are in the <menu>

  • it menu in System>Configuration, there is field "enabled", when endbled equal 0 i need hide the one section from top menu Commented Feb 26, 2018 at 23:08
  • you need to use jQuery, hide the field, if at change (), value = 0. Commented Feb 26, 2018 at 23:15
  • bad idea and i dont know how to use jQuery in Magento Commented Feb 26, 2018 at 23:17
  • write jquery in the template that connects to the page. jQuery is already connected Commented Feb 26, 2018 at 23:20
  • @EvgeniyKapelko - jQuery as such is interpreted in the browser, hence you would need to view the modules settings page in order to be able to hide a top menu item. Any other page would show the menu item anyway, since you can not refer to something that is not present in the html output in this way. Commented Feb 27, 2018 at 5:23

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.