shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

guest.twig (29900B)


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