编辑客户帐户时Magento致命错误

时间:2013-11-05 23:02:45

标签: php mysql magento

我有Magento 1.7.0.2,当我尝试在管理面板中编辑客户帐户时,我收到此错误: 致命错误:在第77行的/home/techspec/public_html/magento/includes/src/Mage_Adminhtml_Block_Customer_Edit_Tab_Account.php中的非对象上调用成员函数setRenderer()

 $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');

这是引用文件的第67到87行。会喜欢任何帮助。谢谢。

1 个答案:

答案 0 :(得分:5)

看起来属性group_id不在您的可编辑属性列表中。确保该属性可见。使用此选项进行检查。

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

查看字段is_visible的值。

如果您没有从上述查询中获得任何结果,那么您就遇到了麻烦。

如果为1,则可能未将该属性设置为显示在管理表单中。获取上一个查询返回的attribute_id并执行此操作。假设值为10

select * from customer_form_attribute where attribute_id = 10;

如果没有form_code = adminhtml_customer的记录,那么您应该添加它。