Post by shah_ankitb » Wed May 20, 2015 3:31 pm

Hi,

http://demo.opencart.com/index.php?rout ... t/register

If you select country as Singapore then it should display None in Region/State. This is fixed in previous version less then 2.0.

Newer version has the issue.

Attachments

1.png

1.png (5.06 KiB) Viewed 556 times


Newbie

Posts

Joined
Fri Oct 31, 2014 2:28 pm

Post by dswtpl » Wed May 20, 2015 5:00 pm

Hello shah_ankitb,

The latest opencart fixed this issue, you will use following code for the fixing the issue.

register.tpl

Code: Select all

<script type="text/javascript"><!--
$('select[name=\'country_id\']').on('change', function() {
	$.ajax({
		url: 'index.php?route=account/account/country&country_id=' + this.value,
		dataType: 'json',
		beforeSend: function() {
			$('select[name=\'country_id\']').after(' <i class="fa fa-circle-o-notch fa-spin"></i>');
		},
		complete: function() {
			$('.fa-spin').remove();
		},
		success: function(json) {
			if (json['postcode_required'] == '1') {
				$('input[name=\'postcode\']').parent().parent().addClass('required');
			} else {
				$('input[name=\'postcode\']').parent().parent().removeClass('required');
			}
			
			html = '<option value=""><?php echo $text_select; ?></option>';
			
			if (json['zone'] != '') {
				for (i = 0; i < json['zone'].length; i++) {
					html += '<option value="' + json['zone'][i]['zone_id'] + '"';
					
					if (json['zone'][i]['zone_id'] == '<?php echo $zone_id; ?>') {
						html += ' selected="selected"';
					}
				
					html += '>' + json['zone'][i]['name'] + '</option>';
				}
			} else {
				html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>';
			}
			
			$('select[name=\'zone_id\']').html(html);
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});

$('select[name=\'country_id\']').trigger('change');
//--></script>
You also replace this code with your old code in the entire opencart.

Thanks,

New member

Posts

Joined
Thu Feb 12, 2015 10:17 pm
Who is online

Users browsing this forum: No registered users and 9 guests