2013-08-02 75 views
1

你好去一個管理頁面Magento的定製管理頁面塊佈局問題

PHP Fatal error: Call to a member function setSaveParametersInSession() on a non-object in app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php on line 66

這裏的時候,我不斷收到以下錯誤是我的控制器:

class LTS_Categorymove_Adminhtml_BlacklistController extends Mage_Adminhtml_Controller_Action{ 

public function indexAction(){ 
    $this->loadLayout(); 

    var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles()); 

    $this->renderLayout(); 
} 

} 

這裏是我的主塊:

class LTS_Categorymove_Block_Adminhtml_Main extends Mage_Adminhtml_Block_Widget_Grid_Container{ 

protected $_addButtonLabel = 'Add New Example'; 

public function __construct(){ 
    //error_log('fgboo'); 
    $this->_controller = 'adminhtml_main'; 
    $this->_blockGroup = 'categorymove'; 
    $this->_headerText = 'Blacklist'; 
    $this->_addButtonLabel = 'Button Here'; 
    parent::__construct(); 
} 


protected function _prepareLayout(){ 
    $this->setChild('grid', 
     $this->getLayout()->createBlock($this->_blockGroup.'/' . $this->_controller . '_grid', 
     $this->_controller . '.grid')->setSaveParametersInSession(true)); 
    return parent::_prepareLayout(); 
} 

} 

現在,當我用google搜索這個問題的時候,每個人都會說它是一個不正常的_controller declration,但是從閱讀他們說,我應該使用我的名字。任何幫助將是真棒謝謝

+0

請嘗試檢查此[鏈接](http://www.magentocommerce.com/boards/viewthread/184145/)。 – Dinesh

+0

因此,如果你看到我已經發布的代碼** $ this - > _ controller ='adminhtml_main'; **我已經看到該帖子,並根據該帖子ni肩膀有問題 – mdw

回答

2

再次檢查您的文件夾結構,以確保所有文件都位於正確的路徑。

在我這個問題的情況下,該文件被放置在錯誤的位置。我將Grid.php放在controller/Adminhtml文件夾中,而不是Block/Adminhtml/<modulename>/Grid.php