您的位置:首页 > 移动开发 > Objective-C

Fatal error: Call to a member function getSource() on a non-object in G:\wamp\www\ChinaMagicCube\ap

2013-09-29 11:10 603 查看
出现的错误:

  当点击商品,进入商品详细页面时出现如下错误:



解决方法:

找到错误所在的地方

public function getAttributeText($attributeCode)
{
return $this->getResource()
->getAttribute($attributeCode)
->getSource()
->getOptionText($this->getData($attributeCode));
}


替换为:

public function getAttributeText($attributeCode)
{
if ($attribute = $this->getResource()->getAttribute($attributeCode)) {
return
$attribute->getSource()
->getOptionText($this->getData($attributeCode));
} else {
//Mage::log(\'attributes-errors.log\',$attributeCode);
return false;
}
}


即可。

或者参考下这里:http://www.magentocommerce.com/boards/viewthread/53871/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Magento function
相关文章推荐