【问题标题】:Magento custom admin page block layout issuesMagento 自定义管理页面块布局问题
【发布时间】:2013-08-02 10:34:17
【问题描述】:

您好,我在进入管理页面时不断收到以下错误

PHP 致命错误:在第 66 行的 app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php 中的非对象上调用成员函数 setSaveParametersInSession()

这是我的控制器:

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();
}

}

现在,当我用谷歌搜索这个问题时,每个人都一直说它是一个不正确的 _controller 声明,但从周围阅读中,他们说我应该使用我所在的块名称。任何帮助都会很棒,谢谢

【问题讨论】:

  • 试试看link
  • 是的,因此,如果您看到我发布的代码 $this->_controller = 'adminhtml_main'; 我已经看到该帖子,根据该帖子,您应该有问题

标签: php magento magento-1.6


【解决方案1】:

再次检查您的文件夹结构,确保所有文件都位于正确的路径。

就我而言,对于这个问题,文件放置在错误的位置。我将Grid.php 放在controller/Adminhtml 文件夹而不是Block/Adminhtml/<modulename>/Grid.php

【讨论】:

    猜你喜欢
    • 2014-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多