// adding the dynamic loading of tabs in products

This commit is contained in:
lLefevre
2011-12-12 11:15:17 +00:00
parent eae3bc761f
commit a4b75601b6
3 changed files with 40 additions and 25 deletions
+10 -23
View File
@@ -39,26 +39,26 @@
</div>
</div>
<script type="text/javascript">
var toload = new Array();
var pos_select = {$pos_select};
$(document).ready(function(){
$('#desc-product-newCombination').hide();
{* submenu binding *}
$(".tab-page").click(function(e){
e.preventDefault();
// currentId is the current product tab id
currentId = $(".productTabs a.selected").attr('id').substr(5);
// id is the wanted producttab id
id = $(this).attr('id').substr(5);
// Update submit button value
var split_position = id.indexOf('-') + 1;
var btn_name = id.substr(split_position);
$("#product_form_submit_btn").attr('name', 'submit'+btn_name);
if ($(this).attr("id") != $(".productTabs a.selected").attr('id'))
{
$(".tab-page").removeClass('selected');
@@ -71,31 +71,18 @@
else
return false;
}
$("#product-tab-content-wait").show();
if ($("#product-tab-content-"+id).hasClass('not-loaded') || $(this).hasClass('selected'))
{
myurl = $(this).attr("href")+"&ajax=1";
$.ajax({
url : myurl,
async : true,
success :function(data)
{
$("#product-tab-content-"+id).html(data);
$("#product-tab-content-"+id).removeClass('not-loaded');
$("#product-tab-content-"+id).show();
$("#link-"+id).addClass('selected');
}
});
}
if ($("#product-tab-content-"+id).hasClass('not-loaded'))
displayTabProductById(this, id, true);
else
{
$("#product-tab-content-"+id).show();
$("#link-"+id).addClass('selected');
}
$("#product-tab-content-wait").hide();
var languages = new Array();
if (btn_name == "Combinations")
{
@@ -37,6 +37,14 @@
updateMvtStatus($(this).val());
});
updateMvtStatus($(this).val());
$('.product-tab-content').each(function(){
var id = $(this).attr('id').substr(20);
if ($("#product-tab-content-"+id).hasClass('not-loaded'))
displayTabProductById('#link-'+id, id, false);
});
});
function updateMvtStatus(id_mvt_reason)
{
@@ -621,8 +629,8 @@ var accessories = new Array();
</table>
<br />
</div>
{*
<script type="text/javascript">
toggleVirtualProduct(getE('is_virtual_good'));
</script>
</script>*}
+20
View File
@@ -204,6 +204,26 @@ function editProductAttribute(ids, token)
}
/* END Combination */
function displayTabProductById(el, id, selected)
{
myurl = $(el).attr("href")+"&ajax=1";
$.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();
}
}
});
}
function addPackItem()
{
if ($('#curPackItemId').val() == '' || $('#curPackItemName').val() == '')