first commit
This commit is contained in:
86
catalog/view/template/checkout/cart.twig
Normal file
86
catalog/view/template/checkout/cart.twig
Normal file
@ -0,0 +1,86 @@
|
||||
{{ header }}
|
||||
<div id="checkout-cart" class="container">
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li class="breadcrumb-item"><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if attention %}
|
||||
<div class="alert alert-info"><i class="fa-solid fa-circle-info"></i> {{ attention }} <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>
|
||||
{% endif %}
|
||||
{% if success %}
|
||||
<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-check"></i> {{ success }} <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>
|
||||
{% endif %}
|
||||
{% if error_warning %}
|
||||
<div class="alert alert-danger alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> {{ error_warning }} <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>
|
||||
{% endif %}
|
||||
<div class="row">{{ column_left }}
|
||||
<div id="content" class="col">{{ content_top }}
|
||||
<h1>{{ heading_title }}{% if weight %} ({{ weight }}){% endif %}</h1>
|
||||
<div id="shopping-cart">{{ list }}</div>
|
||||
{% if modules %}
|
||||
<h2>{{ text_next }}</h2>
|
||||
<p>{{ text_next_choice }}</p>
|
||||
<div id="accordion" class="accordion">
|
||||
{% for module in modules %}
|
||||
{{ module }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<br/>
|
||||
<div class="row">
|
||||
<div class="col"><a href="{{ continue }}" class="btn btn-light">{{ button_shopping }}</a></div>
|
||||
<div class="col text-end"><a href="{{ checkout }}" class="btn btn-primary">{{ button_checkout }}</a></div>
|
||||
</div>
|
||||
{{ content_bottom }}</div>
|
||||
{{ column_right }}</div>
|
||||
</div>
|
||||
<script type="text/javascript"><!--
|
||||
$('#shopping-cart').on('submit', 'form', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var element = this;
|
||||
|
||||
if (e.originalEvent !== undefined && e.originalEvent.submitter !== undefined) {
|
||||
var button = e.originalEvent.submitter;
|
||||
} else {
|
||||
var button = '';
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: $(button).attr('formaction'),
|
||||
type: 'post',
|
||||
data: $(element).serialize(),
|
||||
dataType: 'json',
|
||||
beforeSend: function () {
|
||||
$(button).button('loading');
|
||||
},
|
||||
complete: function () {
|
||||
$(button).button('reset');
|
||||
},
|
||||
success: function (json) {
|
||||
console.log(json);
|
||||
|
||||
if (json['redirect']) {
|
||||
location = json['redirect'];
|
||||
}
|
||||
|
||||
if (json['error']) {
|
||||
$('#alert').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> ' + json['error'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('#alert').prepend('<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> ' + json['success'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
}
|
||||
|
||||
$('#shopping-cart').load('index.php?route=checkout/cart.list&language={{ language }}', {}, function () {
|
||||
$('#header-cart').load('index.php?route=common/cart.info&language={{ language }}');
|
||||
});
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
//--></script>
|
||||
{{ footer }}
|
73
catalog/view/template/checkout/cart_list.twig
Normal file
73
catalog/view/template/checkout/cart_list.twig
Normal file
@ -0,0 +1,73 @@
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="text-center">{{ column_image }}</td>
|
||||
<td class="text-start">{{ column_name }}</td>
|
||||
<td class="text-start">{{ column_model }}</td>
|
||||
<td class="text-start">{{ column_quantity }}</td>
|
||||
<td class="text-end">{{ column_price }}</td>
|
||||
<td class="text-end">{{ column_total }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for product in products %}
|
||||
<tr>
|
||||
<td class="text-center">{% if product.thumb %} <a href="{{ product.href }}"><img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-thumbnail"/></a> {% endif %}</td>
|
||||
<td class="text-start text-wrap"><a href="{{ product.href }}">{{ product.name }}</a>{% if not product.stock %} <span class="text-danger">***</span>{% endif %}
|
||||
{% for option in product.option %}
|
||||
<br/>
|
||||
<small> - {{ option.name }}: {{ option.value }}</small>
|
||||
{% endfor %}
|
||||
{% if product.reward %}
|
||||
<br/>
|
||||
<small> - {{ text_points }}: {{ product.reward }}</small>
|
||||
{% endif %}
|
||||
{% if product.subscription %}
|
||||
<br/>
|
||||
<small> - {{ text_subscription }}: {{ product.subscription }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-start">{{ product.model }}</td>
|
||||
<td class="text-start">
|
||||
<form method="post" data-oc-target="#shopping-cart">
|
||||
<div class="input-group">
|
||||
<input type="text" name="quantity" value="{{ product.quantity }}" size="1" class="form-control"> <input type="hidden" name="key" value="{{ product.cart_id }}">
|
||||
<button type="submit" formaction="{{ product_edit }}" data-bs-toggle="tooltip" title="{{ button_update }}" class="btn btn-primary"><i class="fa-solid fa-rotate"></i></button>
|
||||
<button type="submit" formaction="{{ product_remove }}" data-bs-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa-solid fa-circle-xmark"></i></button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
<td class="text-end">{{ product.price }}</td>
|
||||
<td class="text-end">{{ product.total }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% for voucher in vouchers %}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="text-start text-wrap">{{ voucher.description }}</td>
|
||||
<td class="text-start"></td>
|
||||
<td class="text-start">
|
||||
<form method="post" data-oc-target="#shopping-cart">
|
||||
<div class="input-group">
|
||||
<input type="text" name="quantity" value="1" size="1" class="form-control" disabled/>
|
||||
<button type="submit" formaction="{{ voucher_remove }}" data-bs-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa-solid fa-circle-xmark"></i></button>
|
||||
</div>
|
||||
<input type="hidden" name="key" value="{{ voucher.key }}"/>
|
||||
</form>
|
||||
</td>
|
||||
<td class="text-end">{{ voucher.amount }}</td>
|
||||
<td class="text-end">{{ voucher.amount }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot id="checkout-total">
|
||||
{% for total in totals %}
|
||||
<tr>
|
||||
<td colspan="5" class="text-end"><strong>{{ total.title }}</strong></td>
|
||||
<td class="text-end">{{ total.text }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
38
catalog/view/template/checkout/checkout.twig
Normal file
38
catalog/view/template/checkout/checkout.twig
Normal file
@ -0,0 +1,38 @@
|
||||
{{ header }}
|
||||
<div id="checkout-checkout" class="container">
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li class="breadcrumb-item"><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="row">{{ column_left }}
|
||||
<div id="content" class="col">{{ content_top }}
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<div class="row">
|
||||
{% if register or payment_address or shipping_address %}
|
||||
<div class="col-md-7 mb-3">
|
||||
{% if register %}
|
||||
<div id="checkout-register">{{ register }}</div>
|
||||
{% endif %}
|
||||
{% if payment_address %}
|
||||
<div id="checkout-payment-address">{{ payment_address }}</div>
|
||||
{% endif %}
|
||||
{% if shipping_address %}
|
||||
<div id="checkout-shipping-address">{{ shipping_address }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col">
|
||||
{% if shipping_method %}
|
||||
<div id="checkout-shipping-method" class="mb-3">{{ shipping_method }}</div>
|
||||
{% endif %}
|
||||
<div id="checkout-payment-method" class="mb-4">{{ payment_method }}</div>
|
||||
<div id="checkout-confirm">{{ confirm }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ content_bottom }}
|
||||
</div>
|
||||
{{ column_right }}
|
||||
</div>
|
||||
{{ footer }}
|
51
catalog/view/template/checkout/confirm.twig
Normal file
51
catalog/view/template/checkout/confirm.twig
Normal file
@ -0,0 +1,51 @@
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="text-start">{{ column_name }}</td>
|
||||
<td class="text-end">{{ column_total }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for product in products %}
|
||||
<tr>
|
||||
<td class="text-start">{{ product.quantity }}x <a href="{{ product.href }}">{{ product.name }}</a>
|
||||
{% for option in product.option %}
|
||||
<br/>
|
||||
<small> - {{ option.name }}: {{ option.value }}</small>
|
||||
{% endfor %}
|
||||
{% if product.reward %}
|
||||
<br/>
|
||||
<small> - {{ text_points }}: {{ product.reward }}</small>
|
||||
{% endif %}
|
||||
{% if product.subscription %}
|
||||
<br/>
|
||||
<small> - {{ text_subscription }} {{ product.subscription }}</small>
|
||||
{% endif %}</td>
|
||||
<td class="text-end">{{ product.total }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% for voucher in vouchers %}
|
||||
<tr>
|
||||
<td class="text-start">1x {{ voucher.description }}</td>
|
||||
<td class="text-end">{{ voucher.amount }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
{% for total in totals %}
|
||||
<tr>
|
||||
<td class="text-end"><strong>{{ total.title }}</strong></td>
|
||||
<td class="text-end">{{ total.text }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div id="checkout-payment">
|
||||
{% if payment %}
|
||||
{{ payment }}
|
||||
{% else %}
|
||||
<div class="text-end"><button type="button" class="btn btn-primary" disabled>{{ button_confirm }}</button></div>
|
||||
{% endif %}
|
||||
</div>
|
372
catalog/view/template/checkout/payment_address.twig
Normal file
372
catalog/view/template/checkout/payment_address.twig
Normal file
@ -0,0 +1,372 @@
|
||||
<fieldset>
|
||||
<legend>{{ heading_title }}</legend>
|
||||
<div id="payment-addresses" style="display: {% if addresses %}block{% else %}none{% endif %};">
|
||||
<div class="form-check">
|
||||
<input type="radio" name="payment_existing" value="1" id="input-payment-existing" class="form-check-input"{% if addresses %} checked{% endif %}/>
|
||||
<label for="input-payment-existing" class="form-check-label">{{ text_address_existing }}</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input type="radio" name="payment_existing" value="0" id="input-payment-new" class="form-check-input"{% if not addresses %} checked{% endif %}>
|
||||
<label for="input-payment-new" class="form-check-label">{{ text_address_new }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="payment-existing" style="display: {% if addresses %}block{% else %}none{% endif %};">
|
||||
<select name="address_id" id="input-payment-address" class="form-select">
|
||||
<option value="">{{ text_select }}</option>
|
||||
{% for address in addresses %}
|
||||
<option value="{{ address.address_id }}"{% if address.address_id == address_id %} selected{% endif %}>{{ address.firstname }} {{ address.lastname }},{% if address.company %} {{ address.company }},{% endif %} {{ address.address_1 }}, {{ address.city }}, {{ address.zone }}, {{ address.country }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-payment-address" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<br/>
|
||||
<div id="payment-new" style="display: {% if not addresses %}block{% else %}none{% endif %};">
|
||||
<form id="form-payment-address">
|
||||
<div class="row row-cols-1 row-cols-md-2">
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-firstname" class="form-label">{{ entry_firstname }}</label>
|
||||
<input type="text" name="firstname" value="" placeholder="{{ entry_firstname }}" id="input-payment-firstname" class="form-control"/>
|
||||
<div id="error-payment-firstname" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-lastname" class="form-label">{{ entry_lastname }}</label>
|
||||
<input type="text" name="lastname" value="" placeholder="{{ entry_lastname }}" id="input-payment-lastname" class="form-control"/>
|
||||
<div id="error-payment-lastname" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3">
|
||||
<label for="input-payment-company" class="form-label">{{ entry_company }}</label>
|
||||
<input type="text" name="company" value="" placeholder="{{ entry_company }}" id="input-payment-company" class="form-control"/>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-address-1" class="form-label">{{ entry_address_1 }}</label>
|
||||
<input type="text" name="address_1" value="" placeholder="{{ entry_address_1 }}" id="input-payment-address-1" class="form-control"/>
|
||||
<div id="error-payment-address-1" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3">
|
||||
<label for="input-payment-address-2" class="form-label">{{ entry_address_2 }}</label>
|
||||
<input type="text" name="address_2" value="" placeholder="{{ entry_address_2 }}" id="input-payment-address-2" class="form-control"/>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-city" class="form-label">{{ entry_city }}</label>
|
||||
<input type="text" name="city" value="" placeholder="{{ entry_city }}" id="input-payment-city" class="form-control"/>
|
||||
<div id="error-payment-city" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-postcode" class="form-label">{{ entry_postcode }}</label>
|
||||
<input type="text" name="postcode" value="" placeholder="{{ entry_postcode }}" id="input-payment-postcode" class="form-control"/>
|
||||
<div id="error-payment-postcode" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-country" class="form-label">{{ entry_country }}</label>
|
||||
<select name="country_id" id="input-payment-country" class="form-select">
|
||||
<option value="0">{{ text_select }}</option>
|
||||
{% for country in countries %}
|
||||
<option value="{{ country.country_id }}">{{ country.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-payment-country" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-zone" class="form-label">{{ entry_zone }}</label>
|
||||
<select name="zone_id" id="input-payment-zone" class="form-select"></select>
|
||||
<div id="error-payment-zone" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% for custom_field in custom_fields %}
|
||||
|
||||
{% if custom_field.type == 'select' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<select name="custom_field[{{ custom_field.custom_field_id }}]" id="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-select">
|
||||
<option value="">{{ text_select }}</option>
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'radio' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-payment-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="radio" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" id="input-payment-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"/>
|
||||
<label for="input-payment-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'checkbox' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-payment-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="checkbox" name="custom_field[{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" id="input-payment-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"/>
|
||||
<label for="input-payment-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'text' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<input type="text" name="custom_field[{{ 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"/>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'textarea' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<textarea name="custom_field[{{ 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>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'file' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div>
|
||||
<button type="button" data-oc-toggle="upload" data-oc-url="{{ upload }}" data-oc-size-max="{{ config_file_max_size }}" data-oc-size-error="{{ error_upload_size }}" data-oc-target="#input-payment-custom-field-{{ custom_field.custom_field_id }}" class="btn btn-light"><i class="fa-solid fa-upload"></i> {{ button_upload }}</button>
|
||||
<input type="hidden" name="custom_field[{{ custom_field.custom_field_id }}]" value="" id="input-payment-custom-field-{{ custom_field.custom_field_id }}"/>
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'date' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="custom_field[{{ 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 date"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'time' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">-
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="custom_field[{{ 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 time"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'datetime' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="custom_field[{{ 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 datetime"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="text-end mb-3">
|
||||
<button type="submit" id="button-payment-address" class="btn btn-primary">{{ button_continue }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
<script type="text/javascript"><!--
|
||||
$('input[name=\'payment_existing\']').on('change', function() {
|
||||
if ($(this).val() == 1) {
|
||||
$('#payment-existing').show();
|
||||
$('#payment-new').hide();
|
||||
} else {
|
||||
$('#payment-existing').hide();
|
||||
$('#payment-new').show();
|
||||
}
|
||||
});
|
||||
|
||||
// Existing Payment Address
|
||||
$('#input-payment-address').on('change', function() {
|
||||
var element = this;
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/payment_address.address&language={{ language }}&address_id=' + $(element).val(),
|
||||
dataType: 'json',
|
||||
beforeSend: function() {
|
||||
$(element).prop('disabled', true);
|
||||
},
|
||||
complete: function() {
|
||||
$(element).prop('disabled', false);
|
||||
},
|
||||
success: function(json) {
|
||||
console.log(json);
|
||||
|
||||
$('#input-payment-address').removeClass('is-invalid');
|
||||
$('#error-payment-address').removeClass('d-block');
|
||||
|
||||
if (json['redirect']) {
|
||||
location = json['redirect'];
|
||||
}
|
||||
|
||||
if (json['error']) {
|
||||
$('#input-payment-address').addClass('is-invalid');
|
||||
$('#error-payment-address').html(json['error']).addClass('d-block');
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('#alert').prepend('<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-check"></i> ' + json['success'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
|
||||
$('#input-shipping-method').val('');
|
||||
$('#input-payment-method').val('');
|
||||
|
||||
$('#checkout-confirm').load('index.php?route=checkout/confirm.confirm&language={{ language }}');
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// New Payment Address
|
||||
$('#form-payment-address').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/payment_address.save&language={{ language }}',
|
||||
type: 'post',
|
||||
data: $('#form-payment-address').serialize(),
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
beforeSend: function() {
|
||||
$('#button-payment-address').button('loading');
|
||||
},
|
||||
complete: function() {
|
||||
$('#button-payment-address').button('reset');
|
||||
},
|
||||
success: function(json) {
|
||||
console.log(json);
|
||||
|
||||
$('#form-payment-address').find('.is-invalid').removeClass('is-invalid');
|
||||
$('#form-payment-address').find('.invalid-feedback').removeClass('d-block');
|
||||
|
||||
if (json['redirect']) {
|
||||
location = json['redirect'];
|
||||
}
|
||||
|
||||
if (json['error']) {
|
||||
if (json['error']['warning']) {
|
||||
$('#alert').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> ' + json['error']['warning'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
}
|
||||
|
||||
for (i in json['error']) {
|
||||
for (key in json['error']) {
|
||||
$('#input-payment-' + key.replaceAll('_', '-')).addClass('is-invalid').find('.form-control, .form-select, .form-check-input, .form-check-label').addClass('is-invalid');
|
||||
$('#error-payment-' + key.replaceAll('_', '-')).html(json['error'][key]).addClass('d-block');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('#alert').prepend('<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-check"></i> ' + json['success'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
|
||||
$('#form-payment-address')[0].reset();
|
||||
|
||||
var html = '<option value="">{{ text_select|escape('js') }}</option>';
|
||||
|
||||
if (json['addresses']) {
|
||||
for (i in json['addresses']) {
|
||||
html += '<option value="' + json['addresses'][i]['address_id'] + '">' + json['addresses'][i]['firstname'] + ' ' + json['addresses'][i]['lastname'] + ', ' + (json['addresses'][i]['company'] ? json['addresses'][i]['company'] + ', ' : '') + json['addresses'][i]['address_1'] + ', ' + json['addresses'][i]['city'] + ', ' + json['addresses'][i]['zone'] + ', ' + json['addresses'][i]['country'] + '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
// Payment Address
|
||||
$('#input-payment-address').html(html);
|
||||
|
||||
$('#input-payment-address').val(json['address_id']);
|
||||
|
||||
$('#payment-addresses').css({display: 'block'});
|
||||
|
||||
$('#input-payment-existing').trigger('click');
|
||||
|
||||
// Shipping Address
|
||||
var shipping_address_id = $('#input-shipping-address').val();
|
||||
|
||||
$('#input-shipping-address').html(html);
|
||||
|
||||
if (shipping_address_id) {
|
||||
$('#input-shipping-address').val(shipping_address_id);
|
||||
}
|
||||
|
||||
$('#shipping-address').css({display: 'block'});
|
||||
$('#shipping-addresses').css({display: 'block'});
|
||||
|
||||
$('#input-shipping-existing').trigger('click');
|
||||
|
||||
$('#input-shipping-method').val('');
|
||||
$('#input-payment-method').val('');
|
||||
|
||||
$('#checkout-confirm').load('index.php?route=checkout/confirm.confirm&language={{ language }}');
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#input-payment-country').on('change', function() {
|
||||
var element = this;
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=localisation/country&language={{ language }}&country_id=' + $('#input-payment-country').val(),
|
||||
dataType: 'json',
|
||||
beforeSend: function() {
|
||||
$(element).prop('disabled', true);
|
||||
$('#input-payment-zone').prop('disabled', true);
|
||||
},
|
||||
complete: function() {
|
||||
$(element).prop('disabled', false);
|
||||
$('#input-payment-zone').prop('disabled', false);
|
||||
},
|
||||
success: function(json) {
|
||||
if (json['postcode_required'] == '1') {
|
||||
$('#input-payment-postcode').parent().addClass('required');
|
||||
} else {
|
||||
$('#input-payment-postcode').parent().removeClass('required');
|
||||
}
|
||||
|
||||
html = '<option value="">{{ text_select|escape('js') }}</option>';
|
||||
|
||||
if (json['zone'] && json['zone'] != '') {
|
||||
for (i = 0; i < json['zone'].length; i++) {
|
||||
html += '<option value="' + json['zone'][i]['zone_id'] + '">' + json['zone'][i]['name'] + '</option>';
|
||||
}
|
||||
} else {
|
||||
html += '<option value="0" selected>{{ text_none|escape('js') }}</option>';
|
||||
}
|
||||
|
||||
$('#input-payment-zone').html(html);
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
//--></script>
|
230
catalog/view/template/checkout/payment_method.twig
Normal file
230
catalog/view/template/checkout/payment_method.twig
Normal file
@ -0,0 +1,230 @@
|
||||
<fieldset>
|
||||
<legend>{{ heading_title }}</legend>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fa fa-credit-card"></i></span><input type="text" name="payment_method" value="{{ payment_method }}" placeholder="{{ entry_payment_method }}" id="input-payment-method" class="form-control" readonly/>
|
||||
<button type="button" id="button-payment-methods" class="btn btn-primary">{{ button_choose }}</button>
|
||||
</div>
|
||||
<input type="hidden" name="code" value="{{ code }}" id="input-payment-code"/>
|
||||
<div id="error-payment-method" class="invalid-feedback"></div>
|
||||
</fieldset>
|
||||
<br/>
|
||||
<div class="mb-2">
|
||||
<label for="input-comment" class="form-label"><strong>{{ text_comments }}</strong></label> <textarea name="comment" rows="4" id="input-comment" class="form-control">{{ comment }}</textarea>
|
||||
</div>
|
||||
{% if text_agree %}
|
||||
<div class="form-check form-switch form-switch-lg form-check-reverse mt-3">
|
||||
<label class="form-check-label">{{ text_agree }}</label> <input type="checkbox" name="agree" value="1" id="input-checkout-agree" class="form-check-input"/>
|
||||
</div>
|
||||
{% endif %}
|
||||
<script type="text/javascript"><!--
|
||||
$('#button-payment-methods').on('click', function() {
|
||||
var element = this;
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/payment_method.getMethods&language={{ language }}',
|
||||
dataType: 'json',
|
||||
beforeSend: function() {
|
||||
$(element).button('loading');
|
||||
},
|
||||
complete: function() {
|
||||
$(element).button('reset');
|
||||
},
|
||||
success: function(json) {
|
||||
console.log(json);
|
||||
|
||||
$('#input-payment-method').removeClass('is-invalid');
|
||||
$('#error-payment-method').removeClass('d-block');
|
||||
|
||||
if (json['error']) {
|
||||
$('#input-payment-method').addClass('is-invalid');
|
||||
$('#error-payment-method').html(json['error']).addClass('d-block');
|
||||
}
|
||||
|
||||
if (json['payment_methods']) {
|
||||
$('#modal-payment').remove();
|
||||
|
||||
html = '<div id="modal-payment" class="modal">';
|
||||
html += ' <div class="modal-dialog modal-dialog-centered">';
|
||||
html += ' <div class="modal-content">';
|
||||
html += ' <div class="modal-header">';
|
||||
html += ' <h5 class="modal-title"><i class="fa fa-credit-card"></i> {{ text_payment_method|escape('js') }}</h5>';
|
||||
html += ' <button type="button" class="btn-close" data-bs-dismiss="modal"></button>';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-body">';
|
||||
html += ' <form id="form-payment-method">';
|
||||
html += ' <p>{{ text_payment|escape('js') }}</p>';
|
||||
|
||||
for (i in json['payment_methods']) {
|
||||
html += '<p><strong>' + json['payment_methods'][i]['name'] + '</strong></p>';
|
||||
|
||||
if (!json['payment_methods'][i]['error']) {
|
||||
for (j in json['payment_methods'][i]['option']) {
|
||||
html += '<div class="form-check">';
|
||||
|
||||
var code = i + '-' + j.replaceAll('_', '-');
|
||||
|
||||
html += '<input type="radio" name="payment_method" value="' + json['payment_methods'][i]['option'][j]['code'] + '" id="input-payment-method-' + code + '"';
|
||||
|
||||
if (json['payment_methods'][i]['option'][j]['code'] == $('#input-payment-code').val()) {
|
||||
html += ' checked';
|
||||
}
|
||||
|
||||
html += '/>';
|
||||
html += ' <label for="input-payment-method-' + code + '">' + json['payment_methods'][i]['option'][j]['name'] + '</label>';
|
||||
html += '</div>';
|
||||
}
|
||||
} else {
|
||||
html += '<div class="alert alert-danger">' + json['payment_methods'][i]['error'] + '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
html += ' <div class="text-end">';
|
||||
html += ' <button type="submit" id="button-payment-method" class="btn btn-primary">{{ button_continue|escape('js') }}</button>';
|
||||
html += ' </div>';
|
||||
html += ' </form>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += '</div>';
|
||||
|
||||
$('body').append(html);
|
||||
|
||||
$('#modal-payment').modal('show');
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('submit', '#form-payment-method', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var element = this;
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/payment_method.save&language={{ language }}',
|
||||
type: 'post',
|
||||
data: $('#form-payment-method').serialize(),
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
beforeSend: function() {
|
||||
$('#button-payment-method').button('loading');
|
||||
},
|
||||
complete: function() {
|
||||
$('#button-payment-method').button('reset');
|
||||
},
|
||||
success: function(json) {
|
||||
console.log(json);
|
||||
|
||||
if (json['redirect']) {
|
||||
location = json['redirect'];
|
||||
}
|
||||
|
||||
if (json['error']) {
|
||||
$('#alert').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> ' + json['error'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('#alert').prepend('<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-check"></i> ' + json['success'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
|
||||
$('#modal-payment').modal('hide');
|
||||
|
||||
$('#input-payment-method').val($('input[name=\'payment_method\']:checked').parent().find('label').text());
|
||||
$('#input-payment-code').val($('input[name=\'payment_method\']:checked').val());
|
||||
|
||||
$('#checkout-confirm').load('index.php?route=checkout/confirm.confirm&language={{ language }}');
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Comment
|
||||
var timer = '';
|
||||
|
||||
$('#input-comment').on('keydown', function() {
|
||||
$('#button-confirm').prop('disabled', true);
|
||||
|
||||
// Request
|
||||
clearTimeout(timer);
|
||||
|
||||
timer = setTimeout(function(object) {
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/payment_method.comment&language={{ language }}',
|
||||
type: 'post',
|
||||
data: $('#input-comment').serialize(),
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
success: function(json) {
|
||||
console.log(json);
|
||||
|
||||
$('.alert-dismissible').remove();
|
||||
|
||||
if (json['redirect']) {
|
||||
location = json['redirect'];
|
||||
}
|
||||
|
||||
if (json['error']) {
|
||||
$('#alert').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> ' + json['error'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
|
||||
$('#button-confirm').prop('disabled', false);
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('#alert').prepend('<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-check"></i> ' + json['success'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
|
||||
$('#button-confirm').prop('disabled', false);
|
||||
}
|
||||
|
||||
window.setTimeout(function() {
|
||||
$('.alert-dismissible').fadeTo(1000, 0, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 3000);
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
$('#button-confirm').prop('disabled', false);
|
||||
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 1000, this);
|
||||
});
|
||||
|
||||
/* Agree to terms */
|
||||
$('#input-checkout-agree').on('change', function() {
|
||||
var element = this;
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/payment_method.agree&language={{ language }}',
|
||||
type: 'post',
|
||||
data: $('#input-checkout-agree').serialize(),
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
beforeSend: function() {
|
||||
$('#button-confirm').button('loading');
|
||||
},
|
||||
complete: function() {
|
||||
$('#button-confirm').button('reset');
|
||||
},
|
||||
success: function(json) {
|
||||
$('#checkout-confirm').load('index.php?route=checkout/confirm.confirm&language={{ language }}');
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
//--></script>
|
671
catalog/view/template/checkout/register.twig
Normal file
671
catalog/view/template/checkout/register.twig
Normal file
@ -0,0 +1,671 @@
|
||||
<form id="form-register">
|
||||
<p>{{ text_login }}</p>
|
||||
<fieldset>
|
||||
<legend>{{ heading_title }}</legend>
|
||||
<div class="row">
|
||||
{% if config_checkout_guest %}
|
||||
<div class="col mb-3 required">
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="radio" name="account" value="1" id="input-register" class="form-check-input"{% if account %} checked{% endif %}/> <label for="input-register" class="form-check-label">{{ text_register }}</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="radio" name="account" value="0" id="input-guest" class="form-check-input"{% if not account %} checked{% endif %}/> <label for="input-guest" class="form-check-label">{{ text_guest }}</label>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col mb-3{% if customer_groups|length <= 1 %} d-none{% endif %}">
|
||||
<label class="form-label">{{ entry_customer_group }}</label>
|
||||
<select name="customer_group_id" id="input-customer-group" class="form-select">
|
||||
{% for customer_group in customer_groups %}
|
||||
<option value="{{ customer_group.customer_group_id }}"{% if customer_group.customer_group_id == customer_group_id %} selected{% endif %}>{{ customer_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-1 row-cols-md-2">
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-firstname" class="form-label">{{ entry_firstname }}</label>
|
||||
<input type="text" name="firstname" value="{{ firstname }}" placeholder="{{ entry_firstname }}" id="input-firstname" class="form-control"/>
|
||||
<div id="error-firstname" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-lastname" class="form-label">{{ entry_lastname }}</label>
|
||||
<input type="text" name="lastname" value="{{ lastname }}" placeholder="{{ entry_lastname }}" id="input-lastname" class="form-control"/>
|
||||
<div id="error-lastname" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-email" class="form-label">{{ entry_email }}</label>
|
||||
<input type="text" name="email" value="{{ email }}" placeholder="{{ entry_email }}" id="input-email" class="form-control"/>
|
||||
<div id="error-email" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% if config_telephone_display %}
|
||||
<div class="col mb-3{% if config_telephone_required %} required{% endif %}">
|
||||
<label for="input-telephone" class="form-label">{{ entry_telephone }}</label>
|
||||
<input type="text" name="telephone" value="{{ telephone }}" placeholder="{{ entry_telephone }}" id="input-telephone" class="form-control"/>
|
||||
<div id="error-telephone" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% for custom_field in custom_fields %}
|
||||
|
||||
{% if custom_field.location == 'account' %}
|
||||
|
||||
{% if custom_field.type == 'select' %}
|
||||
<div class="col mb-3 custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label> <select name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" id="input-customer-custom-field-{{ custom_field.custom_field_id }}" class="form-select">
|
||||
<option value="">{{ text_select }}</option>
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<option value="{{ custom_field_value.custom_field_value_id }}"{% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %} selected{% endif %}>{{ custom_field_value.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'radio' %}
|
||||
<div class="col mb-3 custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="radio" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" id="input-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"{% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %} checked{% endif %}/>
|
||||
<label for="input-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'checkbox' %}
|
||||
<div class="col mb-3 custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="checkbox" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" id="input-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"{% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in account_custom_field[custom_field.custom_field_id] %} checked{% endif %}/>
|
||||
<label for="input-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'text' %}
|
||||
<div class="col mb-3 custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" id="input-custom-field-{{ custom_field.custom_field_id }}" class="form-control"/>
|
||||
<div id="error-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'textarea' %}
|
||||
<div class="col mb-3 custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label> <textarea name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.name }}" id="input-custom-field-{{ custom_field.custom_field_id }}" class="form-control">{% if account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}</textarea>
|
||||
<div id="error-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'file' %}
|
||||
<div class="col mb-3 custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div>
|
||||
<button type="button" data-oc-toggle="upload" data-oc-url="{{ upload }}" data-oc-size-max="{{ config_file_max_size }}" data-oc-size-error="{{ error_upload_size }}" data-oc-target="#input-custom-field-{{ custom_field.custom_field_id }}" class="btn btn-light"><i class="fa-solid fa-upload"></i> {{ button_upload }}</button>
|
||||
<input type="hidden" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }}{% endif %}" id="input-custom-field-{{ custom_field.custom_field_id }}"/>
|
||||
</div>
|
||||
<div id="error-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'date' %}
|
||||
<div class="col mb-3 custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" id="input-custom-field-{{ custom_field.custom_field_id }}" class="form-control date"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'time' %}
|
||||
<div class="col mb-3 custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" id="input-custom-field-{{ custom_field.custom_field_id }}" class="form-control time"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'datetime' %}
|
||||
<div class="col mb-3 custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" id="input-custom-field-{{ custom_field.custom_field_id }}" class="form-control datetime"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</fieldset>
|
||||
{% if config_checkout_payment_address %}
|
||||
<fieldset>
|
||||
<legend>{{ text_payment_address }}</legend>
|
||||
<div class="row row-cols-1 row-cols-md-2">
|
||||
<div class="col mb-3">
|
||||
<label for="input-payment-company" class="form-label">{{ entry_company }}</label> <input type="text" name="payment_company" value="{{ payment_company }}" placeholder="{{ entry_company }}" id="input-payment-company" class="form-control"/>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-address-1" class="form-label">{{ entry_address_1 }}</label> <input type="text" name="payment_address_1" value="{{ payment_address_1 }}" placeholder="{{ entry_address_1 }}" id="input-payment-address-1" class="form-control"/>
|
||||
<div id="error-payment-address-1" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3">
|
||||
<label for="input-payment-address-2" class="form-label">{{ entry_address_2 }}</label> <input type="text" name="payment_address_2" value="{{ payment_address_2 }}" placeholder="{{ entry_address_2 }}" id="input-payment-address-2" class="form-control"/>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-city" class="form-label">{{ entry_city }}</label> <input type="text" name="payment_city" value="{{ payment_city }}" placeholder="{{ entry_city }}" id="input-payment-city" class="form-control"/>
|
||||
<div id="error-payment-city" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-postcode" class="form-label">{{ entry_postcode }}</label> <input type="text" name="payment_postcode" value="{{ payment_postcode }}" placeholder="{{ entry_postcode }}" id="input-payment-postcode" class="form-control"/>
|
||||
<div id="error-payment-postcode" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-country" class="form-label">{{ entry_country }}</label> <select name="payment_country_id" id="input-payment-country" class="form-select">
|
||||
<option value="">{{ text_select }}</option>
|
||||
{% for country in countries %}
|
||||
<option value="{{ country.country_id }}"{% if country.country_id == payment_country_id %} selected{% endif %}>{{ country.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-payment-country" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-payment-zone" class="form-label">{{ entry_zone }}</label>
|
||||
<select name="payment_zone_id" id="input-payment-zone" class="form-select" data-oc-value="{{ payment_zone_id }}"></select>
|
||||
<div id="error-payment-zone" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% for custom_field in custom_fields %}
|
||||
{% if custom_field.location == 'address' %}
|
||||
|
||||
{% if custom_field.type == 'select' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label> <select name="payment_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" id="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-select">
|
||||
<option value="">{{ text_select }}</option>
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<option value="{{ custom_field_value.custom_field_value_id }}"{% if payment_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == payment_custom_field[custom_field.custom_field_id] %} selected{% endif %}>{{ custom_field_value.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'radio' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-payment-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="radio" name="payment_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" id="input-payment-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"{% if payment_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == payment_custom_field[custom_field.custom_field_id] %} checked{% endif %}/> <label for="input-payment-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if custom_field.type == 'checkbox' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-payment-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="checkbox" name="payment_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" id="input-payment-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"{% if address_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in address_custom_field[custom_field.custom_field_id] %} checked{% endif %}/> <label for="input-payment-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if custom_field.type == 'text' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<input type="text" name="payment_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if address_custom_field[custom_field.custom_field_id] %}{{ address_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"/>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if custom_field.type == 'textarea' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label> <textarea name="payment_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 address_custom_field[custom_field.custom_field_id] %}{{ address_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}</textarea>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if custom_field.type == 'file' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div>
|
||||
<button type="button" data-oc-toggle="upload" data-oc-url="{{ upload }}" data-oc-size-max="{{ config_file_max_size }}" data-oc-size-error="{{ error_upload_size }}" data-oc-target="#input-payment-custom-field-{{ custom_field.custom_field_id }}" class="btn btn-light"><i class="fa-solid fa-upload"></i> {{ button_upload }}</button>
|
||||
<input type="hidden" name="payment_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if payment_custom_field[custom_field.custom_field_id] %}{{ payment_custom_field[custom_field.custom_field_id] }}{% endif %}" id="input-payment-custom-field-{{ custom_field.custom_field_id }}"/>
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if custom_field.type == 'date' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="payment_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if payment_custom_field[custom_field.custom_field_id] %}{{ payment_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 date"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if custom_field.type == 'time' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="payment_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if payment_custom_field[custom_field.custom_field_id] %}{{ payment_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 time"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'datetime' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-payment-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="payment_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if payment_custom_field[custom_field.custom_field_id] %}{{ payment_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 datetime"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-payment-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if shipping_required %}
|
||||
<div class="col mb-3">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" name="address_match" value="1" id="input-address-match" class="form-check-input" checked/> <label for="input-address-match" class="form-check-label">{{ entry_match }}</label>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
<fieldset id="shipping-address" style="display: {% if not config_checkout_payment_address %}block{% else %}none{% endif %};">
|
||||
<legend>{{ text_shipping_address }}</legend>
|
||||
<div class="row row-cols-1 row-cols-md-2">
|
||||
{% if config_checkout_payment_address %}
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-firstname" class="form-label">{{ entry_firstname }}</label>
|
||||
<input type="text" name="shipping_firstname" value="{{ shipping_firstname }}" placeholder="{{ entry_firstname }}" id="input-shipping-firstname" class="form-control"/>
|
||||
<div id="error-shipping-firstname" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-lastname" class="form-label">{{ entry_lastname }}</label>
|
||||
<input type="text" name="shipping_lastname" value="{{ shipping_lastname }}" placeholder="{{ entry_lastname }}" id="input-shipping-lastname" class="form-control"/>
|
||||
<div id="error-shipping-lastname" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col mb-3">
|
||||
<label for="input-shipping-company" class="form-label">{{ entry_company }}</label>
|
||||
<input type="text" name="shipping_company" value="{{ shipping_company }}" placeholder="{{ entry_company }}" id="input-shipping-company" class="form-control"/>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-address-1" class="form-label">{{ entry_address_1 }}</label>
|
||||
<input type="text" name="shipping_address_1" value="{{ shipping_address_1 }}" placeholder="{{ entry_address_1 }}" id="input-shipping-address-1" class="form-control"/>
|
||||
<div id="error-shipping-address-1" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3">
|
||||
<label for="input-shipping-address-2" class="form-label">{{ entry_address_2 }}</label>
|
||||
<input type="text" name="shipping_address_2" value="{{ shipping_address_2 }}" placeholder="{{ entry_address_2 }}" id="input-shipping-address-2" class="form-control"/>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-city" class="form-label">{{ entry_city }}</label>
|
||||
<input type="text" name="shipping_city" value="{{ shipping_city }}" placeholder="{{ entry_city }}" id="input-shipping-city" class="form-control"/>
|
||||
<div id="error-shipping-city" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-postcode" class="form-label">{{ entry_postcode }}</label>
|
||||
<input type="text" name="shipping_postcode" value="{{ shipping_postcode }}" placeholder="{{ entry_postcode }}" id="input-shipping-postcode" class="form-control"/>
|
||||
<div id="error-shipping-postcode" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-country" class="form-label">{{ entry_country }}</label>
|
||||
<select name="shipping_country_id" id="input-shipping-country" class="form-select">
|
||||
<option value="">{{ text_select }}</option>
|
||||
{% for country in countries %}
|
||||
<option value="{{ country.country_id }}"{% if country.country_id == shipping_country_id %} selected{% endif %}>{{ country.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-shipping-country" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-zone" class="form-label">{{ entry_zone }}</label>
|
||||
<select name="shipping_zone_id" id="input-shipping-zone" class="form-select" data-oc-value="{{ shipping_zone_id }}"></select>
|
||||
<div id="error-shipping-zone" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% for custom_field in custom_fields %}
|
||||
{% if custom_field.location == 'address' %}
|
||||
|
||||
{% if custom_field.type == 'select' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<select name="shipping_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-select">
|
||||
<option value="">{{ text_select }}</option>
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<option value="{{ custom_field_value.custom_field_value_id }}"{% if shipping_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == shipping_custom_field[custom_field.custom_field_id] %} selected{% endif %}>{{ custom_field_value.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'radio' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-shipping-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="radio" name="shipping_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" id="input-shipping-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"{% if shipping_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in shipping_custom_field[custom_field.custom_field_id] %} checked{% endif %}/>
|
||||
<label for="input-shipping-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'checkbox' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-shipping-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="checkbox" name="shipping_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" id="input-shipping-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"{% if shipping_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in shipping_custom_field[custom_field.custom_field_id] %} checked{% endif %}/>
|
||||
<label for="input-shipping-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'text' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<input type="text" name="shipping_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if shipping_custom_field[custom_field.custom_field_id] %}{{ shipping_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control"/>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'textarea' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<textarea name="shipping_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" rows="5" placeholder="{% if shipping_custom_field[custom_field.custom_field_id] %}{{ shipping_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control">{{ custom_field.value }}</textarea>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if custom_field.type == 'file' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div>
|
||||
<button type="button" data-oc-toggle="upload" data-oc-url="{{ upload }}" data-oc-size-max="{{ config_file_max_size }}" data-oc-size-error="{{ error_upload_size }}" data-oc-target="#input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="btn btn-light"><i class="fa-solid fa-upload"></i> {{ button_upload }}</button>
|
||||
<input type="hidden" name="shipping_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if shipping_custom_field[custom_field.custom_field_id] %}{{ shipping_custom_field[custom_field.custom_field_id] }}{% endif %}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}"/>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'date' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="shipping_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if shipping_custom_field[custom_field.custom_field_id] %}{{ shipping_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control date"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'time' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="shipping_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if shipping_custom_field[custom_field.custom_field_id] %}{{ shipping_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control time"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'datetime' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="shipping_custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if shipping_custom_field[custom_field.custom_field_id] %}{{ shipping_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control datetime"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</fieldset>
|
||||
<div id class="row row-cols-1 row-cols-md-2">
|
||||
<div id="password" class="col mb-3 required">
|
||||
<fieldset>
|
||||
<legend>{{ text_your_password }}</legend>
|
||||
<div class="row">
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-password" class="form-label">{{ entry_password }}</label> <input type="password" name="password" value="" placeholder="{{ entry_password }}" id="input-password" class="form-control"/>
|
||||
<div id="error-password" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="col mb-3 required">{{ captcha }}</div>
|
||||
</div>
|
||||
<div id class="row">
|
||||
<div class="col">
|
||||
<div class="form-check form-switch form-switch-lg">
|
||||
<label for="input-newsletter" class="form-check-label">{{ entry_newsletter }}</label>
|
||||
<input type="checkbox" name="newsletter" value="1" id="input-newsletter" class="form-check-input"/>
|
||||
</div>
|
||||
{% if text_agree %}
|
||||
<div id="register-agree" class="form-check form-switch form-switch-lg">
|
||||
<label class="form-check-label">{{ text_agree }}</label>
|
||||
<input type="checkbox" name="agree" value="1" id="input-register-agree" class="form-check-input"{% if agree %} checked{% endif %}/>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button type="submit" id="button-register" class="btn btn-primary mt-2">{{ button_continue }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript"><!--
|
||||
// Account
|
||||
$('input[name=\'account\']').on('click', function() {
|
||||
if ($(this).val() == 1) {
|
||||
$('#password').removeClass('d-none');
|
||||
} else {
|
||||
// If guest hide password field
|
||||
$('#password').addClass('d-none');
|
||||
}
|
||||
|
||||
if ($(this).val() == 1) {
|
||||
$('#register-agree').removeClass('d-none');
|
||||
} else {
|
||||
// If guest hide register agree field
|
||||
$('#register-agree').addClass('d-none');
|
||||
}
|
||||
});
|
||||
|
||||
$('input[name=\'account\']:checked').trigger('click');
|
||||
|
||||
// Customer Group
|
||||
$('#input-customer-group').on('change', function() {
|
||||
var element = this;
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=account/custom_field&language={{ language }}&customer_group_id=' + $(element).val(),
|
||||
dataType: 'json',
|
||||
beforeSend: function() {
|
||||
$(element).prop('disabled', true);
|
||||
},
|
||||
complete: function() {
|
||||
$(element).prop('disabled', false);
|
||||
},
|
||||
success: function(json) {
|
||||
$('.custom-field').addClass('d-none');
|
||||
$('.custom-field').removeClass('required');
|
||||
|
||||
for (i = 0; i < json.length; i++) {
|
||||
custom_field = json[i];
|
||||
|
||||
$('.custom-field-' + custom_field['custom_field_id']).removeClass('d-none');
|
||||
|
||||
if (custom_field['required']) {
|
||||
$('.custom-field-' + custom_field['custom_field_id']).addClass('required');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#input-customer-group').trigger('change');
|
||||
|
||||
$('#input-address-match').on('change', function() {
|
||||
if ($(this).prop('checked')) {
|
||||
$('#shipping-address').hide();
|
||||
} else {
|
||||
$('#shipping-address').show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#form-register').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var element = this;
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/register.save&language={{ language }}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: $('#form-register').serialize(),
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
beforeSend: function() {
|
||||
$('#button-register').button('loading');
|
||||
},
|
||||
complete: function() {
|
||||
$('#button-register').button('reset');
|
||||
},
|
||||
success: function(json) {
|
||||
console.log(json);
|
||||
|
||||
$('#form-register').find('.is-invalid').removeClass('is-invalid');
|
||||
$('#form-register').find('.invalid-feedback').removeClass('d-block');
|
||||
|
||||
if (json['redirect']) {
|
||||
location = json['redirect'];
|
||||
}
|
||||
|
||||
if (json['error']) {
|
||||
if (json['error']['warning']) {
|
||||
$('#alert').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> ' + json['error']['warning'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
}
|
||||
|
||||
for (key in json['error']) {
|
||||
$('#input-' + key.replaceAll('_', '-')).addClass('is-invalid').find('.form-control, .form-select, .form-check-input, .form-check-label').addClass('is-invalid');
|
||||
$('#error-' + key.replaceAll('_', '-')).html(json['error'][key]).addClass('d-block');
|
||||
}
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('#alert').prepend('<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-check"></i> ' + json['success'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
|
||||
if ($('#input-register').prop('checked')) {
|
||||
$('input[name=\'account\']').prop('disabled', true);
|
||||
$('#input-customer-group').prop('disabled', true);
|
||||
$('#input-password').prop('disabled', true);
|
||||
$('#input-captcha').prop('disabled', true);
|
||||
$('#input-register-agree').prop('disabled', true);
|
||||
}
|
||||
|
||||
$('#input-shipping-method').val('');
|
||||
$('#input-payment-method').val('');
|
||||
|
||||
$('#checkout-confirm').load('index.php?route=checkout/confirm.confirm&language={{ language }}');
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('select[name$=\'_country_id\']').on('change', function() {
|
||||
var element = this;
|
||||
var type = $(this).attr('name').slice(0, -11);
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=localisation/country&language={{ language }}&country_id=' + $('#input-' + type + '-country').val(),
|
||||
dataType: 'json',
|
||||
beforeSend: function() {
|
||||
$(element).prop('disabled', true);
|
||||
$('#input-' + type + '-zone').prop('disabled', true);
|
||||
},
|
||||
complete: function() {
|
||||
$(element).prop('disabled', false);
|
||||
$('#input-' + type + '-zone').prop('disabled', false);
|
||||
},
|
||||
success: function(json) {
|
||||
if (json['postcode_required'] == '1') {
|
||||
$('#input-' + type + '-postcode').parent().addClass('required');
|
||||
} else {
|
||||
$('#input-' + type + '-postcode').parent().removeClass('required');
|
||||
}
|
||||
|
||||
html = '<option value="">{{ text_select|escape('js') }}</option>';
|
||||
|
||||
if (json['zone'] && json['zone'] != '') {
|
||||
for (i = 0; i < json['zone'].length; i++) {
|
||||
html += '<option value="' + json['zone'][i]['zone_id'] + '"';
|
||||
|
||||
if (json['zone'][i]['zone_id'] == $('#input-' + type + '-zone').attr('data-oc-value')) {
|
||||
html += ' selected';
|
||||
}
|
||||
|
||||
html += '>' + json['zone'][i]['name'] + '</option>';
|
||||
}
|
||||
} else {
|
||||
html += '<option value="0" selected>{{ text_none|escape('js') }}</option>';
|
||||
}
|
||||
|
||||
$('#input-' + type + '-zone').html(html);
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('select[name$=\'_country_id\']').trigger('change');
|
||||
//--></script>
|
382
catalog/view/template/checkout/shipping_address.twig
Normal file
382
catalog/view/template/checkout/shipping_address.twig
Normal file
@ -0,0 +1,382 @@
|
||||
<fieldset id="shipping-address" style="display: {% if payment_address_required and not addresses %}none{% else %}block{% endif %};">
|
||||
<legend>{{ heading_title }}</legend>
|
||||
<div id="shipping-addresses" style="display: {% if addresses %}block{% else %}none{% endif %};">
|
||||
<div class="form-check">
|
||||
<input type="radio" name="shipping_existing" value="1" id="input-shipping-existing" class="form-check-input"{% if addresses %} checked{% endif %}/>
|
||||
<label for="input-shipping-existing" class="form-check-label">{{ text_address_existing }}</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input type="radio" name="shipping_existing" value="0" id="input-shipping-new" class="form-check-input"{% if not addresses %} checked{% endif %}/>
|
||||
<label for="input-shipping-new" class="form-check-label">{{ text_address_new }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="shipping-existing" style="display: {% if addresses %}block{% else %}none{% endif %};">
|
||||
<select name="address_id" id="input-shipping-address" class="form-select">
|
||||
<option value="">{{ text_select }}</option>
|
||||
{% for address in addresses %}
|
||||
<option value="{{ address.address_id }}"{% if address.address_id == address_id %} selected{% endif %}>{{ address.firstname }} {{ address.lastname }},{% if address.company %} {{ address.company }},{% endif %} {{ address.address_1 }}, {{ address.city }}, {{ address.zone }}, {{ address.country }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-shipping-address" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<br/>
|
||||
<div id="shipping-new" style="display: {% if not addresses %}block{% else %}none{% endif %};">
|
||||
<form id="form-shipping-address">
|
||||
<div class="row row-cols-1 row-cols-md-2">
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-firstname" class="form-label">{{ entry_firstname }}</label >
|
||||
<input type="text" name="firstname" value="" placeholder="{{ entry_firstname }}" id="input-shipping-firstname" class="form-control"/>
|
||||
<div id="error-shipping-firstname" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-lastname" class="form-label">{{ entry_lastname }}</label>
|
||||
<input type="text" name="lastname" value="" placeholder="{{ entry_lastname }}" id="input-shipping-lastname" class="form-control"/>
|
||||
<div id="error-shipping-lastname" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3">
|
||||
<label for="input-shipping-company" class="form-label">{{ entry_company }}</label>
|
||||
<input type="text" name="company" value="" placeholder="{{ entry_company }}" id="input-shipping-company" class="form-control"/>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-address-1" class="form-label">{{ entry_address_1 }}</label>
|
||||
<input type="text" name="address_1" value="" placeholder="{{ entry_address_1 }}" id="input-shipping-address-1" class="form-control"/>
|
||||
<div id="error-shipping-address-1" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3">
|
||||
<label for="input-shipping-address-2" class="form-label">{{ entry_address_2 }}</label>
|
||||
<input type="text" name="address_2" value="" placeholder="{{ entry_address_2 }}" id="input-shipping-address-2" class="form-control"/>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-city" class="form-label">{{ entry_city }}</label>
|
||||
<input type="text" name="city" value="" placeholder="{{ entry_city }}" id="input-shipping-city" class="form-control"/>
|
||||
<div id="error-shipping-city" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-postcode" class="form-label">{{ entry_postcode }}</label>
|
||||
<input type="text" name="postcode" value="{{ postcode }}" placeholder="{{ entry_postcode }}" id="input-shipping-postcode" class="form-control"/>
|
||||
<div id="error-shipping-postcode" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-country" class="form-label">{{ entry_country }}</label>
|
||||
<select name="country_id" id="input-shipping-country" class="form-select">
|
||||
<option value="0">{{ text_select }}</option>
|
||||
{% for country in countries %}
|
||||
<option value="{{ country.country_id }}"{% if country.country_id == country_id %} selected{% endif %}>{{ country.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-shipping-country" class="invalid-feedback"></div>
|
||||
</div>
|
||||
|
||||
<div class="col mb-3 required">
|
||||
<label for="input-shipping-zone" class="form-label">{{ entry_zone }}</label>
|
||||
<select name="zone_id" id="input-shipping-zone" class="form-select"></select>
|
||||
<div id="error-shipping-zone" class="invalid-feedback"></div>
|
||||
</div>
|
||||
|
||||
{% for custom_field in custom_fields %}
|
||||
|
||||
{% if custom_field.type == 'select' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<select name="custom_field[{{ custom_field.custom_field_id }}]" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-select">
|
||||
<option value="">{{ text_select }}</option>
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'radio' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-shipping-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="radio" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" id="input-shipping-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"/>
|
||||
<label for="input-shipping-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'checkbox' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div id="input-shipping-custom-field-{{ custom_field.custom_field_id }}">
|
||||
{% for custom_field_value in custom_field.custom_field_value %}
|
||||
<div class="form-check">
|
||||
<input type="checkbox" name="custom_field[{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" id="input-shipping-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-input"/>
|
||||
<label for="input-shipping-custom-value-{{ custom_field_value.custom_field_value_id }}" class="form-check-label">{{ custom_field_value.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'text' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control"/>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'textarea' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<textarea name="custom_field[{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.value }}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control">{{ custom_field.value }}</textarea>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'file' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label class="form-label">{{ custom_field.name }}</label>
|
||||
<div>
|
||||
<button type="button" data-oc-toggle="upload" data-oc-url="{{ upload }}" data-oc-size-max="{{ config_file_max_size }}" data-oc-size-error="{{ error_upload_size }}" data-oc-target="#input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="btn btn-light"><i class="fa-solid fa-upload"></i> {{ button_upload }}</button>
|
||||
<input type="hidden" name="custom_field{{ custom_field.custom_field_id }}]" value="" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}"/>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'date' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control date"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'time' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control time"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if custom_field.type == 'datetime' %}
|
||||
<div class="col mb-3{% if custom_field.required %} required{% endif %} custom-field custom-field-{{ custom_field.custom_field_id }}">
|
||||
<label for="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-label">{{ custom_field.name }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field-{{ custom_field.custom_field_id }}" class="form-control datetime"/>
|
||||
<div class="input-group-text"><i class="fa-regular fa-calendar"></i></div>
|
||||
</div>
|
||||
<div id="error-shipping-custom-field-{{ custom_field.custom_field_id }}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
<div class="text-end mb-3">
|
||||
<button type="submit" id="button-shipping-address" class="btn btn-primary">{{ button_continue }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
<script type="text/javascript"><!--
|
||||
$('input[name=\'shipping_existing\']').on('change', function () {
|
||||
if ($(this).val() == 1) {
|
||||
$('#shipping-existing').show();
|
||||
$('#shipping-new').hide();
|
||||
} else {
|
||||
$('#shipping-existing').hide();
|
||||
$('#shipping-new').show();
|
||||
}
|
||||
});
|
||||
|
||||
// Existing Shipping Address
|
||||
$('#input-shipping-address').on('change', function () {
|
||||
var element = this;
|
||||
|
||||
chain.attach(function () {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/shipping_address.address&language={{ language }}&address_id=' + $(element).val(),
|
||||
dataType: 'json',
|
||||
beforeSend: function () {
|
||||
$(element).prop('disabled', true);
|
||||
},
|
||||
complete: function () {
|
||||
$(element).prop('disabled', false);
|
||||
},
|
||||
success: function (json) {
|
||||
console.log(json);
|
||||
|
||||
$('#input-shipping-address').removeClass('is-invalid');
|
||||
$('#error-shipping-address').removeClass('d-block');
|
||||
|
||||
if (json['redirect']) {
|
||||
location = json['redirect'];
|
||||
}
|
||||
|
||||
if (json['error']) {
|
||||
$('#input-shipping-address').addClass('is-invalid');
|
||||
$('#error-shipping-address').html(json['error']).addClass('d-block');
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('#alert').prepend('<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-check"></i> ' + json['success'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
|
||||
$('#input-shipping-method').val('');
|
||||
$('#input-payment-method').val('');
|
||||
|
||||
$('#checkout-confirm').load('index.php?route=checkout/confirm.confirm&language={{ language }}');
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// New Shipping Address
|
||||
$('#form-shipping-address').on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
chain.attach(function () {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/shipping_address.save&language={{ language }}',
|
||||
type: 'post',
|
||||
data: $('#form-shipping-address').serialize(),
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
beforeSend: function () {
|
||||
$('#button-shipping-address').button('loading');
|
||||
},
|
||||
complete: function () {
|
||||
$('#button-shipping-address').button('reset');
|
||||
},
|
||||
success: function (json) {
|
||||
console.log(json);
|
||||
|
||||
$('#form-shipping-address').find('.is-invalid').removeClass('is-invalid');
|
||||
$('#form-shipping-address').find('.invalid-feedback').removeClass('d-block');
|
||||
|
||||
if (json['redirect']) {
|
||||
location = json['redirect'];
|
||||
}
|
||||
|
||||
if (json['error']) {
|
||||
if (json['error']['warning']) {
|
||||
$('#alert').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> ' + json['error']['warning'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
}
|
||||
|
||||
for (i in json['error']) {
|
||||
for (key in json['error']) {
|
||||
$('#input-shipping-' + key.replaceAll('_', '-')).addClass('is-invalid').find('.form-control, .form-select, .form-check-input, .form-check-label').addClass('is-invalid');
|
||||
$('#error-shipping-' + key.replaceAll('_', '-')).html(json['error'][key]).addClass('d-block');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('#alert').prepend('<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-check"></i> ' + json['success'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
|
||||
$('#form-shipping-address')[0].reset();
|
||||
|
||||
var html = '<option value="">{{ text_select|escape('js') }}</option>';
|
||||
|
||||
if (json['addresses']) {
|
||||
for (i in json['addresses']) {
|
||||
html += '<option value="' + json['addresses'][i]['address_id'] + '">' + json['addresses'][i]['firstname'] + ' ' + json['addresses'][i]['lastname'] + ', ' + (json['addresses'][i]['company'] ? json['addresses'][i]['company'] + ', ' : '') + json['addresses'][i]['address_1'] + ', ' + json['addresses'][i]['city'] + ', ' + json['addresses'][i]['zone'] + ', ' + json['addresses'][i]['country'] + '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
// Shipping Address
|
||||
$('#input-shipping-address').html(html);
|
||||
|
||||
$('#input-shipping-address').val(json['address_id']);
|
||||
|
||||
$('#shipping-addresses').css({display: 'block'});
|
||||
|
||||
$('#input-shipping-existing').trigger('click');
|
||||
|
||||
// Payment Address
|
||||
var payment_address_id = $('#input-payment-address').val();
|
||||
|
||||
$('#input-payment-address').html(html);
|
||||
|
||||
if (payment_address_id) {
|
||||
$('#input-payment-address').val(payment_address_id);
|
||||
}
|
||||
|
||||
$('#payment-addresses').css({display: 'block'});
|
||||
|
||||
$('#input-payment-existing').trigger('click');
|
||||
|
||||
$('#input-shipping-method').val('');
|
||||
$('#input-payment-method').val('');
|
||||
|
||||
$('#checkout-confirm').load('index.php?route=checkout/confirm.confirm&language={{ language }}');
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#input-shipping-country').on('change', function () {
|
||||
var element = this;
|
||||
|
||||
chain.attach(function () {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=localisation/country&language={{ language }}&country_id=' + $('#input-shipping-country').val(),
|
||||
dataType: 'json',
|
||||
beforeSend: function () {
|
||||
$(element).prop('disabled', true);
|
||||
$('#input-shipping-zone').prop('disabled', true);
|
||||
},
|
||||
complete: function () {
|
||||
$(element).prop('disabled', false);
|
||||
$('#input-shipping-zone').prop('disabled', false);
|
||||
},
|
||||
success: function (json) {
|
||||
if (json['postcode_required'] == '1') {
|
||||
$('#input-shipping-postcode').parent().addClass('required');
|
||||
} else {
|
||||
$('#input-shipping-postcode').parent().removeClass('required');
|
||||
}
|
||||
|
||||
html = '<option value="">{{ text_select|escape('js') }}</option>';
|
||||
|
||||
if (json['zone'] && json['zone'] != '') {
|
||||
for (i = 0; i < json['zone'].length; i++) {
|
||||
html += '<option value="' + json['zone'][i]['zone_id'] + '"';
|
||||
|
||||
if (json['zone'][i]['zone_id'] == '{{ zone_id }}') {
|
||||
html += ' selected';
|
||||
}
|
||||
|
||||
html += '>' + json['zone'][i]['name'] + '</option>';
|
||||
}
|
||||
} else {
|
||||
html += '<option value="0" selected>{{ text_none|escape('js') }}</option>';
|
||||
}
|
||||
|
||||
$('#input-shipping-zone').html(html);
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#input-shipping-country').trigger('change');
|
||||
//--></script>
|
142
catalog/view/template/checkout/shipping_method.twig
Normal file
142
catalog/view/template/checkout/shipping_method.twig
Normal file
@ -0,0 +1,142 @@
|
||||
<fieldset>
|
||||
<legend>{{ heading_title }}</legend>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fa fa-truck"></i></span><input type="text" name="shipping_method" value="{{ shipping_method }}" placeholder="{{ entry_shipping_method }}" id="input-shipping-method" class="form-control" readonly/>
|
||||
<button type="button" id="button-shipping-methods" class="btn btn-primary">{{ button_choose }}</button>
|
||||
</div>
|
||||
<input type="hidden" name="code" value="{{ code }}" id="input-shipping-code"/>
|
||||
<div id="error-shipping-method" class="invalid-feedback"></div>
|
||||
</fieldset>
|
||||
<script type="text/javascript"><!--
|
||||
$('#button-shipping-methods').on('click', function() {
|
||||
var element = this;
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/shipping_method.quote&language={{ language }}',
|
||||
dataType: 'json',
|
||||
beforeSend: function() {
|
||||
$(element).button('loading');
|
||||
},
|
||||
complete: function() {
|
||||
$(element).button('reset');
|
||||
},
|
||||
success: function(json) {
|
||||
console.log(json);
|
||||
|
||||
$('#input-shipping-method').removeClass('is-invalid');
|
||||
$('#error-shipping-method').removeClass('d-block');
|
||||
|
||||
if (json['error']) {
|
||||
$('#input-shipping-method').addClass('is-invalid');
|
||||
$('#error-shipping-method').html(json['error']).addClass('d-block');
|
||||
}
|
||||
|
||||
if (json['shipping_methods']) {
|
||||
$('#modal-shipping').remove();
|
||||
|
||||
html = '<div id="modal-shipping" class="modal">';
|
||||
html += ' <div class="modal-dialog modal-dialog-centered">';
|
||||
html += ' <div class="modal-content">';
|
||||
html += ' <div class="modal-header">';
|
||||
html += ' <h5 class="modal-title"><i class="fa fa-truck"></i> {{ text_shipping_method|escape('js') }}</h5>';
|
||||
html += ' <button type="button" class="btn-close" data-bs-dismiss="modal"></button>';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-body">';
|
||||
html += ' <form id="form-shipping-method">';
|
||||
html += ' <p>{{ text_shipping|escape('js') }}</p>';
|
||||
|
||||
for (i in json['shipping_methods']) {
|
||||
html += '<p><strong>' + json['shipping_methods'][i]['name'] + '</strong></p>';
|
||||
|
||||
if (!json['shipping_methods'][i]['error']) {
|
||||
for (j in json['shipping_methods'][i]['quote']) {
|
||||
html += '<div class="form-check">';
|
||||
|
||||
var code = i + '-' + j.replaceAll('_', '-');
|
||||
|
||||
html += '<input type="radio" name="shipping_method" value="' + json['shipping_methods'][i]['quote'][j]['code'] + '" id="input-shipping-method-' + code + '"';
|
||||
|
||||
if (json['shipping_methods'][i]['quote'][j]['code'] == $('#input-shipping-code').val()) {
|
||||
html += ' checked';
|
||||
}
|
||||
|
||||
html += '/>';
|
||||
html += ' <label for="input-shipping-method-' + code + '">' + json['shipping_methods'][i]['quote'][j]['name'] + ' - ' + json['shipping_methods'][i]['quote'][j]['text'] + '</label>';
|
||||
html += '</div>';
|
||||
}
|
||||
} else {
|
||||
html += '<div class="alert alert-danger">' + json['shipping_methods'][i]['error'] + '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
html += ' <div class="text-end">';
|
||||
html += ' <button type="submit" id="button-shipping-method" class="btn btn-primary">{{ button_continue|escape('js') }}</button>';
|
||||
html += ' </div>';
|
||||
html += ' </form>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += '</div>';
|
||||
|
||||
$('body').append(html);
|
||||
|
||||
$('#modal-shipping').modal('show');
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('submit', '#form-shipping-method', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var element = this;
|
||||
|
||||
chain.attach(function() {
|
||||
return $.ajax({
|
||||
url: 'index.php?route=checkout/shipping_method.save&language={{ language }}',
|
||||
type: 'post',
|
||||
data: $('#form-shipping-method').serialize(),
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
beforeSend: function() {
|
||||
$('#button-shipping-method').button('loading');
|
||||
},
|
||||
complete: function() {
|
||||
$('#button-shipping-method').button('reset');
|
||||
},
|
||||
success: function(json) {
|
||||
console.log(json);
|
||||
|
||||
if (json['redirect']) {
|
||||
location = json['redirect'];
|
||||
}
|
||||
|
||||
if (json['error']) {
|
||||
$('#alert').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> ' + json['error'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('#alert').prepend('<div class="alert alert-success alert-dismissible"><i class="fa-solid fa-circle-check"></i> ' + json['success'] + ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>');
|
||||
|
||||
$('#modal-shipping').modal('hide');
|
||||
|
||||
$('#input-shipping-method').val($('input[name=\'shipping_method\']:checked').parent().find('label').text());
|
||||
$('#input-shipping-code').val($('input[name=\'shipping_method\']:checked').val());
|
||||
|
||||
$('#input-payment-method').val('');
|
||||
|
||||
$('#checkout-confirm').load('index.php?route=checkout/confirm.confirm&language={{ language }}');
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
//--></script>
|
82
catalog/view/template/checkout/voucher.twig
Normal file
82
catalog/view/template/checkout/voucher.twig
Normal file
@ -0,0 +1,82 @@
|
||||
{{ header }}
|
||||
<div id="account-voucher" class="container">
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li class="breadcrumb-item"><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if error_warning %}
|
||||
<div class="alert alert-danger alert-dismissible"><i class="fa-solid fa-circle-exclamation"></i> {{ error_warning }}</div>
|
||||
{% endif %}
|
||||
<div class="row">{{ column_left }}
|
||||
<div id="content" class="col">{{ content_top }}
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<p>{{ text_description }}</p>
|
||||
<form id="form-voucher" action="{{ save }}" method="post" data-oc-toggle="ajax">
|
||||
<div class="row mb-3 required">
|
||||
<label for="input-to-name" class="col-sm-2 col-form-label">{{ entry_to_name }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="to_name" value="{{ to_name }}" placeholder="{{ entry_to_name }}" id="input-to-name" class="form-control"/>
|
||||
<div id="error-to-name" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 required">
|
||||
<label for="input-to-email" class="col-sm-2 col-form-label">{{ entry_to_email }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="to_email" value="{{ to_email }}" placeholder="{{ entry_to_email }}" id="input-to-email" class="form-control"/>
|
||||
<div id="error-to-email" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 required">
|
||||
<label for="input-from-name" class="col-sm-2 col-form-label">{{ entry_from_name }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="from_name" value="{{ from_name }}" placeholder="{{ entry_from_name }}" id="input-from-name" class="form-control"/>
|
||||
<div id="error-from-name" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 required">
|
||||
<label for="input-from-email" class="col-sm-2 col-form-label">{{ entry_from_email }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="from_email" value="{{ from_email }}" placeholder="{{ entry_from_email }}" id="input-from-email" class="form-control"/>
|
||||
<div id="error-from-email" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 required">
|
||||
<label class="col-sm-2 col-form-label">{{ entry_theme }}</label>
|
||||
<div class="col-sm-10">
|
||||
<div id="input-theme">
|
||||
{% for voucher_theme in voucher_themes %}
|
||||
<div class="form-check">
|
||||
<input type="radio" name="voucher_theme_id" value="{{ voucher_theme.voucher_theme_id }}" id="input-theme-{{ voucher_theme.voucher_theme_id }}" class="form-check-input"{% if voucher_theme.voucher_theme_id == voucher_theme_id %} checked{% endif %}/> <label for="input-theme-{{ voucher_theme.voucher_theme_id }}" class="form-check-label">{{ voucher_theme.name }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="error-theme" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="input-message" class="col-sm-2 col-form-label"><span data-bs-toggle="tooltip" title="{{ help_message }}" class="col-sm-2 col-form-label">{{ entry_message }}</span></label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="message" cols="40" rows="5" placeholder="{{ entry_message }}" id="input-message" class="form-control">{{ message }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 required">
|
||||
<label for="input-amount" class="col-sm-2 col-form-label"><span data-bs-toggle="tooltip" title="{{ help_amount }}">{{ entry_amount }}</span></label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="amount" value="{{ amount }}" placeholder="{{ entry_amount }}" id="input-amount" class="form-control" size="5"/>
|
||||
<div id="error-amount" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-end">
|
||||
<div class="form-check form-switch form-switch-lg form-check-reverse form-check-inline">
|
||||
<label class="form-check-label">{{ text_agree }}</label> <input type="hidden" name="agree" value="0"/> <input type="checkbox" name="agree" value="1" class="form-check-input"/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">{{ button_continue }}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{{ content_bottom }}</div>
|
||||
{{ column_right }}</div>
|
||||
</div>
|
||||
{{ footer }}
|
Reference in New Issue
Block a user