diff --git a/admin-dev/themes/default/template/products/form.tpl b/admin-dev/themes/default/template/products/form.tpl index 41b54c13d..41c97e2ef 100644 --- a/admin-dev/themes/default/template/products/form.tpl +++ b/admin-dev/themes/default/template/products/form.tpl @@ -178,8 +178,7 @@ } $("#product-tab-content-wait").show(); - - if ($("#product-tab-content-"+id).hasClass('not-loaded')) + if ($("#product-tab-content-"+id).hasClass('not-loaded') && !$("#product-tab-content-"+id).hasClass('loading')) displayTabProductById(this, id, true); else { diff --git a/js/admin-products.js b/js/admin-products.js index 7ff147c93..103131f54 100644 --- a/js/admin-products.js +++ b/js/admin-products.js @@ -218,10 +218,12 @@ function editProductAttribute(ids, token) function displayTabProductById(el, id, selected) { myurl = $(el).attr("href")+"&ajax=1"; + // Used to check if the tab is already in the process of being loaded + $("#product-tab-content-"+id).addClass('loading'); $.ajax({ url : myurl, async : true, - success :function(data) + success : function(data) { $("#product-tab-content-"+id).html(data); $("#product-tab-content-"+id).removeClass('not-loaded'); @@ -231,6 +233,10 @@ function displayTabProductById(el, id, selected) $("#link-"+id).addClass('selected'); $("#product-tab-content-"+id).show(); } + }, + complete : function(data) + { + $("#product-tab-content-"+id).removeClass('loading'); } }); } @@ -256,7 +262,7 @@ function getManufacturers() if (j) for (var i = 0; i < j.length; i++) options += ''; - $("select#id_manufacturer").replaceWith(""); + $("select#id_manufacturer").html(options); }, error: function(XMLHttpRequest, textStatus, errorThrown) {