0

I have successfully added a custom tab in customer_edit_tabs section and is ordered after orders tab.

However when I go to edit customer page, my custom tab is by default set to active instead showing me default active tab (i.e. Customer View).

I have done this so far but no luck-

protected function _prepareLayout()
    {
        //get all existing tabs
        $this->parent = parent::_prepareLayout();
        //add new tab
        $this->addTab('relate_order', array(
            'label'     => Mage::helper('relate_order')->__('Relate Order'),
            'content'   => $this->getLayout()
             ->createBlock('relate_order/adminhtml_customer_edit_tabs_relate', 'relate.order')->toHtml(),
            'after'     => 'orders',

            //setting non active not working
            'active'    => false
        ));
        return $this->parent;
    }

Even though I have mentioned this new tab to be not active, it still shows up at first.

Please help.

4
  • Did you try to omit the active option? Commented Jun 7, 2015 at 9:52
  • @FabianBlechschmidt yes, gives me same result. Thanks Commented Jun 7, 2015 at 10:04
  • did u find a solution to this ? Commented Jul 30, 2015 at 14:50
  • No, I haven't been able to. Commented Aug 5, 2015 at 1:46

1 Answer 1

1

To have the tab active, it either have to be the first or it has to return a boolean true:

\Mage_Adminhtml_Block_Widget_Tabs::addTab
app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php:140
if (is_null($this->_activeTab)) $this->_activeTab = $tabId;
if (true === $this->_tabs[$tabId]->getActive()) $this->setActiveTab($tabId);

You don't return a boolean true, so the first case is yours. You should try to <depends> on Mage_Adminhtml to make sure, your layout xml is loaded later, and your tab is not the first.

2
  • even after declaring <depends> tag, giving me same results. Commented Jun 7, 2015 at 10:06
  • 2
    Then you should hook into the method and check which of the two lines adds your tab. Happy digging. I recommend xdebug. Commented Jun 7, 2015 at 10: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.