2

I have implemented a new tab in the ADD/EDIT product page in admin using this tutorial: http://www.magentothemess.com/archives/1267

It is working, but in the ADD product case, my tab is displayed in the 2 steps: - the one were you select the product type (generally only 1 tab is displayed called Options) - the second step were you have all the tabs (general, prices, etc..)

How can I do to display my custom tab only at the second step?

here is my .xml

<layout>

    <adminhtml_catalog_product_new>
        <reference name="product_tabs">
            <action method="addTab">
                <name>Formula_price_tab</name>
                <block>quotemodule/adminhtml_catalog_product_tab</block>
            </action>
        </reference>
    </adminhtml_catalog_product_new>

    <adminhtml_catalog_product_edit>
        <reference name="product_tabs">
            <action method="addTab">
                <name>Formula_price_tab</name>
                <block>quotemodule/adminhtml_catalog_product_tab</block>
            </action>
        </reference>
    </adminhtml_catalog_product_edit>
</layout>
1
  • What happen if you remove <adminhtml_catalog_product_new> ... </adminhtml_catalog_product_new> Commented Oct 11, 2014 at 13:42

2 Answers 2

2

Take a look at Add Custom Tabs To The Magento Product Admin

Change your layout to

<layout>
    <adminhtml_catalog_product_edit>
        <reference name="product_tabs">
            <action method="addTab">
                <name>Formula_price_tab</name>
                <block>quotemodule/adminhtml_catalog_product_tab</block>
            </action>
        </reference>
    </adminhtml_catalog_product_edit>
</layout>
3
  • that is what I did first, but in that case, my tab is not displayed at all while creating the product...
    – Alexglvr
    Commented Oct 13, 2014 at 5:26
  • can you add some screen shot? Commented Oct 13, 2014 at 12:21
  • the first "Add product step":[IMG]i58.tinypic.com/mkw35t.png[/IMG] The second step: [IMG]i58.tinypic.com/ndx2ki.png[/IMG] My tab (Formula Price Type) is present on both… I would like it to be displayed only in the second step.
    – Alexglvr
    Commented Oct 14, 2014 at 5:41
2

You need to implement the method canShowTab() in your tab block and make it look like this:

public function canShowTab() {
    $product = Mage::registry('current_product');
    if ($product->getId()) {
        return true;
    }
    if (!$product->getAttributeSetId()) {
        return false;
    }
    $request = Mage::app()->getRequest();
    if ($request->getParam('type') == 'configurable') {
        if ($request->getParam('attributes')) {
            return true;
        }
    }
    return false;
}

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.