Subversion Repositories SmartDukaan

Rev

Rev 456 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<script>
<!--
$(document).ready(function() {
// Research "Add to Cart" 
 $("#research_addcart").click(function(){
  var seldata="";
  var tot=0;
  var saprt="";     
  $("input[name='research']:checked").each(function() {
       saprt = (tot>0)? "_":"";
                               seldata += saprt+$(this).val();
                               tot++
                          });
 
                          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);
                 alert( "Data Saved: " + msg );
            }
       });

  }else{
       alert("Please select atleast one product");
      }
 });
 
 
  // Research "delete" Item
                 $("#research_delete").click(function(){
                      var research_tot=$("#research_total").val();
                      
                      var seldata="";
                      var tot=0;
                      var saprt="";     
                      $("input[name='research']:checked").each(function() {
                           saprt = (tot>0)? "_":"";
                           seldata += saprt+$(this).val();
                           tot++
                      });
                      if(tot>0){
                           var t=(research_tot*1)-(tot*1);
                           $("#research_total").val(t);
                           
                                

                           alert("AJAX request to delete products in research. Product ID: "+seldata+" and total: "+tot); 
                           jQuery.ajax({
                                type: "GET",
                                url: "../myresearch/" + seldata + "?_method=delete",
                                                                data: "productid="+seldata,
                                success: function(msg){
                                     alert( "Data Saved: " + msg );
                                }
                           });
                           var arrayprod_id=seldata.split("_");
                           jQuery.each(arrayprod_id,function(intIndex, objValue){
                                var tableref="#"+objValue;
                                var tblid="#"+objValue+ " td";
                                $(tblid).animate({ backgroundColor: "#fcffb3" }, 'slow');
                                $(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow', function() { $(this).fadeOut('slow', function() { $(this).remove(); if(t === 0){ $("#research_default").css("display","block");} } ) }); 
                           
                           });
  
                           
                      }else{
                           alert("Please select atleast one product");
                      }
                 });
 });
 //-->
</script>


<!-- Widget My Research start -->
<DIV class="lightbox">
     <DIV class="hdr" id="hdr0">
          <A href="javascript:void(0);">My Research</A>
     </DIV>
     <DIV  class="holder osX" style="margin:0;width:100%;" id="winker0">
          <DIV class="tools">
               <A style="cursor:pointer;" id="research_delete">Delete</A>
               <A href="#">Compare</A>
               <A id="research_addcart">Add to Cart</A>
          </DIV>
                  <input type="hidden" name="research_total" id="research_total" value="$itemDetails.size()">
          <DIV id="pane1" class="scroll-pane tabwrap makeScroll" style="width:245px;" >
          <TABLE cellspacing="1" cellpadding="0" border="0"  width="100%" id="research_default" style="display:none;" >
                        <TBODY>
                                <TR>
                                        <TD> Please Register/Sign-in to use My Research tool</TD>
                                </TR>
                        </TBODY>
          </TABLE>

                        #set( $count = 0)
                                #foreach( $itemDetail in $itemDetails )
                                        #set( $count = $count+1)
                                        #set( $divid = "res" + $count)

               <TABLE id="$itemDetail.ITEM_ID" cellspacing="1" cellpadding="0" border="0" width="100%">
               <TBODY><TR>
                         <TD><INPUT type="checkbox" name="research" value="$itemDetail.ITEM_ID" id="check1"></TD>
                                                  <TD><img src="../images/p1.gif" width="60" height="60" /></TD>
                         <TD>
                              <DIV>
                                   <A href="#">$itemDetail.ITEM_NAME</A>
                                   <SPAN class="text">Price: Rs. $itemDetail.ITEM_PRICE</SPAN>
                                   <SPAN class="text">$itemDetail.ITEM_SNIPPET</SPAN>
                              </DIV>
                         </TD>
                    </TR>

               </TBODY>
               </TABLE>
                           #end
          </DIV>
          <DIV class="quicksign">
               <A href="#">Sign In</A> | <A href="#">Register</A>  to save <br />" My Research "
          </DIV>
     </DIV>
</DIV>
<!-- Widget My Research end -->