user2958356
user2958356

Reputation: 21

Magento Fatal Error when editing customer accounts

I have Magento 1.7.0.2 and when I try to edit a customer account in the admin panel i get this error: Fatal error: Call to a member function setRenderer() on a non-object in /home/techspec/public_html/magento/includes/src/Mage_Adminhtml_Block_Customer_Edit_Tab_Account.php on line 77

 $attributes = $customerForm->getAttributes();
    foreach ($attributes as $attribute) {
        /* @var $attribute Mage_Eav_Model_Entity_Attribute */
        $attribute->setFrontendLabel(Mage::helper('customer')->__($attribute->getFrontend()->getLabel()));
        $attribute->unsIsVisible();
    }

    $disableAutoGroupChangeAttributeName = 'disable_auto_group_change';
    $this->_setFieldset($attributes, $fieldset, array($disableAutoGroupChangeAttributeName));

    $form->getElement('group_id')->setRenderer($this->getLayout()
        ->createBlock('adminhtml/customer_edit_renderer_attribute_group')
        ->setDisableAutoGroupChangeAttribute($customerForm->getAttribute($disableAutoGroupChangeAttributeName))
        ->setDisableAutoGroupChangeAttributeValue($customer->getData($disableAutoGroupChangeAttributeName)));

    if ($customer->getId()) {
        $form->getElement('website_id')->setDisabled('disabled');
        $form->getElement('created_in')->setDisabled('disabled');
    } else {
        $fieldset->removeField('created_in');
        $form->getElement('website_id')->addClass('validate-website-has-store');

That is line 67 to 87 of the referenced file. Would love any help. Thanks.

Upvotes: 2

Views: 1368

Answers (1)

Marius
Marius

Reputation: 15216

looks like the attribute group_id is not in your list of editable attributes. Make sure the attribute is visible. Use this select to check.

SELECT * FROM `eav_attribute` e 
LEFT JOIN `customer_eav_attribute` ce ON e.attribute_id = ce.attribute_id 
WHERE e.attribute_code = 'group_id'

See the value of field is_visible.

If you don't get any result from the query above then you are in trouble.

If that is 1, maybe the attribute is not set to be shown in the admin form. Get the attribute_id returned by the previous query and do this. Let's say the value is 10.

select * from customer_form_attribute where attribute_id = 10;

If there is no record with form_code = adminhtml_customer then you should add it.

Upvotes: 5

Related Questions