configuration - 在 Magento 中添加 Data.php Helper 出错

标签 configuration magento system helper

遵循自定义 Magento 系统配置中的 Alan Storm 教程,当我尝试添加

帮助文件夹中的 Data.php 我仍然收到此错误:

fatal error :在 E:\xampp\htdocs\magento 中找不到类“Mage_Helloworld_Helper_Data”
\app\Mage.php 在第 520 行

**Alanstormdotcom\Helloworld\Helper\Data.php**
<?php
class Alanstormdotcom_Helloworld_Helper_Data extends Mage_Core_Helper_Abstract
{
} 

**Alanstormdotcom\Helloworld\etc\system.xml**
<?xml version="1.0"?>
<config>    
    <tabs>
        <helloconfig translate="label" module="helloworld">
                <label>Hello Config</label>
                <sort_order>99999</sort_order>
        </helloconfig>  
    </tabs> 
</config>


**Alanstormdotcom\Helloworld\etc\config.xml**
<?xml version="1.0"?>
<config>    
    <modules>
        <Alanstormdotcom_Helloworld>
            <version>0.1.0</version>
        </Alanstormdotcom_Helloworld>
    </modules>
<frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>Alanstormdotcom_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>
    </frontend>
    <global>
      <helpers>
         <class>Alanstormdotcom_Helloworld_Helper</class>
      </helpers>    
    </global>
</config> 

我只是想学习..我知道这对你有用,但仍然帮我找到原因..我可能会错过

东西..谢谢。

最佳答案

这一点是错误的:

<global>
  <helpers>
     <class>Alanstormdotcom_Helloworld_Helper</class>
  </helpers>    
</global>

它应该是:
<global>
    <helpers>
        <helloworld>
            <class>Alanstormdotcom_Helloworld_Helper</class>
        </helloworld>
    </helpers>    
</global>

(<helloworld> 标签对应于上面的module="helloworld")

关于configuration - 在 Magento 中添加 Data.php Helper 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5038281/

相关文章:

heroku - 如何使用 Nuxt.JS 应用程序访问 Heroku 环境变量

java - 尝试在 Hadoop 中开始作业时出错

magento - 在 magento 中导入 csv 产品时出错

c++ - 如何在C++中并行执行系统命令

java - 如何跟踪系统时钟

linux - 递归禁用 CONFIG 对 linux 内核构建的依赖

spring - 当我尝试 Autowiring 时环境为空

paypal - Payflow Pro 不工作

php - 如何从 Magento 中删除意外创建的货件?

javascript - 如何在 JavaScript 中运行系统命令?