我正在尝试重写Magento地址模型,但我对此感到疯狂。我的config.xml重写部分看起来像这个
<models>
<customer>
<rewrite>
<customer>MyNam_MyMod_Model_Customer</customer>
<address>MyNam_MyMod_Customer_Model_Address</address>
</rewrite>
</customer>
</models>
我的班级看起来像:
require_once 'Mage/Customer/Model/Address.php';
class MyNam_MyMod_Customer_Model_Address extends Mage_Customer_Model_Address
{
public function validate() {
parent::validate();
}
}
当我加载地址表单时,我收到以下错误:在/ var / www / magento / app / code / core / Mage / Customer / Block /中的非对象上调用成员函数getId()第53行的地址/ Edit.php
我注意到编辑区无法加载客户/地址模型
任何人都可以帮助我吗?
答案 0 :(得分:0)
我希望在课堂地址MyNam_MyMod_Customer_Model_Address
中,我应该 MyNam_MyMod_Model_Address
<models>
<customer>
<rewrite>
<customer>MyNam_MyMod_Model_Customer</customer>
<address>MyNam_MyMod_Model_Address</address>
</rewrite>
</customer>
</models>
请告诉我,如果您有任何问题......
答案 1 :(得分:0)
首先删除行require_once 'Mage/Customer/Model/Address.php';
您不需要这个,因为类是自动加载的。
其余代码看起来正确。你清除了var / cache文件夹了吗?