Rev 458 | Rev 637 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*Author: Binay KumarCreated on: 30.09.2010Example:addResearch(refdivid,reqtype) refdivid=pane1, reqtype=single/multiMultiple request: onclick="javascript:addResearch('pane2','multi');"Single request: onclick="javascript:addResearch('','single');"addToCart(refdivid,reqtype) refdivid=pane1, reqtype=single/multiMultiple request: onclick="javascript:addToCart('pane2','multi');"Single request: onclick="javascript:addToCart('','single');"NOTE: incase reqtype=list then refdivid should be product id*/function addResearch(refdivid,reqtype){var research_tot=$("#research_total").val();var seldata="";var tot=0;var saprt="";if(reqtype=="multi"){var containerdiv = "#" + refdivid;var par= containerdiv + " input[type=checkbox]:checked";$(par).each(function(){saprt = (tot>0)? "_":"";seldata += saprt+$(this).val();tot++});}else if(reqtype=="single"){var seldata=$("#item_id").val();var tot=1;}else if(reqtype=="list"){var seldata=refdivid;var tot=1;}if(tot>0){alert("AJAX request to add products in My research. Product ID: "+seldata+" and total: "+tot);jQuery.ajax({type: "POST",url: "../myresearch",data: "productid="+seldata,success: function(msg){if(msg == 0){alert( "Please register/signin to use myresearch tool" );}else if(msg == 1){alert( "Product is already in my research" );}else {var t=(research_tot*1)+(tot*1);$("#research_total").val(t);if(t > 0){$("#research_default").css("display","none");}$("#pane1").prepend(msg);$('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});if(reqtype == "multi"){var arrayprod_id=seldata.split("_");jQuery.each(arrayprod_id,function(intIndex, objValue){var tblid="#pane1 #"+objValue+ " td";$(tblid).animate({ backgroundColor: "#fcffb3" }, 'slow');$(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow');});}else if(reqtype == "single"){var tblid="#pane1 #"+seldata+ " td";$(tblid).animate({ backgroundColor: "#fcffb3" }, 'slow');$(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow');}else if(reqtype == "list"){var tblid="#pane1 #"+seldata+ " td";$(tblid).animate({ backgroundColor: "#fcffb3" }, 'slow');$(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow');}}alert( "Data Saved: " + msg );}});}else{alert("Please select atleast one product");}}function addToCart(refdivid,reqtype){var seldata="";var tot=0;var saprt="";if(reqtype == "multi"){var containerdiv = "#" + refdivid;var par= containerdiv + " input[type=checkbox]:checked";$(par).each(function(){saprt = (tot>0)? "_":"";seldata += saprt+$(this).val();tot++});}else if(reqtype == "single"){seldata = $("#item_id").val();tot=1;}else if(reqtype == "list"){var seldata=refdivid;var tot=1;}if(tot>0){alert("AJAX request to add products in Cart. Product ID: "+seldata+" and total: "+tot);jQuery.ajax({type: "POST",url: "../cart",data: "productid="+seldata,success: function(msg){$("#cartItemCount").html(msg*1);alert( "Data Saved: " + msg );}});}else{alert("Please select atleast one product");}}