0

私はマジェントの初心者です。カスタム フィールドを顧客登録ページに追加するカスタム モジュールを作成しました。顧客を編集または新規追加するときに、管理者/顧客に表示できるカスタム フィールドを顧客に 1 つ追加しました。登録ページにも表示するにはどうすればよいですか?

モジュールのインストールファイルは次のとおりです。

mysql4-install-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();

ありがとうございました。

4

1 に答える 1

1

次のように register.html にコードを追加する必要があります。

<div class="field">
  <label for="my_attribute" class="required"><em>*</em><?php echo $this->__('My Attribute') ?></label>
  <div class="input-box">
    <input type="text" name="my_attribute" id="my_attribute" value="<?php echo $this->htmlEscape($this->getFormData()->getMyAttribute()) ?>" title="<?php echo $this->__('My Attribute') ?>" class="input-text required-entry" />
  </div>
</div>
于 2012-07-23T11:35:43.623 に答える