Php 删除客户表单属性
我已经使用添加了自定义属性Php 删除客户表单属性,php,attributes,magento-1.7,Php,Attributes,Magento 1.7,我已经使用添加了自定义属性 $setup->addAttribute('customer','default_business',array( 'type' => 'int', 'label' => 'Default Business Address', 'input' => 'text', 'backend' =&
$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_属性表中删除。但是在管理部分,我得到了以下错误
致命错误:在第515行的D:\xampp\htdocs\magoran\app\code\core\Mage\Eav\Model\Entity\Collection\Abstract.php中对非对象调用成员函数getBackend()
当我尝试调试时,我发现它仍在搜索默认的业务属性。它仍在“管理客户”页面中搜索该属性。这是我在调试期间找到的查询
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中的字段集造成的。在我从自定义模块的config.xml的fieldset中删除它之后,错误被修复了,我还发现在fieldset中添加新添加的属性不是强制性的