且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在magento 1.5中添加自定义注册字段

更新时间:2023-11-26 23:45:16

您还必须将新创建的属性的 attribute_id 注册到 customer_form_attribute ,因此Magento知道在哪里事情是:-)

You have also to register the attribute_id of new created attributes to the customer_form_attribute, so Magento knows where things are :-)

在这种情况下,您必须将其放入安装文件中:(示例来自借记付款模块)

In your case you have to put this in your setup file: (Example taken form the Debit Payment Module)

// Get Customer Type ID
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$eid = $read->fetchRow(
    "select entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code = 'customer'"
);
$customer_type_id = $eid['entity_type_id'];

// Save Attribute to the customer_form_attribute
$attribute = $eavConfig->getAttribute($customer_type_id, 'registration_number');

// Here is where you determine in wich areas of magento the attributes are used
$attribute->setData('used_in_forms', array('customer_account_edit', 'customer_account_create', 'adminhtml_customer'));
$attribute->save();

希望这会有所帮助:-)

Hope this helps :-)