我越来越 setSaveParametersInSession() on a non-object
它在管理模块上,路径为
Training/Distributor/Block/Adminhtml/
在这个文件夹中
Distributor/Grid.php
和 Distributor.php
class Training_Distributor_Block_Adminhtml_Distributor
extends Mage_Adminhtml_Block_Widget_Grid_Container
{
/**
* my understanding:
* $this->_blockGroup . '/' . $this->_controller . '_grid'
* i.e. training_distributor/adminhtml_distributor_grid
*/
public function _construct()
{
$this->_blockGroup = 'training_distributor';
$this->_controller = 'adminhtml_distributor';
$this->_headerText = $this->__('List Distributors');
$this->_addButtonLabel = $this->__('Add Distributor');
parent::_construct();
}
}
为什么会出现此错误?
我看不到任何错字,我确信$ this-> _ blockGroup和$ this-> _ controller是正确的。
我还需要寻找其他东西吗?还是我错过了什么?
在google和stack上搜索后,我发现通常是_blockGroup或_controller的人,但对我而言似乎并非如此
===
编辑
===
<config>
<modules>
<Training_Distributor>
<version>0.0.2</version>
</Training_Distributor>
</modules>
<global>
<resources>
<training_distributor_setup>
<setup>
<module>Training_Distributor</module>
</setup>
</training_distributor_setup>
</resources>
<models>
<training_distributor>
<class>Training_Distributor_Model</class>
<resourceModel>training_distributor_resource</resourceModel>
</training_distributor>
<training_distributor_resource>
<class>Training_Distributor_Model_Resource</class>
<entities>
<distributor>
<table>training_distributor_entity</table>
</distributor>
</entities>
</training_distributor_resource>
</models>
<blocks>
<training_distributor>
<class>Training_Distributor_Block</class>
</training_distributor>
</blocks>
<helpers>
<training_distributor>
<class>Training_Distributor_Helper</class>
</training_distributor>
</helpers>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<training_distributor before="Mage_Adminhtml">Training_Distributor_Adminhtml</training_distributor>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<training_distributor>
<file>training/distributor.xml</file>
</training_distributor>
</updates>
</layout>
</adminhtml>
</config>
__construct
method代替_construct
。
config.xml
文件。