开发者

Why is frontend of Magento site not loading up? - Fatal error: Class ‘Mage__Helper_Data’ not found

I’ve got an issue with the front end of a magento site, it is throwing a 500 error. The back end admin is absolutely fine and functional, I'm able to log in no problem and there is no loss of product data.

I have un-commented out line 70 in my index.php file -

#ini_set(\'display_errors\', 1);

in order to see the errors, and this is what now displays when you load up the front end of the site - Fatal error: Class \’Mage__Helper_Data\’ not found in /var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/Mage.php on line 520

I reckon the double underscore here is to do with a module being missing or something..

This problem came to light after I refreshed all cache types in the admin area, but I suspect the problem was there beforehand but just bared it’s head after the cache refresh.

So far I have tried/checked -

  • deleting the contents of var/cache, var/session

  • The base URL in the db is correct

  • made all directories 755 permissions, and all files 644, I have also tried making index.php 755, and 777 on suggestion from other forums.

  • checked htaccess, all seems fine.

  • the physical files are all there on the server.

  • system.log seems to be consistently pointing to line 93 in Autoload.php -

    2011-09-12T15:18:52+00:00 ERR (3): Warning: include() [<a href=\'function.include\'>function.include</a>]: Failed opening \'Mage//Helper/Data.php\' 开发者_StackOverflow中文版for inclusion (include_path=\'/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/code/local:/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/code/community:/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/code/core:/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/lib:.:\')  in /var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/lib/Varien/Autoload.php on line 93
    

Other things I can think of that I have recently done include adding google analytics through admin, altering the code for links at the top of the site in app\design\frontend\default\blue_toys\template\page\html\header.phtml and entering some paypal details in order to set up the payment gateway.

installation details - ver -1.5.0.1, Theme - custom installed theme

Can anyone help? thanks, Luke


Your error message shows two underscores between Mage and Helper, where there usually is only one of them. For me it looks like you lost a word between Mage and Helper somewhere, as usually Mage helper identifiers are s/t like Mage_Core_Helper_Data.

I'd check the <helpers> sections of my /etc/config.xml files for wrong definitions first.

Other than that I'd probably try to get a debug trace inside the Varien_Autoload::autoload method.

I'd lookout for patterns in the parameter $class which could result in s/t like Mage__Helper_Data, e.g. occurences where $class contains spaces or double underscores:

public function autoload($class)
{

    try {
        if (strpos($class, ' ') !== false || strpos($class, '__') !== false) {
            throw new Exception('fishy');
        }
    }
    catch (Exception $e) {
        var_dump($class, $e->getTraceAsString());
        die('stop');
    }

    // original method code starts here
    // :

}


I had a similar problem, and this question appeared in the Google results, so I thought it would be sensible to add an answer here for anyone else struggling with the same problem. With my issue, it was related to a custom <source_model> I was trying to use in the Magento configuration system.

I used the example code from Magento, which looks like this:

public function toOptionArray()
    {
        return array(
            array('value' => 0, 'label' => Mage::helper()->__('First item')),
            array('value' => 1, 'label' => Mage::helper()->__('Second item')),
            array('value' => 2, 'label' => Mage::helper()->__('third item'))
        );
    }

The error was coming from the Mage::helper() bit - no helper was being loaded. You can change it to this, or load a specific helper:

public function toOptionArray()
    {
        return array(
            array('value' => 0, 'label' => 'First item'),
            array('value' => 1, 'label' => 'Second item'),
            array('value' => 2, 'label' => 'third item')
        );
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