MathiasH
MathiasH

Reputation: 115

Wrong tab configuration on Magento

I have a huge problem with an magento extension I developed. Localhost everything is fine but when I deploy, it get this error.

Wrong tab configuration

#0 [internal function]: Mage_Adminhtml_Block_Widget_Tabs->addTab('pricematrix', 'tab_pricematrix')
#1 /var/www/vhosts/discountprint.dk/httpdocs/app/code/core/Mage/Core/Model/Layout.php(347): call_user_func_array(Array, Array)
#2 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Core/Model/Layout.php(213): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#3 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Core/Model/Layout.php(209): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#4 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(343): Mage_Core_Model_Layout->generateBlocks()
#5 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(270): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#6 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Adminhtml/Controller/Action.php(263): Mage_Core_Controller_Varien_Action->loadLayout(Array, true, true)
#7 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(246): Mage_Adminhtml_Controller_Action->loadLayout(Array)
#8 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Catalog_ProductController->editAction()
#9 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('edit')
#10 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /var/www/vhosts/something.dk/httpdocs/app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Controller_Varien_Front->dispatch()
#12 /var/www/vhosts/something.dk/httpdocs/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#13 /var/www/vhosts/something.dk/httpdocs/index.php(80): Mage::run('', 'store')
#14 {main}

I Googled it for hours but can't find any useful information. My magento version is 1.5.0.1

Hope you can help

Upvotes: 2

Views: 5971

Answers (2)

Peter O'Callaghan
Peter O'Callaghan

Reputation: 6186

Normally localhost problems that don't appear on a live site are to do with filesystem case sensitivity. Most developers in my experience develop on Windows / Mac OSX, which by default aren't case sensitive. But most production environments are some kind of *nix system. One thing that has tripped me up in the past is having a filename with a capital letter in the middle.

For example if a block is FooBar.php and sits in Mage_Core, when loading the model you must use...

Mage::getModel('core/fooBar');

The string is automatically ran through ucwords, but obviously any camel casing in your file naming will need to be taken into account when requesting a model/block etc.

Upvotes: 2

Alana Storm
Alana Storm

Reputation: 166166

You'll get a lot farther if you stop searching Google and start searching your code.

Search for the exception string "Wrong tab configuration"

$ ack 'Wrong tab configuration'
Adminhtml/Block/Widget/Tabs.php
108:                throw new Exception(Mage::helper('adminhtml')->__('Wrong tab configuration.'));
112:            throw new Exception(Mage::helper('adminhtml')->__('Wrong tab configuration.'));

Look at that, there's only two possible places in the entire source tree that could be throwing that exception, both in the addTab method your stack-trace indicated was being called. Looking at that code in context

public function addTab($tabId, $tab)
{
    if (is_array($tab)) {
        $this->_tabs[$tabId] = new Varien_Object($tab);
    }
    elseif ($tab instanceof Varien_Object) {
        $this->_tabs[$tabId] = $tab;
        if (!$this->_tabs[$tabId]->hasTabId()) {
            $this->_tabs[$tabId]->setTabId($tabId);
        }
    }
    elseif (is_string($tab)) {
        if (strpos($tab, '/')) {
            $this->_tabs[$tabId] = $this->getLayout()->createBlock($tab);
        }
        elseif ($this->getChild($tab)) {
            $this->_tabs[$tabId] = $this->getChild($tab);
        }
        else {
            $this->_tabs[$tabId] = null;
        }

        if (!($this->_tabs[$tabId] instanceof Mage_Adminhtml_Block_Widget_Tab_Interface)) {
            throw new Exception(Mage::helper('adminhtml')->__('Wrong tab configuration.'));
        }
    }
    else {
        throw new Exception(Mage::helper('adminhtml')->__('Wrong tab configuration.'));
    }

It looks like your call is running through the second if/else branch. Your tab string, tab_pricematrix, is used to fetch a child block from the current tab

$this->_tabs[$tabId] = $this->getChild($tab);

However, it looks like whatever it finds in there isn't a child of Mage_Adminhtml_Block_Widget_Tab_Interface.

My guess is that's because the call to getChild is returning false because your module hasn't added a tab with the name tab_pricematrix to the layout (did you copy the Layout XML files to the new server?) Without knowing how you've implemented that module, it's impossible to say for sure.

Good luck!

Upvotes: 11

Related Questions