2015-06-11 150 views
-2

我想編輯我的opencart頁面註冊過程的register.tpl文件。 我只想保留電子郵件,密碼和確認密碼字段。當我刪除所有其他字段,包括名字,姓氏,地址等,只留下電子郵件,密碼和確認密碼字段,它會停止註冊。我怎樣才能讓它繼續只有3個字段的註冊,並同意我必須保留的條款複選框。opencart的註冊頁面

這是register.tpl文件

<div id="content"><?php echo $content_top; ?> 

     <h1><?php echo $heading_title; ?></h1> 
     <p><?php echo $text_account_already; ?></p> 
     <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data"> 
     <h2><?php echo $text_your_details; ?></h2> 
     <div class="content"> 
      <table class="form"> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_firstname; ?></td> 
       <td><input class="form-control" type="text" name="firstname" value="<?php echo $firstname; ?>" /> 
       <?php if ($error_firstname) { ?> 
       <span class="error"><?php echo $error_firstname; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_lastname; ?></td> 
       <td><input class="form-control" type="text" name="lastname" value="<?php echo $lastname; ?>" /> 
       <?php if ($error_lastname) { ?> 
       <span class="error"><?php echo $error_lastname; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_email; ?></td> 
       <td><input class="form-control" type="text" name="email" value="<?php echo $email; ?>" /> 
       <?php if ($error_email) { ?> 
       <span class="error"><?php echo $error_email; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_telephone; ?></td> 
       <td><input class="form-control" type="text" name="telephone" value="<?php echo $telephone; ?>" /> 
       <?php if ($error_telephone) { ?> 
       <span class="error"><?php echo $error_telephone; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><?php echo $entry_fax; ?></td> 
       <td><input class="form-control" type="text" name="fax" value="<?php echo $fax; ?>" /></td> 
      </tr> 
      </table> 
     </div> 
     <h2><?php echo $text_your_address; ?></h2> 
     <div class="content"> 
      <table class="form"> 
      <tr> 
       <td><?php echo $entry_company; ?></td> 
       <td><input class="form-control" type="text" name="company" value="<?php echo $company; ?>" /></td> 
      </tr>   
      <tr style="display: <?php echo (count($customer_groups) > 1 ? 'table-row' : 'none'); ?>;"> 
       <td><?php echo $entry_customer_group; ?></td> 
       <td><?php foreach ($customer_groups as $customer_group) { ?> 
       <?php if ($customer_group['customer_group_id'] == $customer_group_id) { ?> 
       <input type="radio" name="customer_group_id" value="<?php echo $customer_group['customer_group_id']; ?>" id="customer_group_id<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> 
       <label for="customer_group_id<?php echo $customer_group['customer_group_id']; ?>"><?php echo $customer_group['name']; ?></label> 
       <br /> 
       <?php } else { ?> 
       <input type="radio" name="customer_group_id" value="<?php echo $customer_group['customer_group_id']; ?>" id="customer_group_id<?php echo $customer_group['customer_group_id']; ?>" /> 
       <label for="customer_group_id<?php echo $customer_group['customer_group_id']; ?>"><?php echo $customer_group['name']; ?></label> 
       <br /> 
       <?php } ?> 
       <?php } ?></td> 
      </tr>  
      <tr id="company-id-display"> 
       <td><span id="company-id-required" class="required">*</span> <?php echo $entry_company_id; ?></td> 
       <td><input class="form-control" type="text" name="company_id" value="<?php echo $company_id; ?>" /> 
       <?php if ($error_company_id) { ?> 
       <span class="error"><?php echo $error_company_id; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr id="tax-id-display"> 
       <td><span id="tax-id-required" class="required">*</span> <?php echo $entry_tax_id; ?></td> 
       <td><input class="form-control" type="text" name="tax_id" value="<?php echo $tax_id; ?>" /> 
       <?php if ($error_tax_id) { ?> 
       <span class="error"><?php echo $error_tax_id; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_address_1; ?></td> 
       <td><input class="form-control" type="text" name="address_1" value="<?php echo $address_1; ?>" /> 
       <?php if ($error_address_1) { ?> 
       <span class="error"><?php echo $error_address_1; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><?php echo $entry_address_2; ?></td> 
       <td><input class="form-control" type="text" name="address_2" value="<?php echo $address_2; ?>" /></td> 
      </tr> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_city; ?></td> 
       <td><input class="form-control" type="text" name="city" value="<?php echo $city; ?>" /> 
       <?php if ($error_city) { ?> 
       <span class="error"><?php echo $error_city; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><span id="postcode-required" class="required">*</span> <?php echo $entry_postcode; ?></td> 
       <td><input class="form-control" type="text" name="postcode" value="<?php echo $postcode; ?>" /> 
       <?php if ($error_postcode) { ?> 
       <span class="error"><?php echo $error_postcode; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_country; ?></td> 
       <td><select class="form-control" name="country_id"> 
        <option value=""><?php echo $text_select; ?></option> 
        <?php foreach ($countries as $country) { ?> 
        <?php if ($country['country_id'] == $country_id) { ?> 
        <option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option> 
        <?php } else { ?> 
        <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option> 
        <?php } ?> 
        <?php } ?> 
       </select> 
       <?php if ($error_country) { ?> 
       <span class="error"><?php echo $error_country; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_zone; ?></td> 
       <td><select class="form-control" name="zone_id"> 
       </select> 
       <?php if ($error_zone) { ?> 
       <span class="error"><?php echo $error_zone; ?></span> 
       <?php } ?></td> 
      </tr> 
      </table> 
     </div> 
     <h2><?php echo $text_your_password; ?></h2> 
     <div class="content"> 
      <table class="form"> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_password; ?></td> 
       <td><input class="form-control" type="password" name="password" value="<?php echo $password; ?>" /> 
       <?php if ($error_password) { ?> 
       <span class="error"><?php echo $error_password; ?></span> 
       <?php } ?></td> 
      </tr> 
      <tr> 
       <td><span class="required">*</span> <?php echo $entry_confirm; ?></td> 
       <td><input class="form-control" type="password" name="confirm" value="<?php echo $confirm; ?>" /> 
       <?php if ($error_confirm) { ?> 
       <span class="error"><?php echo $error_confirm; ?></span> 
       <?php } ?></td> 
      </tr> 
      </table> 
     </div> 
     <h2><?php echo $text_newsletter; ?></h2> 
     <div class="content"> 
      <table class="form"> 
      <tr> 
       <td><?php echo $entry_newsletter; ?></td> 
       <td><?php if ($newsletter) { ?> 
       <input type="radio" name="newsletter" value="1" checked="checked" /> 
       <?php echo $text_yes; ?> 
       <input type="radio" name="newsletter" value="0" /> 
       <?php echo $text_no; ?> 
       <?php } else { ?> 
       <input type="radio" name="newsletter" value="1" /> 
       <?php echo $text_yes; ?> 
       <input type="radio" name="newsletter" value="0" checked="checked" /> 
       <?php echo $text_no; ?> 
       <?php } ?></td> 
      </tr> 
      </table> 
     </div> 
     <?php if ($text_agree) { ?> 
     <div class="buttons"> 
      <div class="right"><?php echo $text_agree; ?> 
      <?php if ($agree) { ?> 
      <input type="checkbox" name="agree" value="1" checked="checked" /> 
      <?php } else { ?> 
      <input type="checkbox" name="agree" value="1" /> 
      <?php } ?> 
      <input type="submit" value="<?php echo $button_continue; ?>" class="button" /> 
      </div> 
     </div> 
     <?php } else { ?> 
     <div class="buttons"> 
      <div class="right"> 
      <input type="submit" value="<?php echo $button_continue; ?>" class="button" /> 
      </div> 
     </div> 
     <?php } ?> 
     </form> 
     <?php echo $content_bottom; ?></div> 

回答

1

轉到目錄/控制器/帳戶/ register.php(控制器)並進入功能驗證()。刪除不必要的字段。然後從您的tpl中刪除字段。這樣,您將只能進行三個字段。

+0

先生您能否請您告訴我如何調用register.tpl如<?php echo $ register?>在頭文件中調用,如opencart頭文件中的其他文件稱爲<?php echo $ header?>和上述問題解決了。 – sandal

+0

您必須將此代碼寫入您的標頭控制器。 '$ data ['register'] = $ this-> load-> controller('account/register);' 這會自動調用您的報頭控制器中的寄存器控制器。例如,您也可以看到admin/controller/common/dashboard.php。 –

+0

如果你覺得這個答案有幫助,請投票:) –