-1
我已經按照通常會解決這個問題的必要步驟:致命錯誤:類「Mage_Ibtheme_Helper_Data」在/var/www/html/app/Mage.php未發現行547
Magento Admin Helper_Data not found
但是我不斷得到類似的結果。我相信我已經成功實例化類和幫助數據。有人能告訴我我忽略了什麼嗎?另外,system.xml文件是否有問題?
UPDATE:這僅在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>
好吧,錯誤確實表明它不能在文件Mage.php中找到它,因爲你把它放在Data.php中。將它移到Mage.php,你就可以解決你的問題 – Tularis
Mage.php動態調用所有的幫助對象。有幾個Data.php文件 - 通常每擴展1個,每個主題1個等等。無論如何擴展了Magento的功能。 – sparecycle
請檢查分機是否啓用。 –