1

I have only one customer which is me. I tried to edit the name and I get redirected to the startpage of the backend and the error PHP Fatal error: Call to a member function setAttribute() on boolean in /srv/www/vhosts/hausfux/app/code/core/Mage/Eav/Model/Attribute/Data.php on line 80 is logged.

This is the line: $dataModel->setAttribute($attribute);

I logged $attribute and get this:

[_oldFieldsMap:protected] => Array
    (
    )

[_syncFieldsMap:protected] => Array
    (
    )

Im not sure what causes this error and how to solve it, please help.

2
  1. Please find customer_eav_attribute and note down all the attribute ids from this table.
  2. Then find the eav_attribute table and check all the attribute id from this table.
  3. Check the frontend_input column has not blank or null value of the attribute id which is got from the customer_eav_attribute table. 4.If any attribute has blank or null value for the column frontend_input then add any of the input type in their place.
  4. Then check the issue.
  • Thx for the hint, I think I located the problem. I logged the value of $attribute and it said "customattribute" for the attribute_code. This is an attribute code which I added through an extension. I think its install script is not working. I will investigate and report back. – Black Jan 23 at 17:42
  • Basically you wanted me to execute this SQL Statement: SELECT * FROM eav_attribute WHERE frontend_input is NULL AND attribute_id IN (SELECT attribute_id FROM customer_eav_attribute). This only returned customattribute, I deleted it, but now it is stuck in "Please wait"... if I try to edit a customer and save. I will investigate further. – Black Jan 24 at 9:10
  • I found the cause for this and created an answer. Thx for your help, you teached me something today sir – Black Jan 24 at 9:28
  • it's my pleasure, please accept if it is helpful – Rakesh Donga Jan 24 at 10:18
  • I will accept my own answer in two days since it contains all infos needed to solve it. – Black Jan 24 at 10:23
1

I was able to find out the cause of this error, it was quite hard to track.

I made a network analysis with chrome developer console and found out that there is a 500 status code in the request ?isAjax.

At first I logged the value of $attribute in the factory function:

app\code\core\Mage\Eav\Model\Attribute\Data.php

public static function factory(Mage_Eav_Model_Attribute $attribute, Mage_Core_Model_Abstract $entity)
{
    Mage::Log($attribute->getData('attribute_code'), 7, "eav.log");
    ...

This showed me the value customattribute so I knew something is wrong with it. So I found out that this is an old attribute which I added for test once. So I opened phpmyadmin and deleted this attribute from the table eav_attribute.

I found it there by searching the whole database by using phpmyadmins search:

enter image description here enter image description here

Now I tried to edit the customer again and save, but then the loading box with "please wait..." showed forever.

So I made the network analysis again and found out that isAjax gives status code 200 now. So now it must be another issue which is not caused by serverside code.

So I checked the response of that request and found out that it returned a json object which is fine. But there was also a error message attached just next to the json object, which is the reason why the json object was "corrupted" and so the javascript was unable to process successfully.

I immediately knew why this error was there. It was because I am using a debug code in the index.php which renders all magento errors. So I commented it out and now it works again:

//ini_set('error_reporting', E_ERROR);
//register_shutdown_function("fatal_handler");
//
//function fatal_handler() {
//    $error = error_get_last();
//    if ($error) {
//        echo("<pre>");
//        print_r($error);
//    }
//}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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