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.

  • Did you try to omit the active option? – Fabian Blechschmidt Jun 7 '15 at 9:52
  • @FabianBlechschmidt yes, gives me same result. Thanks – Adarsh Khatri Jun 7 '15 at 10:04
  • did u find a solution to this ? – Reena Parekh Jul 30 '15 at 14:50
  • No, I haven't been able to. – Adarsh Khatri Aug 5 '15 at 1:46
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.

  • even after declaring <depends> tag, giving me same results. – Adarsh Khatri Jun 7 '15 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. – Fabian Blechschmidt Jun 7 '15 at 10:23

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.