网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > 代码交流
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

代码交流 ASP,PHP,JSP等网站源代码下载与交流。

Reply
 
Thread Tools Display Modes
  #1   IP: 218.2.66.237
Old 2010-10-26, 02:11 PM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default Fatal error: Call to a member function setAttribute() on a non-object in Magento

After upgrading with latest magento version, I came across with the following error when I opened my product to edit or even add new product from scratch. I was also unable to search any product/item on my store. Here is the error what I got:

Fatal error: Call to a member function setAttribute() on a non-object in E:\wamp\www\upgrade\app\code\core\Mage\Eav\Model\Entity\Attribute\Abstract.php

After a long time fighting with magento pawn I came through with following solution.
On /app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php
Line around 374, Find :

$this->_source = Mage::getModel($this->getSourceModel())

->setAttribute($this);

Replace with:

if(is_object(Mage::getModel($this->getSourceModel()))){

$this->_source = Mage::getModel($this->getSourceModel())

->setAttribute($this);

}

And open file: /app/code/core/Mage/Adminhtml/Block/Widget/Form.php

Line around 201/202:

Find:

$element->setValues($attribute->getSource()->getAllOptions(true, true));

Replace with:

if(is_object($attribute->getSource())){

$element->setValues($attribute->getSource()->getAllOptions(true, true));

}

And open file: /app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Abstract.php

Line around 142/144:

Find:

return $this->getAttribute()->getSource()->getAllOptions();

Replace with:

if(is_object($this->getAttribute()->getSource())){

return $this->getAttribute()->getSource()->getAllOptions();

}

Cheer up all done.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:11 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.