0

mobileエンティティに属性を追加しようとしていますcustomer_address。フロントエンドからユーザーを作成すると、Magentoはこの属性値を保存しませんが、adminからユーザーを作成すると機能します。

これがコードスニペットです

$installer->addAttribute('customer_address','trading2_mobile',array(
    'type'               => 'varchar',
    'label'              => 'Mobile 2',
    'input'              => 'text',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'visible_on_front' => 1,
));

$trading2_mobile = Mage::getSingleton('eav/config')->getAttribute('customer_address', 'trading2_mobile');
$trading2_mobile->setData('used_in_forms',array('customer_register_address','customer_address_edit','adminhtml_customer_address'))->save();

フロントエンドコード

<div class="field">
  <label for="mobile2" class="required"><em>*</em><?php echo $this->__('Mobile 2') ?></label>
  <div class="input-box">
  <input type="text" name="mobile2" id="mobile2" value="<?php echo $this->htmlEscape($this->getFormData()->getTrading2Mobile()) ?>" title="<?php echo $this->__('Mobile 2') ?>" class="input-text required-entry" />
</div>
                    </div>
4

1 に答える 1

1

入力フィールドの名前とID(JS検証用)属性は「trading2_mobile」である必要があります。

<input type="text" name="trading2_mobile" id="trading2_mobile" value="<?php echo $this->htmlEscape($this->getFormData()->getTrading2Mobile()) ?>" title="<?php echo $this->__('Mobile 2') ?>" class="input-text required-entry" />
于 2012-07-17T08:03:35.393 に答える