删除客户表单属性


Remove customer form attribute

我已经使用添加了自定义属性

$setup->addAttribute('customer','default_business',array(
      'type'               => 'int',
        'label'              => 'Default Business Address',
       'input'              => 'text',
       'backend'            => 'orancustomer/customer_attribute_backend_business',
        'required'           => false,
       'sort_order'         => 200,
      'visible'            => 0,
      'global' =>1,
        'user_defined' => 1,));

$attr = $eavConfig->getAttribute('customer', 'default_business');
$attr->setData(  'used_in_forms', array('customer_account_create', 'customer_account_edit', 'checkout_register')///*'adminhtml_customer',*/
)->save(); 

它如预期的那样工作。但当我试图删除它时,

$installer->removeAttribute('customer', 'default_business');

它已从eav_attribute表中成功删除。但在管理部分,我得到了以下错误致命错误:对D:''examplep''htdocs''magoran''app''code''core''Mage''Eav''Model''Entity''Collection''Abstract.php中的非对象调用成员函数getBackend(),位于第515行

当我尝试调试时,我发现它仍在搜索default_business属性。它仍在管理客户页面中搜索属性。这是我在调试时发现的查询

 SELECT `eav_attribute`.* FROM `eav_attribute` WHERE (`eav_attribute`.`attribute_code`='oran_company') AND (entity_type_id = :entity_type_id)
 BIND: array (
 ':entity_type_id' => '1', 
 )

我发现这是由于config.xml中的fieldset引起的。在我将其从自定义模块的config.xml的fieldset中删除后,错误得到了修复。此外,我还发现在fieldset中添加新添加的属性不是强制性的。