有时 Magento用于 辅助类 来检索 帮助信息 等 网址, 名称,组 等,所以 你 必须要覆盖 辅助类 当你 想改变任何 网址或 一些 别的东西 。 辅助类 覆盖 类似于 块和 模型 覆盖。 在这里, 我 用实例 说明 有关 辅助 覆盖 的细节。 在这里, 我将展示 如何覆盖 辅助类 Mage_Customer_Helper_Data 。
1.首先创建 新的模块 吨 处理 下面的代码 重写 工作,并 写在 app/etc/modules/Yt_Customer.xml
<?xml version="1.0"?>
<config>
<modules>
<Yt_Customer>
<active>true</active>
<codePool>local</codePool>
</Yt_Customer>
</modules>
</config>
2。 做好 app/code/local/Yt/Customer/etc/config.xml 配置
<?xml version="1.0"?>
<config>
<modules>
<Yt_Customer>
<version>0.1.0</version>
</Yt_Customer>
</modules>
<global>
<helpers>
<customer>
<rewrite>
<data>Yt_Customer_Model_Customer</data>
</rewrite>
</customer>
</helpers>
</global>
</config>
3。
现在, 写 你的新helper 类 Yt_Customer_Helper_Data 和 定义所有其他 覆盖方法
class Yt_Customer_Helper_Data extends Mage_Customer_Helper_Data
{
// override existing method
* Retrieve customer register form post url
public function getRegisterPostUrl()
{
return $this->_getUrl('customer/account/create2')
}
//write new function
public function getRegisterPostUrl2()
{
return $this->_getUrl('customer/account/createpost');
}
}
我觉得 谁是 熟悉的 理论 与Magento 覆盖 , 覆盖 是 帮助 他们 容易