升级到1.4.20版本,出现 Fatal error: Call to a member function setAttribute() on a non-object in 的错误,有些头痛,后来网上找到解决办法:
在app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php 第374行 将
$this->_source = Mage::getModel($this->getSourceModel())
->setAttribute($this);
改为:
if(is_object(Mage::getModel($this->getSourceModel()))){
$this->_source = Mage::getModel($this->getSourceModel())
->setAttribute($this);
}
然后再找到/app/code/core/Mage/Adminhtml/Block/Widget/Form.php 第201、202行将
$element->setValues($attribute->getSource()->getAllOptions(true, true));
改为:
if(is_object($attribute->getSource())){
$element->setValues($attribute->getSource()->getAllOptions(true, true));
}
到这里基本上问题会解决,如果还是不行请看原文,