Fatal error: Class 'Mage_Function_Helper_Data' not found in /app/Mage.php on line 547
Fatal error: Class 'Mage_Function_Helper_Data' not found in /app/Mage.php on line 547
我知道这个问题反复出现,但我没有解决,而且发生了一些奇怪的事情,代码在我的本地主机上运行完美,但在在线服务器上它抛出错误:
Fatal error: Class 'Mage_Function_Helper_Data' not found in /app/Mage.php on line 547
我的 local/Mycode/Function/Helper/Data.php
是:
<?php
class Mycode_Function_Helper_Data extends Mage_Core_Helper_Abstract{
public function PrintGridProducts($i, $_product, $pImg, $tempThis, $limit) {
return "";
}
我的 local/Mycode/Function/etc/config.xml
是:
<?xml version="1.0"?>
<config>
<modules>
<Mycode_Function>
<version>1.0.0</version>
</Mycode_Function>
</modules>
<global>
<helpers>
<function>
<class>Mycode_Function_Helper</class>
</function>
</helpers>
</global>
</config>
我对函数的调用:
<?php
echo Mage::helper('function')->PrintGridProducts($i, $_product, $pImg, $this, 28);
?>
有什么建议吗??谢谢!
线索在错误中 - Magento 正在尝试寻找法师助手而不是您的自定义助手。
首先,请确保您已在 /app/etc/modules/
中激活您的模块
<?xml version="1.0"?>
<config>
<modules>
<Mycode_Function>
<active>true</active>
<codePool>local</codePool>
</Mycode_Function>
</modules>
将您的配置 xml 更改为此;
<global>
<helpers>
<mycode_function>
<class>Mycode_Function_Helper</class>
</mycode_function>
</helpers>
</global>
将您的辅助函数更改为以小写字母开头 printGridProducts(
把你的电话改成这个;
<?php echo Mage::helper('mycode_function')->printGridProducts($i, $_product, $pImg, $this, 28); ?>
那么你的助手 class 有一个错误 - 你有 'returns' 应该是 'return'
我知道这个问题反复出现,但我没有解决,而且发生了一些奇怪的事情,代码在我的本地主机上运行完美,但在在线服务器上它抛出错误:
Fatal error: Class 'Mage_Function_Helper_Data' not found in /app/Mage.php on line 547
我的 local/Mycode/Function/Helper/Data.php
是:
<?php
class Mycode_Function_Helper_Data extends Mage_Core_Helper_Abstract{
public function PrintGridProducts($i, $_product, $pImg, $tempThis, $limit) {
return "";
}
我的 local/Mycode/Function/etc/config.xml
是:
<?xml version="1.0"?>
<config>
<modules>
<Mycode_Function>
<version>1.0.0</version>
</Mycode_Function>
</modules>
<global>
<helpers>
<function>
<class>Mycode_Function_Helper</class>
</function>
</helpers>
</global>
</config>
我对函数的调用:
<?php
echo Mage::helper('function')->PrintGridProducts($i, $_product, $pImg, $this, 28);
?>
有什么建议吗??谢谢!
线索在错误中 - Magento 正在尝试寻找法师助手而不是您的自定义助手。
首先,请确保您已在 /app/etc/modules/
中激活您的模块<?xml version="1.0"?>
<config>
<modules>
<Mycode_Function>
<active>true</active>
<codePool>local</codePool>
</Mycode_Function>
</modules>
将您的配置 xml 更改为此;
<global>
<helpers>
<mycode_function>
<class>Mycode_Function_Helper</class>
</mycode_function>
</helpers>
</global>
将您的辅助函数更改为以小写字母开头 printGridProducts(
把你的电话改成这个;
<?php echo Mage::helper('mycode_function')->printGridProducts($i, $_product, $pImg, $this, 28); ?>
那么你的助手 class 有一个错误 - 你有 'returns' 应该是 'return'