diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl
index f65161713..89b1d1d48 100755
--- a/admin-dev/themes/default/template/controllers/orders/form.tpl
+++ b/admin-dev/themes/default/template/controllers/orders/form.tpl
@@ -309,7 +309,7 @@
token: "{getAdminToken tab='AdminCarts'}",
tab: "AdminCarts",
action: "deleteVoucher",
- id_voucher: id_cart_rule,
+ id_cart_rule: id_cart_rule,
id_cart: id_cart,
},
success : function(res)
@@ -403,16 +403,6 @@
{
var html_carts = '';
var html_orders = '';
- var addresses_options = '';
- if (res.addresses.length > 0)
- {
- var address_detail = res.addresses[0].company+' '+res.addresses[0].firstname+' '+res.addresses[0].lastname+'
';
- address_detail += res.addresses[0].address1+'
';
- address_detail += res.addresses[0].address2+'
';
- address_detail += res.addresses[0].postcode+' '+res.addresses[0].city+' '+res.addresses[0].country;
- }
- else
- address_detail = '{l s='No addresses'}';
$.each(res.carts, function() {
html_carts += '
';
@@ -425,23 +415,6 @@
});
$('#nonOrderedCarts table tbody').html(html_carts);
$('#lastOrders table tbody').html(html_orders);
- $.each(res.addresses, function () {
- addresses_options += '';
- });
-
- if (addresses_options == '')
- {
- $('#address_delivery').hide();
- $('#address_invoice').hide();
- }
- else
- {
- $('#id_address_delivery').html(addresses_options);
- $('#id_address_invoice').html(addresses_options);
- $('#address_delivery').show();
- $('#address_invoice').show();
- }
- $('#address_delivery_detail,#address_invoice_detail').html(address_detail);
}
if (res.id_cart)
{
@@ -576,6 +549,8 @@
{
updateCartProducts(jsonSummary.summary.products);
updateCartVouchers(jsonSummary.summary.discounts);
+ updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice);
+
if (!jsonSummary.summary.products.length || !jsonSummary.addresses.length)
$('#carriers_part,#summary_part').hide();
else
@@ -764,6 +739,28 @@
}
});
}
+
+ function updateAddressesList(addresses, id_address_delivery, id_address_invoice)
+ {
+ var addresses_delivery_options = '';
+ var addresses_invoice_options = '';
+ var address_invoice_detail = '';
+ var address_delivery_detail = '';
+
+ $.each(addresses, function() {
+ if (this.id_address == id_address_invoice)
+ address_invoice_detail = this.company+' '+this.firstname+' '+this.lastname+'