Fatal error: Class ‘Mage_Ibtheme_Helper_Data’ not found in /var/www/html/app/Mage.php on line 547

StackOverflow https://stackoverflow.com/questions/21840586

  •  12-10-2022
  •  | 
  •  

Вопрос

I’ve followed the necessary steps that would normally resolve this issue:

Magento Admin Helper_Data not found

However I keep getting similar results. I believe I have successfully instantiated the class and helper data. Could someone tell me what I'm overlooking? Also, can the system.xml file be at fault?

UPDATE: This is only happening in view.phtml (Product Detail Page) and the reference to the helper theme is what I believe is at fault:

$ibtheme = $this->helper('ibtheme');

Error:

Fatal error: Class ‘Mage_Ibtheme_Helper_Data’ not found in /var/www/html/app/Mage.php on line 547

Data.php:

    <?php

/**
 * ItemBridge Theme Default Helper
 *
 * @category    ItemBridge
 * @package     ItemBridge_Theme
 * @copyright   Copyright (c) 2012 InfoStyle (http://infostyle.com.ua)
 * @license     http://themeforest.net/licenses/regular_extended ThemeForest Regular & Extended License
 */

class ItemBridge_Theme_Helper_Data extends Mage_Core_Helper_Abstract
{
    public function getProductClasses($product)
    {
        return " " . ($this->isNewProduct($product) ? 'new-product' : '') . " " . ($this->isSaleProduct($product) ? 'sale-product' : '') . " ";
    }

    public function isNewProduct($product)
    {
        $from = $product->getData('news_from_date');
        $to = $product->getData('news_to_date');
        $now = date("Y-m-d 00:00:00");

        return ($from && $to && $now >= $from && $now <= $to) || ($from && $now >= $from) || ($to && $now <= $to);
    }

    public function isSaleProduct($product)
    {
        return number_format($product->getFinalPrice(), 2) != number_format($product->getPrice(), 2);
    }

    public function hex2rgb($hex) {
       $hex = str_replace("#", "", $hex);

       if(strlen($hex) == 3) {
          $r = hexdec(substr($hex,0,1).substr($hex,0,1));
          $g = hexdec(substr($hex,1,1).substr($hex,1,1));
          $b = hexdec(substr($hex,2,1).substr($hex,2,1));
       } else {
          $r = hexdec(substr($hex,0,2));
          $g = hexdec(substr($hex,2,2));
          $b = hexdec(substr($hex,4,2));
       }
       $rgb = array($r, $g, $b);

       return $rgb;
    }
}

config.xml:

    <?xml version="1.0"?>
<!--
 * @category    ItemBridge
 * @package     ItemBridge_Theme
 * @copyright   Copyright (c) 2012 InfoStyle (http://infostyle.com.ua)
 * @license     http://themeforest.net/licenses/regular_extended ThemeForest Regular & Extended License
-->
<config>
    <modules>
        <ItemBridge_Theme>
            <version>0.1</version>
        </ItemBridge_Theme>
    </modules>

    <global>
        <blocks>
            <ibtheme>
                <class>ItemBridge_Theme_Block</class>
            </ibtheme>
        </blocks>

        <helpers>
            <ibtheme>
                <class>ItemBridge_Theme_Helper</class>
            </ibtheme>
        </helpers>
    </global>

    <default>
        <ib_theme_design>
            <general>
                <store_color>#fdf651</store_color>
                <store_pattern>bg.png</store_pattern>
                <store_layout>standart</store_layout>
                <store_footer>white</store_footer>
                <store_productGrid>type1</store_productGrid>
                <store_OptionsPanel>no</store_OptionsPanel>
            </general>
        </ib_theme_design>
    </default>

    <adminhtml>
        <acl>
            <resources>
                <admin>
                    <children>
                        <system>
                            <children>
                                <config>
                                    <children>
                                        <ib_theme_design>
                                            <title>ItemBridge Design</title>
                                        </ib_theme_design>
                                    </children>
                                </config>
                            </children>
                        </system>
                    </children>
                </admin>
            </resources>
        </acl>
    </adminhtml>
</config>
Это было полезно?

Решение

Your config.xml has some spaces at the beginning before <?xml version="1.0"?>.
Most probably this makes it invalid and is not loaded in the full configuration of Magento.
Remove the spaces, and make sure the xml is valid. Clear the cache when you are done.

Small tip for the future: Always develop with error reporting and display errors on. Also setting the developer mode on could help a lot in finding these issues.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top