2013-05-17 71 views
-1

我使用opencart 1.5.1主題crista_blue根據其網站與opencart 1.5.1兼容。Opencart註冊頁面狀態/區域下拉不加載

一個非常類似的問題在這裏問:-SOLVED- Opencart can't load Region/State dropdown但得到的答覆也說 -

在控制器catalog/controller/account/register.php沒有這樣叫zone的動作,因此服務器返回404響應,沒有區域被加載」。

我的enroll.php文件確實有一個zone的操作。這使我認爲這個問題具有不同的性質。

另外兩個人建立了這個網站,不再維護它。乍看起來,他們使用的帳戶創建默認register.tpl/register.php但後來決定改變的歡迎頁面,「註冊」鏈接可查看enroll.php/enroll.tpl

這是網站https://www.mybaysix.com/。如果單擊底部的註冊鏈接你被帶到這裏的地區/國家下拉列表顯示,但爲空的形式。如果碰到繼續頁顯示的必填字段的錯誤信息,以及地區/國家下拉框中現在加載選項。

這裏是enroll.tpl文件:

<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?> 
<div id="content"><?php echo $content_top; ?> 
<div class="breadcrumb"> 
<?php foreach ($breadcrumbs as $breadcrumb) { ?> 
<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a> 
<?php } ?> 
</div> 
<h1><?php echo $heading_title; ?></h1> 
<?php if ($error_warning) { ?> 
<div class="warning"><?php echo $error_warning; ?></div> 
<?php } ?> 
<p><?php echo $text_buyer_information; ?></p> 
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="register"> 


<!-- Company info --> 
<h2><?php echo $text_your_address; ?> </h2> 
<div class="content"> 
    <table class="form"> 
    <tr> 
     <td><span class="required">*</span> <?php echo $entry_company; ?></td> 
     <td><input type="text" name="company" value="<?php echo $company; ?>" /> 
     <?php if ($error_company) { ?> 
     <span class="error"><?php echo $error_company; ?></span> 
     <?php } ?></td> 
    </tr> 

    <tr> 
     <td><span class="required">*</span> <?php echo $entry_federal_tax; ?></td> 
     <td><input type="text" name="federal_tax" value="<?php echo $federal_tax; ?>" /> 
     <?php if ($error_federal_tax) { ?> 
     <span class="error"><?php echo $error_federal_tax; ?></span> 
     <?php } ?></td> 
    </tr> 
    <tr> 
     <td><span class="required">*</span> <?php echo $entry_dba; ?></td> 
     <td><input type="text" name="dba" value="<?php echo $dba; ?>" /> 
     <?php if ($error_dba) { ?> 
     <span class="error"><?php echo $error_dba; ?></span> 
     <?php } ?></td> 
    </tr> 
    <tr> 
     <td><span class="required">*</span> <?php echo $entry_state_resale; ?></td> 
     <td><input type="text" name="state_resale" value="<?php echo $state_resale; ?>" /> 
     <?php if ($error_state_resale) { ?> 
     <span class="error"><?php echo $error_state_resale; ?></span> 
     <?php } ?></td> 
    </tr> 

    <tr> 
     <td> <?php echo $entry_store_website; ?></td> 
     <td><input type="text" name="store_website" value="<?php echo $store_website; ?>" /></td> 
    </tr> 


    <tr> 
     <td><span class="required">*</span> <?php echo $entry_address_1; ?></td> 
     <td><input 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 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 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 class="required">*</span> <?php echo $entry_postcode; ?></td> 
     <td><input 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 name="country_id" onchange="$('select[name=\'zone_id\']').load('index.php?route=account/register/zone&country_id=' + this.value + '&zone_id=<?php echo $zone_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 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 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 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_buyer_information; ?></h2> 
<div class="content"> 
    <table class="form"> 
    <tr> 
     <td><span class="required">*</span> <?php echo $entry_firstname; ?></td> 
     <td><input 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 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 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 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 type="text" name="fax" value="<?php echo $fax; ?>" /></td> 
    </tr> 
    </table> 
</div> 

<h2><?php echo $text_owner_information; ?></h2> 
<div class="content"> 
    <table class="form"> 
    <tr> 
     <td><?php echo $entry_owner_fname; ?></td> 
     <td><input type="text" name="owner_fname" value="<?php echo $owner_fname; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_owner_lname; ?></td> 
     <td><input type="text" name="owner_lname" value="<?php echo $owner_lname; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_owner_phone; ?></td> 
     <td><input type="text" name="owner_phone" value="<?php echo $owner_phone; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_owner_fax; ?></td> 
     <td><input type="text" name="owner_fax" value="<?php echo $owner_fax; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_owner_email; ?></td> 
     <td><input type="text" name="owner_email" value="<?php echo $owner_email; ?>" /></td> 
    </tr> 
    </table> 
</div> 

<h2><?php echo $text_manager_information; ?></h2> 
<div class="content"> 
    <table class="form"> 
    <tr> 
     <td><?php echo $entry_manager_fname; ?></td> 
     <td><input type="text" name="manager_fname" value="<?php echo $manager_fname; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_manager_lname; ?></td> 
     <td><input type="text" name="manager_lname" value="<?php echo $manager_lname; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_manager_phone; ?></td> 
     <td><input type="text" name="manager_phone" value="<?php echo $manager_phone; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_manager_fax; ?></td> 
     <td><input type="text" name="manager_fax" value="<?php echo $manager_fax; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_manager_email; ?></td> 
     <td><input type="text" name="manager_email" value="<?php echo $manager_email; ?>" /></td> 
    </tr> 
    </table> 
