How to add custom tab in left sidebar to my custom page in admin section in magento module?

How to add custom tab in left sidebar to my custom page in admin section in magento module?

August 28, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to add custom tab in left sidebar to my custom page in admin section in magento module?

Adding custom tabs on the left sidebar of your admin page in Magento involves several steps. Let’s break down how you can achieve this using your existing configurations.

Step 1: Understanding Your Current Configuration

Firstly, let me clarify some points about your current configuration.xml and system.xml files:

  • The config.xml file is correctly set up for adding a custom menu item under the System->Configuration tree in the admin panel. This is why you are seeing the “Synchronize” tab under System->Configuration.

  • The system.xml file is well-structured to add fields and options under your custom tab in the configuration section of the admin panel.

However, both these configurations are specific to the Configuration menu in Magento, which is a default module. To create tabs on your custom page, you need to define them separately while setting up your layout XML files.

Step 2: Defining Your Custom Page Layout

In your case, since you want the tab on a separate page (not under configuration), you’ll need to define it in your adminhtml.xml file located inside your module’s layout folder. This file is responsible for defining the structure of your custom pages.

The basic structure of this XML would look like this:

<layout version="1.0">
    <adminhtml_magecrmsync_index>
        <reference name="left">
            <block type="core/text_list" name="leftMenu" as="leftMenu" translate="label">
                <label>My Custom Tab</label>
            </block>
        </reference>
    </adminhtml_magecrmsync_index>
</layout>

In this example, adminhtml_magecrmsync_index is the layout handle for your custom page. The left reference points to the left sidebar area of the admin panel where you want to add your tab.

The <block> element defines a new block with the name “leftMenu”. This block will be added as a child of the “left” reference, effectively creating a new tab in the sidebar.

Step 3: Linking Your Custom Tab to a Controller

To make the tab functional, you need to link it to your controller. In your system.xml file, you have already defined the action for your menu items (i.e., customers, orders, and products) as magecrmsync/adminhtml_magecrmsync.

However, since you are creating a new page with a separate layout handle (adminhtml_magecrmsync_index), you’ll need to update this action in your controller. In your Magecrmsync_Adminhtml_MagecrmsyncController.php file:

public function indexAction()
{
    $this->loadLayout()->_setActiveMenu('menu1')->_addBreadcrumb(Mage::helper('adminhtml')->__('Synchronize Data'), Mage::helper('adminhtml')->__('Synchronize Data'))->_title($this->__('Synchronize Data'));

    // Create a new block for the tab content
    $block = $this->getLayout()->createBlock('core/text', 'my_block_name_here')
        ->setText('This is the content of my custom tab.');

    // Add the block to the left menu
    $this->getLayout()->getBlock('leftMenu')->addChild('my_custom_tab', $block);

    $this->renderLayout();
}

In this updated indexAction, I’ve added a new block for the tab’s content and then appended it as a child of your “leftMenu” block.

Step 4: Creating Your Custom Tab PHTML File

For the actual rendering of the tab, you’ll need to create a new phtml file in your module’s template folder (under adminhtml/default/default/template/your_module). You can name this file something like my_custom_tab.phtml.

The content of this file will depend on what you want to display inside the tab. It could be just text or a complex layout with blocks and other elements.

Conclusion

To summarize, creating a custom tab in the left sidebar for your own page involves:

  1. Defining the layout handle for your page in your adminhtml.xml file.
  2. Creating a new block and adding it to the “left” reference of your layout handle as a child of the “leftMenu”.
  3. Updating your controller’s action to load this custom layout.
  4. Creating the phtml file for rendering the actual content of your tab.

Remember, Magento is very specific about where you define different aspects of your module (layouts in layout folder, controllers in Controller folder, etc.), so ensure you are following these conventions carefully.

I hope this guide helps you add tabs to your custom admin page in Magento. If you have any other questions or need further assistance with Magento development, feel free to explore the resources available at Laravel Company.

Extensions Themes Admin Configuration

Our network