4

I have migrated a magento store from 1.5 to 1.9 on my local server.(First migrated 1.5 to 1.6.2 then 1.6.2 to 1.9.1)

Now whenever i try to edit or add a new product following fatal error occurs.

Images : Image type and information need to be specified for each store view.

Fatal error: Call to a member function setAttribute() on a non-object in /var/www/html/monster_19/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php on line 366

This error also occurs on 1.6.2 staging version. Tried database repair tool also but problem still persist . And i don't want to hack into core. Please give solution.

1
  • I have the exact same error, which extension did you have to upload to fix this?
    – evilscary
    Apr 12, 2016 at 14:35

2 Answers 2

8

Before trying anything, clear the cache. That might not help, but do it anyway.

The error is cause by this:

$this->_frontend = Mage::getModel($this->getFrontendModel())
            ->setAttribute($this);

this means Mage::getModel($this->getFrontendModel()) returns null (or false).
This can be caused by an attribute that has the field frontend_model set to something like [module]/something_here but the class [Namespace]_[Module]_Model_Something_Here does not exist.
You can identify the attribute by adding the following code above the line I mentioned:

$model = Mage::getModel($this->getFrontendModel());
if (!$model) {
    echo $this->getAttributeCode();exit;
}

You should see the attribute code in your page.
Then look in the eav_attribute table for this attribute and see if something is wrong with it. If you think the attribute is not needed anymore just delete it.

2
  • Thanks. I was an idiot...forgot to upload an existing extension. Working fine now. Jun 1, 2015 at 8:35
  • I have the same error, which page should I add the code you suggest to see the attribute code?
    – evilscary
    Apr 12, 2016 at 14:36
2
( ! ) Fatal error: Call to a member function setAttribute() on boolean in E:\wamp64\www\magento19_sampledata\app\code\core\Mage\Eav\Model\Entity\Attribute\Abstract.php on line 366

in my case,

it was due to, disabled local modules by <disable_local_modules>false</disable_local_modules>

after enabling the local modules, it works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.