From acdedffc71a149eb69a5bc0dd575f41b98abafa5 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Fri, 30 Dec 2011 15:28:57 +0000 Subject: [PATCH] // BO - Fix bug where the current product tab is loaded twice --- admin-dev/themes/default/template/products/form.tpl | 3 +-- js/admin-products.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) 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) {