// BO - Fix bug where the current product tab is loaded twice

This commit is contained in:
tDidierjean
2011-12-30 15:28:57 +00:00
parent ac02e85010
commit acdedffc71
2 changed files with 9 additions and 4 deletions
@@ -178,8 +178,7 @@
} }
$("#product-tab-content-wait").show(); $("#product-tab-content-wait").show();
if ($("#product-tab-content-"+id).hasClass('not-loaded') && !$("#product-tab-content-"+id).hasClass('loading'))
if ($("#product-tab-content-"+id).hasClass('not-loaded'))
displayTabProductById(this, id, true); displayTabProductById(this, id, true);
else else
{ {
+8 -2
View File
@@ -218,10 +218,12 @@ function editProductAttribute(ids, token)
function displayTabProductById(el, id, selected) function displayTabProductById(el, id, selected)
{ {
myurl = $(el).attr("href")+"&ajax=1"; 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({ $.ajax({
url : myurl, url : myurl,
async : true, async : true,
success :function(data) success : function(data)
{ {
$("#product-tab-content-"+id).html(data); $("#product-tab-content-"+id).html(data);
$("#product-tab-content-"+id).removeClass('not-loaded'); $("#product-tab-content-"+id).removeClass('not-loaded');
@@ -231,6 +233,10 @@ function displayTabProductById(el, id, selected)
$("#link-"+id).addClass('selected'); $("#link-"+id).addClass('selected');
$("#product-tab-content-"+id).show(); $("#product-tab-content-"+id).show();
} }
},
complete : function(data)
{
$("#product-tab-content-"+id).removeClass('loading');
} }
}); });
} }
@@ -256,7 +262,7 @@ function getManufacturers()
if (j) if (j)
for (var i = 0; i < j.length; i++) for (var i = 0; i < j.length; i++)
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
$("select#id_manufacturer").replaceWith("<select id=\"id_manufacturer\">"+options+"</select>"); $("select#id_manufacturer").html(options);
}, },
error: function(XMLHttpRequest, textStatus, errorThrown) error: function(XMLHttpRequest, textStatus, errorThrown)
{ {