2012-01-09 37 views
2

我開發的一個magento擴展有一個很大的問題。本地一切都很好,但是當我部署時,它會得到這個錯誤。Magento上的錯誤標籤配置

錯誤選項卡配置

#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} 

我GOOGLE了它幾個小時,但找不到任何有用的信息。我的Magento的版本是1.5.0.1

希望你能幫助

+0

如果有人可以指出我在一個可能的錯誤方向,這將是偉大的。 – MathiasH 2012-01-09 17:06:37

+0

btw,localhost正在運行一個更新的版本1.5.1.0 – MathiasH 2012-01-09 17:06:59

+0

什麼是錯誤信息本身? – 2012-01-09 17:44:12

回答

10

,如果你停止搜索谷歌並開始搜索你的代碼你會得到很多更遠。

的異常字符串「錯卡的配置」

$ 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.')); 

看那個

搜索的話,只有2點在整個源代碼樹可能的位置可能被拋出該異常,無論在addTab方法你堆棧跟蹤顯示被稱爲。在上下文中查看該代碼

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.')); 
    } 

看起來您的呼叫正在運行第二個if/else分支。你的標籤字符串,tab_pricematrix,用於從當前選項卡

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

但是,它看起來像什麼發現在那裏取一個孩子塊不是Mage_Adminhtml_Block_Widget_Tab_Interface一個孩子。

我的猜測是因爲getChild的調用返回false,因爲你的模塊沒有在佈局中添加名稱爲tab_pricematrix的選項卡(是否將佈局XML文件複製到新服務器?已經實現了這個模塊,這是不可能的。

祝你好運!

+1

我正在刪除不再處於擴展名的文件使用和這個答案幫助了我。我做了一個
'grep -rin「tab_pricematrix」*'並找到了違規文件。 (我的功能不叫做tab_pricematrix)事實證明,開發人員編寫了自定義覆蓋來解除擴展依賴關係,當未使用的包被刪除時它們被破壞。 – 2014-09-19 19:37:05

2

正常情況下,不在活動網站上出現的localhost問題與文件系統區分大小寫有關。根據我的經驗,大多數開發人員都是在Windows/Mac OSX上開發的,默認情況下不區分大小寫。但大多數生產環境都是某種* nix系統。過去有一件事情讓我感到沮喪,那就是中間有一個大寫字母的文件名。

例如,如果一個塊是FooBar.php和Mage_Core坐鎮,裝載必須使用

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

的字符串會自動通過ucwords跑在模型......,但很明顯,任何駱駝套管時您文件命名將需要考慮到當請求一個模型/塊等

+0

這是你在你的例子中有一個小f的錯字嗎? – MathiasH 2012-01-10 09:11:27

+1

不,路徑get在下劃線上爆炸,並跑過ucwords,這意味着f會自動變爲大寫。如果該類名爲Foo_Bar,並且名爲Bar.php的文件位於Foo文件夾中,則可以簡單地使用'core/foo_bar'。 – 2012-01-10 09:55:11