【发布时间】:2014-08-12 09:01:26
【问题描述】:
我正在尝试覆盖自定义模块 adminhtml 块。该块是一个 adminhtml 选项卡/表单块。
如果我重写正确,我会从关联的 tabs.php 块中得到一个错误...在 beforeHtml() 函数中。
这是我认为可以很好地重写的代码:
<blocks>
<devaf>
<class>Dev_Affil_Block</class>
</devaf>
<affiliateplus>
<rewrite>
<adminhtml_account_edit_tab_form>
Dev_Affil_Block_Adminhtml_Account_Edit_Tab_Form
</adminhtml_account_edit_tab_form>
</rewrite>
</affiliateplus>
</blocks>
实际错误是:
20 3.5764 29562296 Mage_Core_Block_Abstract->toHtml( ) ..\List.php:43
21 3.5767 29562448 Magestore_Affiliateplus_Block_Adminhtml_Account_Edit_Tabs->_beforeToHtml( ) ..\Abstract.php:862
exception 'Mage_Core_Exception' with message 'Invalid block type: Dev_Affil_Block_Adminhtml_Account_Edit_Tab_Form
我相信错误是在这里引起的...尝试初始化块:
文件:Magestore_Affiliateplus_Block_Adminhtml_Account_Edit_Tabs
$this->addTab('general_section', array(
'label' => Mage::helper('affiliateplus')->__('General Information'),
'title' => Mage::helper('affiliateplus')->__('General Information'),
'content' => $this->getLayout()->createBlock('affiliateplus/adminhtml_account_edit_tab_form')->toHtml(),
));
我的自定义表单类,扩展了我试图覆盖/覆盖的类。
class Dev_Affil_Block_Adminhtml_Account_Edit_Tab_Form extends Magestore_Affiliateplus_Block_Adminhtml_Account_Edit_Tab_Form {
我也尝试过扩展通常的 Mage 类...这也没有用。
class Dev_Affil_Block_Adminhtml_Account_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
我在这个类中有一个调试 stmt,一旦我能得到那个 stmt 输出,我应该没问题。
任何人有任何想法/提示?
谢谢 S
【问题讨论】:
-
Dev_Affil_Block_Adminhtml_Account_Edit_Tab_Form扩展了哪个类?也许您也可以将该声明添加到您的问题中。
标签: php magento overriding block admin