Is it possible to link directly to a tab on a backend page, using URL fragments?

In particular, I want to link to the "Manage Label / Options" tab on the "Edit Product Attribute Page":


I hope for something like /admin/catalog_product_attribute/edit/attribute_id/1/#product_attribute_tabs_labels where the URL fragment #product_attribute_tabs_labels is read in JavaScript and the tab gets selected.

If that's not possible out of the box, how could this feature be added with an additional script and without rewriting templates?


Actually it's possible with a URL parameter ?active_tab=$id.

How to find the right tab id

Find the responsible tab container class. This is a child class of Mage_Adminhtml_Block_Widget_Tabs, in my case, Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tabs.

You'll find calls to $this->addTab(), usually in the methods _beforeToHtml(), or _construct(). The first parameter of addTab() is the tab id:

$this->addTab('labels', array(
    'label'     => Mage::helper('catalog')->__('Manage Label / Options'),
    'title'     => Mage::helper('catalog')->__('Manage Label / Options'),
    'content'   => $this->getLayout()->createBlock('adminhtml/catalog_product_attribute_edit_tab_options')->toHtml(),

So, the URL is /admin/catalog_product_attribute/edit/attribute_id/123/?active_tab=labels, generated with this code (within an adminhtml block):

    array('attribute_id' => 123, '_query' => array('active_tab' => 'labels'));

How it works

Let's have a look at the responsible code:


Sets the active tab based on URL parameter or session value. If setActiveTab() is not called, the _activeTab property defaults to the first added tab:

    if ($activeTab = $this->getRequest()->getParam('active_tab')) {
    } elseif ($activeTabId = Mage::getSingleton('admin/session')->getActiveTabId()) {


Here, the result of getActiveTabId() is passed to the varienTabs instantiation in JavaScript:

<script type="text/javascript">
    <?php echo $this->getJsObjectName() ?> = new varienTabs(
        '<?php echo $this->getId() ?>',
        '<?php echo $this->getDestElementId() ?>',
        '<?php echo $this->getActiveTabId() ?>',
        <?php echo $this->getAllShadowTabs()?>);

The varienTabs constructor takes the active tab id as parameter and shows it. For the curious, the code is in js/mage/adminhtml/tabs.js


To further fschmengler's detailed response.

To link directly to a product tab, find the active_tab in class Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs


My requirement was to directly link to the upsells tab on the product edit page from a custom grid (see actions -> url -> params).

    $this->addColumn('action', array(
        'header'        =>  Mage::helper('reports')->__('Action'),
        'type'          => 'action',
        'getter'        => 'getId',
        'actions'       => array(
                'caption'   => Mage::helper('reports')->__('Edit Product'),
                'url'       => array(
                    'base'      => 'adminhtml/catalog_product/edit',
                    'params'    => array('active_tab' => 'upsell')
                'target'    => '_blank',
                'field'     => 'id'

The other 'labeled' tabs include: inventory, categories, related, crosssell, reviews, tags, customers_tags, customer_options (custom?), configurable.

The tabs above 'inventory', such as 'Images' or 'Design' require you to know the attribute set group id e.g. group_20 (see eav/entity_attribute_group_collection).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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