我是Magento的新手。我创建了一个帮助程序类
/app/etc/modules/Mytrends_MyFunctions.xml 文件:
<?xml version="1.0"?>
<config>
<modules>
<Mytrends_MyFunctions>
<active>true</active>
<codePool>local</codePool>
</Mytrends_MyFunctions>
</modules>
</config>
/app/code/local/Mytrends/MyFunctions/etc/config.xml :
<?xml version="1.0"?>
<config>
<modules>
<Mytrends_MyFunctions>
<version>1.0.0</version>
</Mytrends_MyFunctions>
</modules>
<global>
<helpers>
<myfunctions>
<class>Mytrends_MyFunctions_Helper</class>
</myfunctions>
</helpers>
</global>
</config>
/app/code/local/Mytrends/MyFunctions/Helper/Data.php :
<?php
class Mytrends_MyFunctions_Helper_Data extends Mage_Core_Helper_Abstract
{
public function test () {
echo 'hello';
}
}
?>
我试图像这样调用这个测试()
Mage::helper('myfunctions')->test();
但是我得到了一个致命的错误:
Fatal error: Class 'Mytrends_MyFunctions_Helper_Data' not found in /app/Mage.php on line 548
请帮忙。
你必须像这样调用帮助程序函数:
Mage::helper('mytrends/myfunctions')->test();
请尝试此。
请正确检查您的模块配置.xml文件路径。
这个文件不必正确命名:/app/etc/modules/config.xml
它应该是/app/etc/modules/Mytrends_MyFunctions.xml