2017-07-03 77 views

回答

0

//打开下列文件。

app\design\frontend\base\default\template\persistent\customer\form\register.phtml 

评论如果条件或写出电话条件如下条件如下条件。

<?php if($this->getShowAddressFields()): ?> 

多个参考链路:https://magento.stackexchange.com/questions/110844/magento-1-9-how-to-display-telephone-on-registration-form

例如:

//写入下面的代码送出侧的if条件,然后尝试。

<div class="field"> 
        <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label> 
        <div class="input-box"> 
         <input type="text" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" /> 
        </div> 
       </div> 
+0

上面提到的这行代码出现在两个地方,你可以发布代码片段替换什么,因为我已经尝试了链接中提到的解决方案,它没有为我工作。 – csharpcoder

+0

谢谢,这有帮助,现在我可以看到在新帐户创建页面上的电话文本框,但我无法看到该信息存储在管理页面的任何地方,管理页面中的电话字段仍然是空白的,但我是也没有得到任何错误。如何将其存储在数据库中 – csharpcoder

+1

需要在控制器中进行调试。使用文件路径:app/code/core/Mage/Customer/controllers/AccountController.php检查此操作中的post参数(createPostAction)。您将在发布数据中找到电话参数。不要更改提交的名称。 –

0

你必须按照这个步骤给电话字段注册表格。

STEP 1你必须把下面的代码在您的自定义模块布局文件

<customer_account_create translate="label"> 
    <label>Customer Account Registration Form</label> 
    <remove name="right"/> 
    <remove name="left"/> 

    <reference name="root"> 
     <action method="setTemplate"><template>page/1column.phtml</template></action> 
    </reference> 
    <reference name="content"> 
     <block type="customer/form_register" name="customer_form_register" template="modulename/register.phtml"> 
      <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label"> 
       <label>Form Fields Before</label> 
      </block> 
     </block> 
    </reference> 
</customer_account_create> 

STEP 2在下面创建register.phtml文件路径应用程序/设计/前端/ THEME_NAME /缺省的/模板/模块名/ register.phtml

STEP 3拷贝到以下路径应用程序\的register.phtml文件设计\前台\基地\ DEFAULT \模板\执着\用户\表格\ register.phtml

STEP 4 relace是register.phtml文件到本地模块路径应用程序/设计/前端/ THEME_NAME /默认/模板/ modulename/

STEP 5检查下面的代码,并在if条件内放置true或者除去if条件。

<?php if($this->getShowAddressFields()): ?> 

STEP 6你可以看到在登记表的电话字段地址字段。