在Magento 1.9中向注册表单添加其他字段

Don*_*one 3 magento

我正在使用本教程在注册表格中添加Magento 1.9中的其他字段:http://www.fontis.com.au/blog/magento/know-more-about-your-customers-adding-custom-signup-attributes

但不幸的是它不起作用.我是Magento的新手,需要一些帮助.我将非常感谢如何创建新模块的分步说明,以便能够在当前注册表格Magento 1.9中添加此附加字段.

Jam*_* H. 16

好的,我刚刚做到了,这是怎么回事.访问http://www.silksoftware.com/magento-module-creator/并使用其Module Creator创建一个名为"YourCustomerAttribute"的新模块.

  1. 将"添加客户属性"设置为YES
  2. 根据需要进行适当的输入和选择.
  3. 确保选择您需要使用的新属性的表单.
  4. 生成模块.
  5. 将模块上传到Magento文件夹.
  6. 修改位于app/design/frontend/base/default/template/persistent/customer/form/register.phtml并添加:

     <div class="input-box">
     <label for="YourAttributeName"><?php echo $this->__('YourAttributeName') ?><span class="required">*</span></label><br />
     <input type="text" name="YourAttributeName" id="YourAttributeID" value="<?php echo $this->htmlEscape($this->getFormData()->getYourAttributeName()) ?>" title="<?php echo $this->__('YourAttributeName') ?>" class="required-entry input-text" />
    </div>
    
    Run Code Online (Sandbox Code Playgroud)
  7. 如果您希望客户能够修改客户面板中的属性,请修改app/design/frontend/base/default/template/customer/form/edit.phtm并添加:

    <li>
        <label for="YourAttributeName" class="required"><em>*</em><?php echo $this->__('YourAttributeName') ?></label>
        <div class="input-box">
            <input type="text" name="YourAttributeName" id="YourAttributeID" value="<?php echo $this->escapeHtml($this->getCustomer()->getYourAttributeName()) ?>" title="<?php echo $this->__('YourAttributeName') ?>" class="input-text required-entry" />
        </div>
    </li>
    
    Run Code Online (Sandbox Code Playgroud)
  8. 刷新所有缓存.

  • 这是http://magento.stackexchange.com/a/45622/7857的重复内容 (2认同)