2017-07-03 78 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你可以看到在登記表的電話字段地址字段。