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
// Recommend "Add to Cart" 
5
 $("#recommend_addcart").click(function(){
6
  var seldata="";
7
  var tot=0;
8
  var saprt="";     
9
  $("input[name='recommend']: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
  // Recommendations tab "Add to Research"       
34
 $("#recommend_addresearch").click(function(){
35
      var research_tot=$("#research_total").val();
36
      var seldata="";
37
      var tot=0;
38
      var saprt="";     
39
      $("input[name='recommend']:checked").each(function() {
40
           saprt = (tot>0)? "_":"";
41
           seldata += saprt+$(this).val();
42
           tot++
43
      });
44
      if(tot>0){
45
           var t=(research_tot*1)+(tot*1);
46
           $("#research_total").val(t);
47
           if(t > 0){
48
                $("#research_default").css("display","none");
49
           }     
50
           alert("AJAX request to add products in My research. Product ID: "+seldata+" and total: "+tot);
51
           jQuery.ajax({
52
                type: "POST",
53
                url: "../myresearch",
54
                data: "productid="+seldata,
55
                success: function(msg){
56
		           $("#pane1").prepend(msg);
57
                   $('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
58
                   var arrayprod_id=seldata.split("_");
59
                   jQuery.each(arrayprod_id,function(intIndex, objValue){
60
                   var tblid="#"+objValue+ " td";
61
                    $(tblid).animate({ backgroundColor: "#fcffb3" }, 'slow');
62
                    $(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow');     
63
 
64
   });
65
                     alert( "Data Saved: " + msg );
66
                }
67
           });
68
           //code below goes in success handler
69
           //alert("RESP :"+tmp_resp);     
70
 
71
      }else{
72
           alert("Please select atleast one product");
73
      }
74
 });
75
 
76
 
77
 
78
 });
79
 //-->
80
</script>
81
 
82
<!-- Widget Recommendations start -->
83
<DIV class="lightbox">
84
     <DIV class="hdr" id="hdr1">
85
          <A href="javascript:void(0);">Recommendations</A>
86
     </DIV>
87
     <DIV class="holder osX" style="margin:0;width:100%;" id="winker1">
88
          <DIV class="tools">
89
               <A id="recommend_addresearch">Add to Research</A>
90
               <A id="recommend_addcart">Add to Cart</A>
91
          </DIV>
92
          <DIV  id="pane2" class="scroll-pane tabwrap makeScroll" style="width:245px;">
93
      			#set( $count = 0)
94
				#foreach( $itemDetail in $itemDetails )
95
					#set( $count = $count+1)
96
					#set( $divid = "res" + $count)
97
 
98
               <TABLE id="$itemDetail.ITEM_ID" cellspacing="1" cellpadding="0" border="0" width="100%">
99
               <TBODY><TR>
100
                         <TD><INPUT type="checkbox" name="recommend" value="$itemDetail.ITEM_ID" id="check1"></TD>
101
                                                  <TD><img src="../images/p1.gif" width="60" height="60" /></TD>
102
                         <TD>
103
                              <DIV>
104
                                   <A href="#">$itemDetail.ITEM_NAME</A>
105
                                   <SPAN class="text">Price: Rs. $itemDetail.ITEM_PRICE</SPAN>
106
                                   <SPAN class="text">$itemDetail.ITEM_SNIPPET</SPAN>
107
                              </DIV>
108
                         </TD>
109
                    </TR>
110
 
111
               </TBODY>
112
               </TABLE>
113
			   #end
114
          </div>
115
     </DIV>
116
</DIV>
117
<!-- Widget Recommendations end -->