は、私はこのように私のMagentoのモジュールでカスタムテキストフィールドを追加することができます。カスタムチェックボックスフィールドを顧客にマジェンタで追加するにはどうすればよいですか? mysql4インストール-0.1.0.phpで
$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();
私もチェックボックスフィールドを追加します。私はこのようにそれを追加します。
$setup->addAttribute('customer', 'marketattended1', array(
'input' => 'checkbox',
'type' => 'int',
'label' => 'San Francisco International Gift Fair',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
));
$setup->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'marketattended1',
'999' //sort_order
);
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'marketattended1');
$oAttribute->setData('used_in_forms', array('adminhtml_customer','customer_account_create'));
$oAttribute->save();
私は管理者/顧客に私のチェックボックスフィールドを見ることができますが、私は新しい顧客を編集したり、追加しようとしているとき、それは顧客に保存されません。 「Please wait」インジケーターは永遠に表示されています。この仕事をするには?
* 編集
メンバ関数のsetAttribute()を呼び出し非オブジェクト
に私はこのエラーまたはサーバーの応答を発見しました。
* 編集
私は、インストーラのコードを変更:
$setup->addAttribute('customer', 'marketattended1', array(
'input' => 'boolean',
'type' => 'int',
'label' => 'San Francisco International Gift Fair',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
//'source' => 'eav/entity_attribute_source_boolean'
));
$setup->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'marketattended1',
'999' //sort_order
);
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'marketattended1');
$oAttribute->setData('used_in_forms', array('adminhtml_customer','customer_account_create'));
$oAttribute->save();
今私はイエスと選択コンポーネント見ることができます|オプションなし、その完璧に作業を。
<div class="field">
<label for="marketattended1">San Francisco International Gift Fair</label>
<select id="marketattended1" name="marketattended1" class=" select">
<option value="0">No</option>
<option value="1">Yes</option>
</select></div>
チェックボックスにしたいと思っています。私はこのようにしてみました:
<div class="field">
<input class="checkbox" id="marketattended1" onchange="[removed]changechecked()" type="checkbox" value="1" />
<label class="required">*Others</label >
</div>
しかしそれは保存されません。どのようにそれを保存するには?