register.twig (26866B)
1 <div class="row"> 2 <div class="col-sm-6"> 3 <fieldset id="account"> 4 <legend>{{ text_your_details }}</legend> 5 <div class="form-group" style="display: {% if customer_groups|length > 1 %} block {% else %} none {% endif %};"> 6 <label class="control-label">{{ entry_customer_group }}</label> 7 {% for customer_group in customer_groups %} 8 {% if customer_group.customer_group_id == customer_group_id %} 9 <div class="radio"> 10 <label> 11 <input type="radio" name="customer_group_id" value="{{ customer_group.customer_group_id }}" checked="checked" /> 12 {{ customer_group.name }}</label> 13 </div> 14 {% else %} 15 <div class="radio"> 16 <label> 17 <input type="radio" name="customer_group_id" value="{{ customer_group.customer_group_id }}" /> 18 {{ customer_group.name }}</label> 19 </div> 20 {% endif %} 21 {% endfor %}</div> 22 <div class="form-group required"> 23 <label class="control-label" for="input-payment-firstname">{{ entry_firstname }}</label> 24 <input type="text" name="firstname" value="" placeholder="{{ entry_firstname }}" id="input-payment-firstname" class="form-control" /> 25 </div> 26 <div class="form-group required"> 27 <label class="control-label" for="input-payment-lastname">{{ entry_lastname }}</label> 28 <input type="text" name="lastname" value="" placeholder="{{ entry_lastname }}" id="input-payment-lastname" class="form-control" /> 29 </div> 30 <div class="form-group required"> 31 <label class="control-label" for="input-payment-email">{{ entry_email }}</label> 32 <input type="text" name="email" value="" placeholder="{{ entry_email }}" id="input-payment-email" class="form-control" /> 33 </div> 34 <div class="form-group required"> 35 <label class="control-label" for="input-payment-telephone">{{ entry_telephone }}</label> 36 <input type="text" name="telephone" value="" placeholder="{{ entry_telephone }}" id="input-payment-telephone" class="form-control" /> 37 </div> 38 {% for custom_field in custom_fields %} 39 40 {% if custom_field.location == 'account' %} 41 42 {% if custom_field.type == 'select' %} 43 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 44 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 45 <select name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control"> 46 <option value="">{{ text_select }}</option> 47 48 49 50 {% for custom_field_value in custom_field.custom_field_value %} 51 52 53 54 <option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option> 55 56 57 58 {% endfor %} 59 60 61 62 </select> 63 </div> 64 {% endif %} 65 66 {% if custom_field.type == 'radio' %} 67 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 68 <label class="control-label">{{ custom_field.name }}</label> 69 <div id="input-payment-custom-field{{ custom_field.custom_field_id }}"> {% for custom_field_value in custom_field.custom_field_value %} 70 <div class="radio"> 71 <label> 72 <input type="radio" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" /> 73 {{ custom_field_value.name }}</label> 74 </div> 75 {% endfor %} </div> 76 </div> 77 {% endif %} 78 79 {% if custom_field.type == 'checkbox' %} 80 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 81 <label class="control-label">{{ custom_field.name }}</label> 82 <div id="input-payment-custom-field{{ custom_field.custom_field_id }}"> {% for custom_field_value in custom_field.custom_field_value %} 83 <div class="checkbox"> 84 <label> 85 <input type="checkbox" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" /> 86 {{ custom_field_value.name }}</label> 87 </div> 88 {% endfor %} </div> 89 </div> 90 {% endif %} 91 92 {% if custom_field.type == 'text' %} 93 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 94 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 95 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 96 </div> 97 {% endif %} 98 99 {% if custom_field.type == 'textarea' %} 100 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 101 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 102 <textarea name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.name }}" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control">{{ custom_field.value }}</textarea> 103 </div> 104 {% endif %} 105 106 {% if custom_field.type == 'file' %} 107 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 108 <label class="control-label">{{ custom_field.name }}</label> 109 <br /> 110 <button type="button" id="button-payment-custom-field{{ custom_field.custom_field_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button> 111 <input type="hidden" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="" id="input-payment-custom-field{{ custom_field.custom_field_id }}" /> 112 </div> 113 {% endif %} 114 115 {% if custom_field.type == 'date' %} 116 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 117 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 118 <div class="input-group date"> 119 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 120 <span class="input-group-btn"> 121 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 122 </span></div> 123 </div> 124 {% endif %} 125 126 {% if custom_field.type == 'time' %} 127 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 128 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 129 <div class="input-group time"> 130 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="HH:mm" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 131 <span class="input-group-btn"> 132 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 133 </span></div> 134 </div> 135 {% endif %} 136 137 {% if custom_field.type == 'time' %} 138 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 139 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 140 <div class="input-group datetime"> 141 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD HH:mm" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 142 <span class="input-group-btn"> 143 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 144 </span></div> 145 </div> 146 {% endif %} 147 148 {% endif %} 149 150 {% endfor %} 151 </fieldset> 152 <fieldset> 153 <legend>{{ text_your_password }}</legend> 154 <div class="form-group required"> 155 <label class="control-label" for="input-payment-password">{{ entry_password }}</label> 156 <input type="password" name="password" value="" placeholder="{{ entry_password }}" id="input-payment-password" class="form-control" /> 157 </div> 158 <div class="form-group required"> 159 <label class="control-label" for="input-payment-confirm">{{ entry_confirm }}</label> 160 <input type="password" name="confirm" value="" placeholder="{{ entry_confirm }}" id="input-payment-confirm" class="form-control" /> 161 </div> 162 </fieldset> 163 </div> 164 <div class="col-sm-6"> 165 <fieldset id="address"> 166 <legend>{{ text_your_address }}</legend> 167 <div class="form-group"> 168 <label class="control-label" for="input-payment-company">{{ entry_company }}</label> 169 <input type="text" name="company" value="" placeholder="{{ entry_company }}" id="input-payment-company" class="form-control" /> 170 </div> 171 <div class="form-group required"> 172 <label class="control-label" for="input-payment-address-1">{{ entry_address_1 }}</label> 173 <input type="text" name="address_1" value="" placeholder="{{ entry_address_1 }}" id="input-payment-address-1" class="form-control" /> 174 </div> 175 <div class="form-group"> 176 <label class="control-label" for="input-payment-address-2">{{ entry_address_2 }}</label> 177 <input type="text" name="address_2" value="" placeholder="{{ entry_address_2 }}" id="input-payment-address-2" class="form-control" /> 178 </div> 179 <div class="form-group required"> 180 <label class="control-label" for="input-payment-city">{{ entry_city }}</label> 181 <input type="text" name="city" value="" placeholder="{{ entry_city }}" id="input-payment-city" class="form-control" /> 182 </div> 183 <div class="form-group required"> 184 <label class="control-label" for="input-payment-postcode">{{ entry_postcode }}</label> 185 <input type="text" name="postcode" value="{{ postcode }}" placeholder="{{ entry_postcode }}" id="input-payment-postcode" class="form-control" /> 186 </div> 187 <div class="form-group required"> 188 <label class="control-label" for="input-payment-country">{{ entry_country }}</label> 189 <select name="country_id" id="input-payment-country" class="form-control"> 190 <option value="">{{ text_select }}</option> 191 192 193 194 {% for country in countries %} 195 {% if country.country_id == country_id %} 196 197 198 199 <option value="{{ country.country_id }}" selected="selected">{{ country.name }}</option> 200 201 202 203 {% else %} 204 205 206 207 <option value="{{ country.country_id }}">{{ country.name }}</option> 208 209 210 211 {% endif %} 212 {% endfor %} 213 214 215 216 </select> 217 </div> 218 <div class="form-group required"> 219 <label class="control-label" for="input-payment-zone">{{ entry_zone }}</label> 220 <select name="zone_id" id="input-payment-zone" class="form-control"> 221 </select> 222 </div> 223 {% for custom_field in custom_fields %} 224 225 {% if custom_field.location == 'address' %} 226 227 {% if custom_field.type == 'select' %} 228 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 229 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 230 <select name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control"> 231 <option value="">{{ text_select }}</option> 232 233 234 235 {% for custom_field_value in custom_field.custom_field_value %} 236 237 238 239 <option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option> 240 241 242 243 {% endfor %} 244 245 246 247 </select> 248 </div> 249 {% endif %} 250 251 {% if custom_field.type == 'radio' %} 252 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 253 <label class="control-label">{{ custom_field.name }}</label> 254 <div id="input-payment-custom-field{{ custom_field.custom_field_id }}"> {% for custom_field_value in custom_field.custom_field_value %} 255 <div class="radio"> 256 <label> 257 <input type="radio" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" /> 258 {{ custom_field_value.name }}</label> 259 </div> 260 {% endfor %} </div> 261 </div> 262 {% endif %} 263 264 {% if custom_field.type == 'checkbox' %} 265 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 266 <label class="control-label">{{ custom_field.name }}</label> 267 <div id="input-payment-custom-field{{ custom_field.custom_field_id }}"> {% for custom_field_value in custom_field.custom_field_value %} 268 <div class="checkbox"> 269 <label> 270 <input type="checkbox" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" /> 271 {{ custom_field_value.name }}</label> 272 </div> 273 {% endfor %} </div> 274 </div> 275 {% endif %} 276 277 {% if custom_field.type == 'text' %} 278 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 279 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 280 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 281 </div> 282 {% endif %} 283 284 {% if custom_field.type == 'textarea' %} 285 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 286 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 287 <textarea name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.name }}" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control">{{ custom_field.value }}</textarea> 288 </div> 289 {% endif %} 290 291 {% if custom_field.type == 'file' %} 292 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 293 <label class="control-label">{{ custom_field.name }}</label> 294 <br /> 295 <button type="button" id="button-payment-custom-field{{ custom_field.custom_field_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button> 296 <input type="hidden" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="" id="input-payment-custom-field{{ custom_field.custom_field_id }}" /> 297 </div> 298 {% endif %} 299 300 {% if custom_field.type == 'date' %} 301 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 302 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 303 <div class="input-group date"> 304 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 305 <span class="input-group-btn"> 306 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 307 </span></div> 308 </div> 309 {% endif %} 310 311 {% if custom_field.type == 'time' %} 312 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 313 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 314 <div class="input-group time"> 315 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="HH:mm" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 316 <span class="input-group-btn"> 317 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 318 </span></div> 319 </div> 320 {% endif %} 321 322 {% if custom_field.type == 'time' %} 323 <div id="payment-custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 324 <label class="control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 325 <div class="input-group datetime"> 326 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD HH:mm" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 327 <span class="input-group-btn"> 328 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 329 </span></div> 330 </div> 331 {% endif %} 332 333 {% endif %} 334 {% endfor %} 335 </fieldset> 336 337 {{ captcha }}</div> 338 </div> 339 <div class="checkbox"> 340 <label for="newsletter"> 341 <input type="checkbox" name="newsletter" value="1" id="newsletter" /> 342 {{ entry_newsletter }}</label> 343 </div> 344 {% if shipping_required %} 345 <div class="checkbox"> 346 <label> 347 <input type="checkbox" name="shipping_address" value="1" checked="checked" /> 348 {{ entry_shipping }}</label> 349 </div> 350 {% endif %} 351 {% if text_agree %} 352 <div class="buttons clearfix"> 353 <div class="pull-right">{{ text_agree }} 354 355 <input type="checkbox" name="agree" value="1" /> 356 <input type="button" value="{{ button_continue }}" id="button-register" data-loading-text="{{ text_loading }}" class="btn btn-primary" /> 357 </div> 358 </div> 359 {% else %} 360 <div class="buttons clearfix"> 361 <div class="pull-right"> 362 <input type="button" value="{{ button_continue }}" id="button-register" data-loading-text="{{ text_loading }}" class="btn btn-primary" /> 363 </div> 364 </div> 365 {% endif %} 366 <script type="text/javascript"><!-- 367 // Sort the custom fields 368 $('#account .form-group[data-sort]').detach().each(function() { 369 if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#account .form-group').length) { 370 $('#account .form-group').eq($(this).attr('data-sort')).before(this); 371 } 372 373 if ($(this).attr('data-sort') > $('#account .form-group').length) { 374 $('#account .form-group:last').after(this); 375 } 376 377 if ($(this).attr('data-sort') == $('#account .form-group').length) { 378 $('#account .form-group:last').after(this); 379 } 380 381 if ($(this).attr('data-sort') < -$('#account .form-group').length) { 382 $('#account .form-group:first').before(this); 383 } 384 }); 385 386 $('#address .form-group[data-sort]').detach().each(function() { 387 if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#address .form-group').length) { 388 $('#address .form-group').eq($(this).attr('data-sort')).before(this); 389 } 390 391 if ($(this).attr('data-sort') > $('#address .form-group').length) { 392 $('#address .form-group:last').after(this); 393 } 394 395 if ($(this).attr('data-sort') == $('#address .form-group').length) { 396 $('#address .form-group:last').after(this); 397 } 398 399 if ($(this).attr('data-sort') < -$('#address .form-group').length) { 400 $('#address .form-group:first').before(this); 401 } 402 }); 403 404 $('#collapse-payment-address input[name=\'customer_group_id\']').on('change', function() { 405 $.ajax({ 406 url: 'index.php?route=checkout/checkout/customfield&customer_group_id=' + this.value, 407 dataType: 'json', 408 success: function(json) { 409 $('#collapse-payment-address .custom-field').hide(); 410 $('#collapse-payment-address .custom-field').removeClass('required'); 411 412 for (i = 0; i < json.length; i++) { 413 custom_field = json[i]; 414 415 $('#payment-custom-field' + custom_field['custom_field_id']).show(); 416 417 if (custom_field['required']) { 418 $('#payment-custom-field' + custom_field['custom_field_id']).addClass('required'); 419 } 420 } 421 }, 422 error: function(xhr, ajaxOptions, thrownError) { 423 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 424 } 425 }); 426 }); 427 428 $('#collapse-payment-address input[name=\'customer_group_id\']:checked').trigger('change'); 429 //--></script> 430 <script type="text/javascript"><!-- 431 $('#collapse-payment-address button[id^=\'button-payment-custom-field\']').on('click', function() { 432 var node = this; 433 434 $('#form-upload').remove(); 435 436 $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>'); 437 438 $('#form-upload input[name=\'file\']').trigger('click'); 439 440 if (typeof timer != 'undefined') { 441 clearInterval(timer); 442 } 443 444 timer = setInterval(function() { 445 if ($('#form-upload input[name=\'file\']').val() != '') { 446 clearInterval(timer); 447 448 $.ajax({ 449 url: 'index.php?route=tool/upload', 450 type: 'post', 451 dataType: 'json', 452 data: new FormData($('#form-upload')[0]), 453 cache: false, 454 contentType: false, 455 processData: false, 456 beforeSend: function() { 457 $(node).button('loading'); 458 }, 459 complete: function() { 460 $(node).button('reset'); 461 }, 462 success: function(json) { 463 $('.text-danger').remove(); 464 465 if (json['error']) { 466 $(node).parent().find('input[name^=\'custom_field\']').after('<div class="text-danger">' + json['error'] + '</div>'); 467 } 468 469 if (json['success']) { 470 alert(json['success']); 471 472 $(node).parent().find('input[name^=\'custom_field\']').val(json['code']); 473 } 474 }, 475 error: function(xhr, ajaxOptions, thrownError) { 476 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 477 } 478 }); 479 } 480 }, 500); 481 }); 482 //--></script> 483 <script type="text/javascript"><!-- 484 $('.date').datetimepicker({ 485 language: '{{ datepicker }}', 486 pickTime: false 487 }); 488 489 $('.time').datetimepicker({ 490 language: '{{ datepicker }}', 491 pickDate: false 492 }); 493 494 $('.datetime').datetimepicker({ 495 language: '{{ datepicker }}', 496 pickDate: true, 497 pickTime: true 498 }); 499 //--></script> 500 <script type="text/javascript"><!-- 501 $('#collapse-payment-address select[name=\'country_id\']').on('change', function() { 502 $.ajax({ 503 url: 'index.php?route=checkout/checkout/country&country_id=' + this.value, 504 dataType: 'json', 505 beforeSend: function() { 506 $('#collapse-payment-address select[name=\'country_id\']').prop('disabled', true); 507 }, 508 complete: function() { 509 $('#collapse-payment-address select[name=\'country_id\']').prop('disabled', false); 510 }, 511 success: function(json) { 512 if (json['postcode_required'] == '1') { 513 $('#collapse-payment-address input[name=\'postcode\']').parent().addClass('required'); 514 } else { 515 $('#collapse-payment-address input[name=\'postcode\']').parent().removeClass('required'); 516 } 517 518 html = '<option value="">{{ text_select }}</option>'; 519 520 if (json['zone'] && json['zone'] != '') { 521 for (i = 0; i < json['zone'].length; i++) { 522 html += '<option value="' + json['zone'][i]['zone_id'] + '"'; 523 524 if (json['zone'][i]['zone_id'] == '{{ zone_id }}') { 525 html += ' selected="selected"'; 526 } 527 528 html += '>' + json['zone'][i]['name'] + '</option>'; 529 } 530 } else { 531 html += '<option value="0" selected="selected">{{ text_none }}</option>'; 532 } 533 534 $('#collapse-payment-address select[name=\'zone_id\']').html(html); 535 }, 536 error: function(xhr, ajaxOptions, thrownError) { 537 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 538 } 539 }); 540 }); 541 542 $('#collapse-payment-address select[name=\'country_id\']').trigger('change'); 543 //--></script>