Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
452 rajveer 1
<script>
2
<!--
3
$(document).ready(function() {
4
// Research "Add to Cart" 
5
 $("#research_addcart").click(function(){
6
  var seldata="";
7
  var tot=0;
8
  var saprt="";     
9
  $("input[name='research']:checked").each(function() {
10
       saprt = (tot>0)? "_":"";
11
                               seldata += saprt+$(this).val();
12
                               tot++
13
                          });
14
 
15
                          if(tot>0){
16
                              alert("AJAX request to add products in Cart. Product ID: "+seldata+" and total: "+tot); 
17
       jQuery.ajax({
18
	   		type: "POST",
19
            url: "../cart",
20
            data: "productid="+seldata,
21
            success: function(msg){
22
			       $("#cartItemCount").html(msg);
23
                 alert( "Data Saved: " + msg );
24
            }
25
       });
26
 
27
  }else{
28
       alert("Please select atleast one product");
29
      }
30
 });
31
 
32
 
33
  // Research "delete" Item
34
                 $("#research_delete").click(function(){
35
                      var research_tot=$("#research_total").val();
36
 
37
                      var seldata="";
38
                      var tot=0;
39
                      var saprt="";     
40
                      $("input[name='research']:checked").each(function() {
41
                           saprt = (tot>0)? "_":"";
42
                           seldata += saprt+$(this).val();
43
                           tot++
44
                      });
45
                      if(tot>0){
46
                           var t=(research_tot*1)-(tot*1);
47
                           $("#research_total").val(t);
48
 
49
 
50
 
51
                           alert("AJAX request to delete products in research. Product ID: "+seldata+" and total: "+tot); 
52
                           jQuery.ajax({
53
                                type: "GET",
54
                                url: "../myresearch/" + seldata + "?_method=delete",
55
								data: "productid="+seldata,
56
                                success: function(msg){
57
                                     alert( "Data Saved: " + msg );
58
                                }
59
                           });
60
                           var arrayprod_id=seldata.split("_");
61
                           jQuery.each(arrayprod_id,function(intIndex, objValue){
62
                                var tableref="#"+objValue;
63
                                var tblid="#"+objValue+ " td";
64
                                $(tblid).animate({ backgroundColor: "#fcffb3" }, 'slow');
65
                                $(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow', function() { $(this).fadeOut('slow', function() { $(this).remove(); if(t === 0){ $("#research_default").css("display","block");} } ) }); 
66
 
67
                           });
68
 
69
 
70
                      }else{
71
                           alert("Please select atleast one product");
72
                      }
73
                 });
74
 });
75
 //-->
76
</script>
77
 
78
 
79
<!-- Widget My Research start -->
80
<DIV class="lightbox">
81
     <DIV class="hdr" id="hdr0">
82
          <A href="javascript:void(0);">My Research</A>
83
     </DIV>
84
     <DIV  class="holder osX" style="margin:0;width:100%;" id="winker0">
85
          <DIV class="tools">
86
               <A style="cursor:pointer;" id="research_delete">Delete</A>
87
               <A href="#">Compare</A>
88
               <A id="research_addcart">Add to Cart</A>
89
          </DIV>
90
		  <input type="hidden" name="research_total" id="research_total" value="$itemDetails.size()">
91
          <DIV id="pane1" class="scroll-pane tabwrap makeScroll" style="width:245px;" >
92
          <TABLE cellspacing="1" cellpadding="0" border="0"  width="100%" id="research_default" style="display:none;" >
93
			<TBODY>
94
				<TR>
95
					<TD> Please Register/Sign-in to use My Research tool</TD>
96
				</TR>
97
			</TBODY>
98
          </TABLE>
99
 
100
      			#set( $count = 0)
101
				#foreach( $itemDetail in $itemDetails )
102
					#set( $count = $count+1)
103
					#set( $divid = "res" + $count)
104
 
105
               <TABLE id="$itemDetail.ITEM_ID" cellspacing="1" cellpadding="0" border="0" width="100%">
106
               <TBODY><TR>
107
                         <TD><INPUT type="checkbox" name="research" value="$itemDetail.ITEM_ID" id="check1"></TD>
108
                                                  <TD><img src="../images/p1.gif" width="60" height="60" /></TD>
109
                         <TD>
110
                              <DIV>
111
                                   <A href="#">$itemDetail.ITEM_NAME</A>
112
                                   <SPAN class="text">Price: Rs. $itemDetail.ITEM_PRICE</SPAN>
113
                                   <SPAN class="text">$itemDetail.ITEM_SNIPPET</SPAN>
114
                              </DIV>
115
                         </TD>
116
                    </TR>
117
 
118
               </TBODY>
119
               </TABLE>
120
			   #end
121
          </DIV>
122
          <DIV class="quicksign">
123
               <A href="#">Sign In</A> | <A href="#">Register</A>  to save <br />" My Research "
124
          </DIV>
125
     </DIV>
126
</DIV>
127
<!-- Widget My Research end -->