Adminhtml Catalog Product Edit Tabs Sorting Order – How to Set

adminhtmltabs

I'm looking to add a new tab to the adminhtml catalog product edit page on the left side. I've gone through and followed this tutorial, and my new tab is showing up correctly on the left side.

http://www.phpcmsframework.com/2012/12/magento-steps-to-add-custom-tabs-to.html

What I'm looking to do now, though, is change the sorting order of those tabs so mine is not last on the list. This is something that was not covered in the tutorial, and I have not been able to find anything online or in the code to point me in the right direction. Any suggestions appreciated!

Best Answer

See below, notice I changed the action from addTab to addTabAfter and within the action I added the node <after>inventory</after>

This will display the tab under the Inventory tab.

As per the example, your layout is currently:

<?xml version="1.0"?>
<layout>
    <adminhtml_catalog_product_edit>
        <reference name="product_tabs">
            <action method="addTab">
                <name>my_custom_tab</name>
                <block>customtabs/adminhtml_catalog_product_tab</block>
            </action>
        </reference>
    </adminhtml_catalog_product_edit>
</layout>

Change it to this:

<?xml version="1.0"?>
<layout>
    <adminhtml_catalog_product_edit>
        <reference name="product_tabs">
            <action method="addTabAfter">
                <name>my_custom_tab</name>
                <block>customtabs/adminhtml_catalog_product_tab</block>
                <after>inventory</after>
            </action>
        </reference>
    </adminhtml_catalog_product_edit>
</layout>