// Changes to ajax product tabs loading
This commit is contained in:
@@ -212,6 +212,7 @@
|
|||||||
{foreach $tabs_preloaded as $k => $tab}
|
{foreach $tabs_preloaded as $k => $tab}
|
||||||
tabs_preloaded['{$k}'] = '{$tab}';
|
tabs_preloaded['{$k}'] = '{$tab}';
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
var stack = new Array();
|
||||||
|
|
||||||
$('.product-tab-content').each(function(){
|
$('.product-tab-content').each(function(){
|
||||||
var id = $(this).attr('id').substr(20);
|
var id = $(this).attr('id').substr(20);
|
||||||
@@ -220,8 +221,11 @@
|
|||||||
|
|
||||||
if (tabs_preloaded[btn_name])
|
if (tabs_preloaded[btn_name])
|
||||||
if ($("#product-tab-content-"+id).hasClass('not-loaded'))
|
if ($("#product-tab-content-"+id).hasClass('not-loaded'))
|
||||||
displayTabProductById('#link-'+id, id, false);
|
stack.push(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
displayTabProductById2(0, false, stack);
|
||||||
|
|
||||||
$('.productTabs').show();
|
$('.productTabs').show();
|
||||||
$('#product_form').show();
|
$('#product_form').show();
|
||||||
$('#product-tab-content-wait').hide();
|
$('#product-tab-content-wait').hide();
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
|
|
||||||
protected $available_tabs = array(
|
protected $available_tabs = array(
|
||||||
'Informations',
|
'Informations',
|
||||||
'Pack',
|
|
||||||
'VirtualProduct',
|
|
||||||
'Prices',
|
'Prices',
|
||||||
'Seo',
|
'Seo',
|
||||||
'Associations',
|
'Associations',
|
||||||
@@ -55,7 +53,9 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
'Quantities',
|
'Quantities',
|
||||||
'Suppliers',
|
'Suppliers',
|
||||||
'Warehouses',
|
'Warehouses',
|
||||||
'Accounting'
|
'Accounting',
|
||||||
|
'Pack',
|
||||||
|
'VirtualProduct'
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $available_tabs_lang = array ();
|
protected $available_tabs_lang = array ();
|
||||||
|
|||||||
@@ -247,6 +247,41 @@ function displayTabProductById(el, id, selected)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function displayTabProductById2(index, selected, stack)
|
||||||
|
{
|
||||||
|
id = stack[index];
|
||||||
|
myurl = $('#link-'+id).attr("href")+"&ajax=1";
|
||||||
|
// Used to check if the tab is already in the process of being loaded
|
||||||
|
$("#product-tab-content-"+id).addClass('loading');
|
||||||
|
|
||||||
|
if (selected)
|
||||||
|
$('#product-tab-content-wait').show();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url : myurl,
|
||||||
|
async : true,
|
||||||
|
success : function(data)
|
||||||
|
{
|
||||||
|
$("#product-tab-content-"+id).html(data);
|
||||||
|
$("#product-tab-content-"+id).removeClass('not-loaded');
|
||||||
|
|
||||||
|
if (selected)
|
||||||
|
{
|
||||||
|
$("#link-"+id).addClass('selected');
|
||||||
|
$("#product-tab-content-"+id).show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete : function(data)
|
||||||
|
{
|
||||||
|
$("#product-tab-content-"+id).removeClass('loading');
|
||||||
|
if (selected)
|
||||||
|
$('#product-tab-content-wait').hide();
|
||||||
|
if (stack[index + 1])
|
||||||
|
displayTabProductById2(index + 1, selected, stack);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the manufacturer select element with the list of existing manufacturers
|
* Update the manufacturer select element with the list of existing manufacturers
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user