[-] BO : fix bug #PSCFV-341 - ajax call could be made twice for the same product tab

This commit is contained in:
tDidierjean
2012-05-04 08:55:16 +00:00
parent c9de393e37
commit e1b304bf66
2 changed files with 12 additions and 8 deletions
@@ -148,15 +148,15 @@
$("#product-tab-content-"+currentId).hide(); $("#product-tab-content-"+currentId).hide();
} }
if ($("#product-tab-content-"+id).hasClass('not-loaded') && !$("#product-tab-content-"+id).hasClass('loading')) // if the tab has not already been loaded, load it now
tabs_manager.display(id, true, 0, null); tabs_manager.display(id, true, 0, null);
else
{ tabs_manager.onLoad(id, function(){
$("#product-tab-content-"+id).show(0, function(){ $("#product-tab-content-"+id).show(0, function(){
$(this).trigger('displayed'); $(this).trigger('displayed');
}); });
$("#link-"+id).addClass('selected'); $("#link-"+id).addClass('selected');
} });
var languages = new Array(); var languages = new Array();
if (btn_name == "Combinations") if (btn_name == "Combinations")
+7 -3
View File
@@ -75,9 +75,13 @@ function ProductTabsManager(){
*/ */
this.display = function (id, selected, index, stack) this.display = function (id, selected, index, stack)
{ {
var myurl = $('#link-'+id).attr("href")+"&ajax=1";
var tab_selector = $("#product-tab-content-"+id); var tab_selector = $("#product-tab-content-"+id);
// Used to check if the tab is already in the process of being loaded
// Is the tab already being loaded?
if (!tab_selector.hasClass('not-loaded') || tab_selector.hasClass('loading'))
return;
// Mark the tab as being currently loading
tab_selector.addClass('loading'); tab_selector.addClass('loading');
if (selected) if (selected)
@@ -89,7 +93,7 @@ function ProductTabsManager(){
data = post_data; data = post_data;
$.ajax({ $.ajax({
url : myurl, url : $('#link-'+id).attr("href")+"&ajax=1",
async : true, async : true,
cache: false, // cache needs to be set to false or IE will cache the page with outdated product values cache: false, // cache needs to be set to false or IE will cache the page with outdated product values
type: 'POST', type: 'POST',