我已经按照通常会解决此问题的必要步骤进行操作:
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
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>
答案 0 :(得分:1)
config.xml
之前<?xml version="1.0"?>
的开头有一些空格
很可能这使得它无效并且没有加载到Magento的完整配置中
删除空格,并确保xml有效。完成后清除缓存。
未来的小提示:始终使用错误报告和显示错误进行开发。同时设置开发人员模式可以帮助我们找到这些问题。