</div> 

<h2><?php echo $text_other_information; ?></h2> 
<div class="content"> 
    <table class="form"> 
    <tr> 
     <td><?php echo $entry_other_fname; ?></td> 
     <td><input type="text" name="other_fname" value="<?php echo $other_fname; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_other_lname; ?></td> 
     <td><input type="text" name="other_lname" value="<?php echo $other_lname; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_other_phone; ?></td> 
     <td><input type="text" name="other_phone" value="<?php echo $other_phone; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_other_fax; ?></td> 
     <td><input type="text" name="other_fax" value="<?php echo $other_fax; ?>" /></td> 
    </tr> 
    <tr> 
     <td><?php echo $entry_other_email; ?></td> 
     <td><input type="text" name="other_email" value="<?php echo $other_email; ?>" /></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 == 1) { ?> 
     <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 } ?> 
    <a onclick="$('#register').submit();" class="button"><span><?php echo $button_continue; ?></span></a></div> 
</div> 
<?php } else { ?> 
<div class="buttons"> 
    <div class="right"><a onclick="$('#register').submit();" class="button"><span><?php echo $button_continue; ?></span></a></div> 
</div> 
<?php } ?> 
</form> 
<?php echo $content_bottom; ?></div> 
<script type="text/javascript"><!-- 
$('select[name=\'zone_id\']').load('index.php?route=account/register/zone&country_id=<?php echo $country_id; ?>&zone_id=<?php echo $zone_id; ?>'); 
//--></script> 
<script type="text/javascript"><!-- 
$('.fancybox').fancybox({ 
width: 560, 
height: 560, 
autoDimensions: false 
}); 
//--></script> 
<?php echo $footer; ?> 

這是在enroll.php底部zone功能:

public function zone() { 
    $output = '<option value="">' . $this->language->get('text_select') . '</option>'; 

    $this->load->model('localisation/zone'); 

    $results = $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']); 

    foreach ($results as $result) { 
     $output .= '<option value="' . $result['zone_id'] . '"'; 

     if (isset($this->request->get['zone_id']) && ($this->request->get['zone_id'] == $result['zone_id'])) { 
      $output .= ' selected="selected"'; 
     } 

     $output .= '>' . $result['name'] . '</option>'; 
    } 

    if (!$results) { 
     $output .= '<option value="0">' . $this->language->get('text_none') . '</option>'; 
    } 

    $this->response->setOutput($output); 
} 

我之前,所以如果有任何詳細信息,從來沒有使用過該Opencart的將幫助找出問題。

編輯:我嘗試下面shadyyx的第一個答案,這是結果。

我改變了.load('index.php?route=account/enroll/zone&country_id=<?php echo $country_id; ?>&zone_id=<?php echo $zone_id; ?>');

我也試圖與完整路徑/catalog/controller/account/enroll/。下拉菜單仍未填充。當我繼續打什麼也沒有填寫出現在頂部Notice: Undefined index: zone_id in /home/mybaysix/public_html/catalog/controller/account/enroll.php on line 551

線551 enroll.php錯誤是if ($this->request->post['zone_id'] == '') { $this->error['zone'] = $this->language->get('error_zone'); }

+0

[-SOLVED-Opencart無法加載區域/狀態下拉]的可能重複(http://stackoverflow.com/questions/15801126/solved-opencart-cant-load-region-state-dropdown) – shadyyx

回答

2

首先,歡迎堆棧溢出!

enroll.php也許確實有zone()功能,但在你的HTML的JavaScript,你在呼喚:

<script type="text/javascript"><!-- 
    $('select[name=\'zone_id\']').load('index.php?route=account/register/zone&country_id=<?php echo $country_id; ?>&zone_id=<?php echo $zone_id; ?>'); 
//--></script> 

因此你要加載/catalog/controller/account/register.php::zone() ...

相反,你應該叫:

<script type="text/javascript"><!-- 
    $('select[name=\'zone_id\']').load('index.php?route=<DIRECTORY>/enroll/zone&country_id=<?php echo $country_id; ?>&zone_id=<?php echo $zone_id; ?>'); 
//--></script> 

交換機的<DIRECTORY>值與正確的...


編輯

  1. 只使用account/enroll/zone,不完整路徑
  2. if ($this->request->post['zone_id'] == '')

    在該行551改變條件

    if ($this->request->get['zone_id'] == '')(心從post切換 - >get)。


編輯2:

我猜的開發團隊搞砸很多事情的時候重新實現註冊形式...的$('#register').submit();是OK爲您<form ...>id="register"。再試試這種變化:從

if ($this->request->get['zone_id'] == '') 

if (isset($this->request->get['zone_id'] == '')) 

現在不應該出現的錯誤Notice: Undefined index: zone_id

+0

很確定這是正確的(它看起來像一個兼容性的問題,因爲如果我沒有記錯的方法在1.5.X移動從一個地方到另一個區) –

+0

我更新我上面的帖子說的時候我做了變化發生了什麼。 –

+0

@ Mr.Motts我將編輯添加到您的新環境中...... – shadyyx