2

I keep getting this message when I try to go to a user profile page in the frontend. Can someone help me find a solution. I'm very new to Magento.

Fatal error: Class 'Mage_Profile_Helper_Data' not found in /home/.../public_html/store/app/Mage.php on line 546

Also, I believe this was working recently but I have only made some css changes to the theme so not sure how I could have broken this.

I have also recompiled and disabled compilation from the admin panel.

Update:

I found this in Data.php:

class MYSITE_Profile_Helper_Data extends Mage_Core_Helper_Abstract{

    public function getProfilesUrl(){
        return Mage::getUrl('profile/profile/index');
    }
}

And I found this in app/etc/modules/MYSITE_Profile.xml

<config>
<modules>
    <MYSITE_Profile>
        <active>true</active>
        <codePool>local</codePool>
        <depends>
            <Mage_Core />
        </depends>
    </MYSITE_Profile>
</modules>
</config>
4

3 回答 3

4

在这种情况下,您正在处理自定义模块,因为没有Mage_Profile模块。通常,“缺少数据助手”问题是模块开发人员指定翻译字符串但未能提供适当类的结果。

当 Magento 被要求通过其工厂方法实例化一个帮助程序(或块或模型)类时,它接受参数(profile在本例中)并尝试将其解析为特定的 Xpath 节点。如果应用程序没有找到这个节点,它会假设参数是核心的一部分,所以会前置mage_,添加类类型 ( helper),并附加类 id(对于助手来说是data)。具体见Mage_Core_Model_Config::getGroupedClassName()

您需要在 、 和 中搜索 XML 文件以查找app/code/community/字符串app/code/local/app/design/frontend/包括"profile"双引号)。这是此问题最常见的载体。

也可以通过几个工厂方法来实例化助手(不幸的是)。这些很可能通过 grepping.php.phtml文件的字符串('profile')('profile/data').

最终,您正在寻找一个自定义模块,您需要在其中profile为助手配置类组。这将在例如The/Module/etc/config.xml,您将创建/添加的内容如下:

<global>
    <helpers>
        <profile><!-- class group -->
            <class>The_Module_Helper</class><!-- class prefix -->
        </profile>
    </helpers>
</global>

然后你只需要定义The_Module_Helper_Data类如下(例如The/Module/Helper/Data.php

<?php
class The_Module_Helper_Data extends Mage_Core_Helper_Abstract
{
}

完成此操作后,您的应用程序应该可以工作,并且您应该限制原始开发人员:-)

于 2013-09-06T16:31:17.197 回答
2

您应该在配置文件模块的 helper 文件夹中创建一个名为 data.php 的文件。这就是为什么你应该总是在你的扩展中包含数据助手。所以下面的代码在你app/code/local/MYSITE/Helper/Data.php

class Mage_Profile_Helper_Data extends Mage_Core_Helper_Abstract
{

}

<global>
    <helpers>
        <profile>
            <class>MYSITE_Profile_Helper</class>
        </profile>
    </helpers>
</global>

在你的app/code/local/MYSITE/Profile/etc/config.xml应该足够了。

于 2013-09-06T15:52:26.350 回答
0

此错误是由 autoloader.php 文件引起的。要解决它,请不要在文件名中的任何地方使用“_”,特别是在 config.xml 中,因为它将被“/”替换并引发此类错误。

例如:giftcard_confirm.html

安装使用:giftcardconfirm.html

于 2014-06-03T07:20:35.853 回答