【发布时间】:2014-02-17 22:29:33
【问题描述】:
我已按照通常可以解决此问题的必要步骤进行操作:
Magento Admin Helper_Data not found
但是我不断得到类似的结果。我相信我已经成功地实例化了类和助手数据。有人能告诉我我忽略了什么吗?还有,system.xml文件有问题吗?
更新:这仅发生在 view.phtml(产品详细信息页面)中,我认为对助手主题的引用是错误的:
$ibtheme = $this->helper('ibtheme');
错误:
Fatal error: Class ‘Mage_Ibtheme_Helper_Data’ not found in /var/www/html/app/Mage.php on line 547
数据.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>
【问题讨论】:
-
好吧,错误确实表明它在文件 Mage.php 中找不到它,因为您将它放在 Data.php 中。将其移至 Mage.php 即可解决您的问题
-
Mage.php 动态调用所有辅助对象。有几个 Data.php 文件 - 通常每个扩展 1 个,每个主题 1 个等。无论扩展 Magento 的功能。
-
请检查扩展是否启用。
标签: php magento fatal-error