0
我是一個magento的新手。我已經創建了一個自定義模塊,它應該將自定義字段添加到客戶註冊頁面。我已成功添加一個自定義字段給客戶,在編輯客戶或添加新客戶時,我可以在管理員/客戶中看到該字段。我怎樣才能讓它也顯示在註冊頁面上?如何在magento的註冊頁面顯示自定義字段?
這裏是我的模塊的安裝文件:
mysql4安裝-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$setup->addAttribute('customer', 'resale', array(
'input' => 'text',
'type' => 'varchar',
'label' => 'Resale number',
'visible' => 1,
'required' => 1,
'user_defined' => 1,
));
$setup->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'resale',
'999' //sort_order
);
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'resale');
$oAttribute->setData('used_in_forms', array('adminhtml_customer','customer_account_create'));
$oAttribute->save();
$installer->endSetup();
謝謝。
謝謝你,它的工作! – Joonas 2012-07-24 02:32:12