I'm using attribute filter option in my store. For this i'm using below codes in admin view template. This'll fetch all attributes form database and using jquery tabs i'm hiding all inactive ones.
The weired problem what i'm facing is LOADING TIME . I'm having more than 5k products in my store. SO retrieving all attributes taking long time(I think so). Did anyone have any idea to reduce loading time in this case?
<div id="tab-subcategory-<?php echo $category['category_id']; ?>" class="htabs-content">
<input name="VALORES_<?php echo $category['category_id']; ?>" type="checkbox" value="1" onclick="Selecbox(this);"/><?php echo $entry_all_values; ?>
<input name="VALORES_<?php echo $category['category_id']; ?>" type="hidden" value="<?php echo $category['category_id']; ?>" />
<table width="100%" border="0" cellpadding="2" class="list">
<thead>
<tr>
<td class="left"><?php echo $entry_value; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_values_explanation; ?>" /></td>
<td class="left"><?php echo $entry_separator; ?> <img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_separator_explanation; ?>" /></td>
<td class="left"><?php echo $entry_examples; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($category['attributes'] as $attribute) { ?>
<tr>
<td class="left">
<?php if ($attribute['checked']) { ?>
<input name="VALORES_<?php echo $category['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" checked="checked" /><?php echo $attribute['name']; ?>
<?php }else{ ?>
<input name="VALORES_<?php echo $category['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" /><?php echo $attribute['name']; ?>
<?php } ?>
</td>
<td class="left"><input name="VALORES_<?php echo $category['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][separator]" type="text" value="<?php echo $attribute['separator']; ?>" size="5"/></td>
<td class="left">
<?php foreach ($languages as $language) { ?>
<select name="select" id="select<?php echo $language; ?>" style="width: 150px" >
<?php
if ($attribute['attribute_values'][$language['language_id']]){
natsort($attribute['attribute_values'][$language['language_id']]);
foreach ($attribute['attribute_values'][$language['language_id']] as $valores_default){ ?>
<option><?php echo trim($valores_default); ?></option>
<?php } ?>
<?php }else{ ?>
<option> <?php echo $text_none; ?></option>
<?php } ?>
</select><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
<?php } ?>
</td>
</tr>
<?php
} ?>
</tbody>
</table>
</div>
<?php foreach ($category['children'] as $child) { ?>
<div id="tab-subcategory-<?php echo $category['category_id']; ?>-<?php echo $child['category_id']; ?>" class="htabs-content">
<input name="VALORES_<?php echo $child['category_id']; ?>" type="checkbox" value="1" onclick="Selecbox(this);"/>
<?php echo $entry_all_values; ?>
<input name="VALORES_<?php echo $child['category_id']; ?>" type="hidden" value="<?php echo $child['category_id']; ?>" />
<table width="100%" border="0" cellpadding="2" class="list">
<thead>
<tr>
<td class="left"><?php echo $entry_value; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_values_explanation; ?>" /></td>
<td class="left"><?php echo $entry_separator; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_separator_explanation; ?>" /></td>
<td class="left"><?php echo $entry_examples; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($child['attributes'] as $attribute) { ?>
<tr>
<td class="left">
<?php if ($attribute['checked']) { ?>
<input name="VALORES_<?php echo $child['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" checked="checked" /><?php echo $attribute['name']; ?>
<?php }else{ ?>
<input name="VALORES_<?php echo $child['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" /><?php echo $attribute['name']; ?>
<?php } ?>
</td>
<td class="left"><input name="VALORES_<?php echo $child['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][separator]" type="text" value="<?php echo $attribute['separator']; ?>" size="5"/></td>
<td class="left">
<?php foreach ($languages as $language) { ?>
<select name="select" id="select<?php echo $language; ?>" style="width: 150px" >
<?php
if ($attribute['attribute_values'][$language['language_id']]){
natsort($attribute['attribute_values'][$language['language_id']]);
foreach ($attribute['attribute_values'][$language['language_id']] as $valores_default){ ?>
<option><?php echo trim($valores_default); ?></option>
<?php } ?>
<?php }else{ ?>
<option> <?php echo $text_none; ?></option>
<?php } ?>
</select><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php foreach ($child['sisters_id'] as $sister) { ?>
<div id="tab-subcategory-<?php echo $category['category_id']; ?>-<?php echo $child['category_id']; ?>-<?php echo $sister['category_id']; ?>" class="htabs-content">
<input name="VALORES_<?php echo $sister['category_id']; ?>" type="checkbox" value="1" onclick="Selecbox(this);"/>
<?php echo $entry_all_values; ?>
<input name="VALORES_<?php echo $sister['category_id']; ?>" type="hidden" value="<?php echo $sister['category_id']; ?>" />
<table width="100%" border="0" cellpadding="2" class="list">
<thead>
<tr>
<td class="left"><?php echo $entry_value; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_values_explanation; ?>" /></td>
<td class="left"><?php echo $entry_separator; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_separator_explanation; ?>" /></td>
<td class="left"><?php echo $entry_examples; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($sister['attributes'] as $attribute) { ?>
<tr>
<td class="left">
<?php if ($attribute['checked']) { ?>
<input name="VALORES_<?php echo $sister['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" checked="checked" /><?php echo $attribute['name']; ?>
<?php }else{ ?>
<input name="VALORES_<?php echo $sister['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" /><?php echo $attribute['name']; ?>
<?php } ?>
</td>
<td class="left"><input name="VALORES_<?php echo $sister['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][separator]" type="text" value="<?php echo $attribute['separator']; ?>" size="5"/></td>
<td class="left">
<?php foreach ($languages as $language) { ?>
<select name="select" id="select<?php echo $language; ?>" style="width: 150px" >
<?php
if ($attribute['attribute_values'][$language['language_id']]){
natsort($attribute['attribute_values'][$language['language_id']]);
foreach ($attribute['attribute_values'][$language['language_id']] as $valores_default){ ?>
<option><?php echo trim($valores_default); ?></option>
<?php } ?>
<?php }else{ ?>
<option> <?php echo $text_none; ?></option>
<?php } ?>
</select><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<?php } ?>
Related
After reviewing the product I've just approved and on a single product page it shows comments but the rating star is not showing.
<?php $_votes = $_review->getRatingVotes(); ?>
<?php if (count($_votes)): ?>
<table class="ratings-table">
<col width="1" />
<col />
<tbody>
<?php foreach ($_votes as $_vote): ?>
<tr>
<th><?php echo $this->escapeHtml($_vote->getRatingCode()) ?></th>
<td>
<div class="rating-box">
<div class="rating" style="width:<?php echo $_vote->getPercent() ?>%;"></div>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
In my database one project has many tasks. I was able to give the edit option for each record by parsing the record id when the update button is clicked. But as one project has many task now I need to parse the projectname when the button clicked and show all the tasks related to that project. Can Somebody help me?
This is the button with record
This is the code
<table class="table table-lg">
<thead >
<tr class="filters">
<th class="col-lg-1"><input type="text" class="form-control" placeholder="Project" disabled></th>
<th class="col-lg-1"><input type="text" class="form-control" placeholder="Client" disabled></th>
<th class="col-lg-1"><input type="text" class="form-control" placeholder="Task " disabled></th>
<th class="col-lg-1"><input type="text" class="form-control" placeholder="Description" disabled></th>
<th class="col-lg-2"><input type="text" class="form-control" placeholder="Create Date and Time" disabled></th>
<th class="col-lg-2"><input type="text" class="form-control" placeholder="Start Date and Time" disabled></th>
<th class="col-lg-2"><input type="text" class="form-control" placeholder="Due Date and Time" disabled></th>
<th class="col-lg-1"> Edit</th>
<th class="col-lg-1"> Delete</th>
</tr>
</thead>
<tbody>
<?php
if(isset($view_data) && is_array($view_data) && count($view_data)): $i=1;
foreach ($view_data as $key => $data) {
?>
<tr <?php if($i%2==0){echo 'class="even"';}else{echo'class="odd"';}?>>
<td><?php echo $data['projectname']; ?></td>
<td><?php echo $data['cname']; ?></td>
<td><?php echo $data['mytext']; ?></td>
<td><?php echo $data['mytext1']; ?></td>
<td><?php echo $data['mytext2']; ?></td>
<td><?php echo $data['mytext3']; ?></td>
<td><?php echo $data['mytext4']; ?></td>
<td><?php echo $data['mytext5']; ?></td>
<td><a class="btn btn-warning" role="button" href="<?php echo site_url('Task/edit_data/'. $data['id'].''); ?>"><i class="glyphicon glyphicon-pencil"></i> Edit</a></td>
<td><a type="button" class="btn btn-danger" href="<?php echo site_url();?>/Task/delete_data/<?php print($data['id']);?>">
<img src='' title="Delete" onClick="return doconfirm();" />
</a></td>
</tr>
<?php
$i++;
}
else:
?>
<tr>
<td colspan="7" align="center" >No Records Found..</td>
</tr>
<?php
endif;
?>
</tbody>
</table>
I wonder why I still having this error message appearing.
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: views/editpages.php
Line Number: 48
Backtrace:
File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\masterlinkci2\application\admin\views\editpages.php
Line: 48
Function: _error_handler
controllers/Cpages.php
public function editpagesupdate() {
$data['pagessuccess'] = '';
$pages_id = $this->uri->segment(3);
$data['pages'] = $this->Mpages->update_pages($pages_id);
$this->load->view('editpages', $data);
}
models/Mpages.php
public function update_pages($pages_id)
{
$data = array(
'pages_name' => $this->input->post('pages_name'),
'create_date' => $this->input->post('create_date'),
'pages_order' => $this->input->post('pages_order'),
'pages_content' => $this->input->post('pages_content')
);
$this->db->where('pages_id', $pages_id);
$query = $this->db->update('pages', $data);
//return $query->result_array();
return $query;
}
views/editpages.php
<div class="widget-box">
<div class="widget-title"><h5>Pages</h5></div>
<div class="widget-content">
<?php echo form_open('cpages/editpagesupdate'); ?>
<table border="0" style="width: 100%; height: 90px;">
<tr>
<td>Pages Name</td>
<td><input type="text" name="pages_name" value="<?php echo $pages_item['pages_name']; ?>"></td>
</tr>
<tr>
<td>Create Date</td>
<td><input type="text" name="create_date" value="<?php echo $pages_item['create_date']; ?>"></td>
</tr>
<tr>
<td>Order</td>
<td><input type="text" name="pages_order" value="<?php echo $pages_item['pages_order']; ?>"></td>
</tr>
<tr>
<td>View Content</td>
<td><textarea rows="3" cols="20" name="pages_content"><?php echo $pages_item['pages_content']; ?></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="edit" name="submit" value="SUBMIT"></td>
</tr>
</table>
</div>
</div>
<?php endforeach; ?>
controllers/Cpages.php
public function editpagesupdate() {
$data['pagessuccess'] = '';
$pages_id = $this->uri->segment(3);
$update = $this->Mpages->update_pages($pages_id);
$data = array();
/* get updated pages here */
if($update){
$data['pages'] = $this->Mpages->get_pages();
}
$this->load->view('editpages', $data);
}
models/Mpages.php
public function get_pages()
{
$query = $this->db->get('pages');
return $query->result_array();
}
views/editpages.php
<div class="widget-box">
<div class="widget-title"><h5>Pages</h5></div>
<div class="widget-content">
<?php echo form_open('cpages/editpagesupdate'); ?>
<table border="0" style="width: 100%; height: 90px;">
<?php foreach($pages as $pages_item) : ?>
<tr>
<td>Pages Name</td>
<td><input type="text" name="pages_name" value="<?php echo $pages_item['pages_name']; ?>"></td>
</tr>
<tr>
<td>Create Date</td>
<td><input type="text" name="create_date" value="<?php echo $pages_item['create_date']; ?>"></td>
</tr>
<tr>
<td>Order</td>
<td><input type="text" name="pages_order" value="<?php echo $pages_item['pages_order']; ?>"></td>
</tr>
<tr>
<td>View Content</td>
<td><textarea rows="3" cols="20" name="pages_content"><?php echo $pages_item['pages_content']; ?></textarea></td>
</tr>
<?php endforeach; ?>
<tr>
<td></td>
<td><input type="submit" class="edit" name="submit" value="SUBMIT"></td>
</tr>
</table>
</div>
</div>
default magento will display the ratings as below image
but i want to change like this :
i am using default magento code
form.phtml [app/design/frontend/rwd/theme/template/review/form.phtml]
<?php if( $this->getRatings() && $this->getRatings()->getSize()): ?>
<h4><?php echo $this->__('Your Rating') ?> <em class="required"></em></h4>
<span id="input-message-box"></span>
<table class="data-table review-summary-table ratings" id="product-review-table">
<col width="1" />
<col />
<col />
<col />
<col />
<col />
<thead>
<tr>
<th> </th>
<th>
<div class="rating-box">
<span class="rating-number">1</span>
<span class="rating nobr" style="width:20%;"><?php echo $this->__('1 star') ?></span>
</div>
</th>
<th>
<div class="rating-box">
<span class="rating-number">2</span>
<span class="rating nobr" style="width:40%;"><?php echo $this->__('2 star') ?></span>
</div>
</th>
<th>
<div class="rating-box">
<span class="rating-number">3</span>
<span class="rating nobr" style="width:60%;"><?php echo $this->__('3 star') ?></span>
</div>
</th>
<th>
<div class="rating-box">
<span class="rating-number">4</span>
<span class="rating nobr" style="width:80%;"><?php echo $this->__('4 star') ?></span>
</div>
</th>
<th>
<div class="rating-box">
<span class="rating-number">5</span>
<span class="rating nobr" style="width:100%;"><?php echo $this->__('5 star') ?></span>
</div>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->getRatings() as $_rating): ?>
<tr>
<th><?php echo $this->escapeHtml($_rating->getRatingCode()) ?></th>
<?php foreach ($_rating->getOptions() as $_option): ?>
<td class="value"><label for="<?php echo $this->escapeHtml($_rating->getRatingCode()) ?>_<?php echo $_option->getValue() ?>"><input type="radio" name="ratings[<?php echo $_rating->getId() ?>]" id="<?php echo $this->escapeHtml($_rating->getRatingCode()) ?>_<?php echo $_option->getValue() ?>" value="<?php echo $_option->getId() ?>" class="radio" /></label></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input type="hidden" name="validate_rating" class="validate-rating" value="" />
<script type="text/javascript">decorateTable('product-review-table')</script>
<?php endif; ?>
please help me to find solution
Thanks in advance
I recently dealt with it and my code looks something like this:
form.phtml
<?php foreach ($this->getRatings() as $_rating): ?>
<tr>
<th><?php echo $this->escapeHtml($_rating->getRatingCode()) ?>: </th>
<?php foreach ($_rating->getOptions() as $_option): ?>
<td class="value">
<label for="<?php echo $this->escapeHtml($_rating->getRatingCode()) ?>_<?php echo $_option->getValue() ?>">
<input type="radio" name="ratings[<?php echo $_rating->getId() ?>]" id="<?php echo $this->escapeHtml($_rating->getRatingCode()) ?>_<?php echo $_option->getValue() ?>" value="<?php echo $_option->getId() ?>" class="radio" />
<i class="fa fa-star"></i>
</label>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
*.css
.review-summary-table tbody td label input {
display: none;
}
// default
.review-summary-table tbody td label input + .fa {
color: #E6E6E6;
}
// hover, clicked, ...
.review-summary-table tbody td label:hover input + .fa,
.review-summary-table tbody td label input:checked + .fa,
.review-summary-table tbody td.active label input + .fa,
.review-summary-table tbody tr:hover td.tmp-active label input + .fa {
color: #50A4CF;
}
*.js
var reviewTable = $('#product-review-table');
if (reviewTable.length > 0) {
reviewTable.each(function() {
$(this).find('tbody tr').each(function() {
var row = $(this),
tdValues = row.find('td.value');
tdValues.each(function(index) {
$(this).find('label').hover(function() {
tdValues.removeClass('tmp-active');
tdValues.slice(0, index + 1).addClass('tmp-active');
}).click(function() {
tdValues.removeClass('active');
tdValues.slice(0, index + 1).addClass('active');
});
});
});
});
}
I'm using opencart 1.5.1 with the theme crista_blue which according to their website is compatible with opencart 1.5.1.
A very similar question was asked here: -SOLVED- Opencart can't load Region / State dropdown but the answer there says "In the controller catalog/controller/account/register.php there is no such an action called zone - therefore the server returns a 404 response and no zones are loaded."
My enroll.php file does have a zone action in it. Which makes me think the problem is of a different nature.
Two other people built this site and are no longer around to maintain it. It seems at first they used the default register.tpl/register.php for the account creation but then decided to change the welcome page where the "register" link takes you to enroll.php/enroll.tpl.
This is the website https://www.mybaysix.com/. If you click the Register link at the bottom you are brought to a form where the Region / State dropdown appears but is empty. If you hit continue the page displays the error messages for the required fields, and the Region / State dropdown box is now loaded with options.
Here is the enroll.tpl file:
<?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']; ?><?php echo $breadcrumb['text']; ?>
<?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; ?>
This is the zone function at the bottom of enroll.php:
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);
}
I've never used opencart before so if there is any more information that would help figure out the problem just ask.
EDIT: I attempted shadyyx's first answer below and this was the result.
I changed the .load to ('index.php?route=account/enroll/zone&country_id=<?php echo $country_id; ?>&zone_id=<?php echo $zone_id; ?>');
I also tried with the full path /catalog/controller/account/enroll/. The dropdown still didn't populate. When I hit continue with nothing filled out an error appears at the top Notice: Undefined index: zone_id in /home/mybaysix/public_html/catalog/controller/account/enroll.php on line 551
Line 551 of enroll.php is if ($this->request->post['zone_id'] == '') { $this->error['zone'] = $this->language->get('error_zone'); }
First, welcome to Stack OverFlow!
Your enroll.php maybe does have the zone() function, but in Your HTML's JavaScript, You are calling:
<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>
Thus You are trying to load /catalog/controller/account/register.php::zone()...
Instead You should be calling:
<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>
Switch the <DIRECTORY> value with the correct one...
EDIT:
use only account/enroll/zone, not the full path
change the condition on that line 551 from
if ($this->request->post['zone_id'] == '')
to
if ($this->request->get['zone_id'] == '') (mind switching from post -> get).
EDIT 2:
I guess the dev team messed many things up when reimplementing the registration form... The $('#register').submit(); is OK as Your <form ...> has id="register". Try again this change: from
if ($this->request->get['zone_id'] == '')
to
if (isset($this->request->get['zone_id'] == ''))
Now the Notice: Undefined index: zone_id error shouldn't occur.