【问题标题】:How to rewrite Mage_Adminhtml_Block_Customer_Edit __construct() method如何重写 Mage_Adminhtml_Block_Customer_Edit __construct() 方法
【发布时间】:2014-05-11 06:07:15
【问题描述】:

我在 Mage_Adminhtml_Block_Customer_Edit 中重写 __construct() 方法时遇到一些问题

我的config.xml如下:-

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Mymodule_Customisation>
            <version>0.0.1</version>
        </Mymodule_Customisation>
    </modules>

<global>
    <blocks>
     <customisation>
      <class>Mymodule_Customisation_Block</class>
     </customisation>
     <adminhtml>
       <rewrite>                   <Customer_Edit>Mymodule_Customisation_Block_Adminhtml_Customer_Edit</Customer_Edit>
                </rewrite>
     </adminhtml>
    </blocks>
  </global>
</config>

我在 app/code/local/Mymodule/Customisation/Block/Adminhtml/Customer/Edit.php 下得到了 Edit.php 方法

我的班级是这样的

    class Mymodule_Customisation_Block_Adminhtml_Customer_Edit extends Mage_Adminhtml_Block_Customer_Edit
    {
        public function __construct()
        {}
}

我做错了什么?

【问题讨论】:

    标签: php magento rewrite block extend


    【解决方案1】:

    Nabeel.Issue 是在 config.xml 文件中重写代码 &lt;Customer_Edit&gt; 应该是 &lt;customer_edit&gt;

    <rewrite> 
                  <customer_edit>Mymodule_Customisation_Block_Adminhtml_Customer_Edit</customer_edit>
     </rewrite>
    

    【讨论】:

    • 好吧,我的头撞到墙上了,我怎么能错过,让我检查一下是否有效!
    • 成功了!我发誓我一定已经检查过一百万次了,只是没有注意大写字母的位置。生活有时会很奇怪!谢谢阿米特,来自巴基斯坦的爱。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-12
    • 1970-01-01
    相关资源
    最近更新 更多