Subversion Repositories SmartDukaan

Rev

Rev 5234 | Rev 5358 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5234 Rev 5347
Line 9... Line 9...
9
 
9
 
10
	$("#zipcode").val($("#defaultpincode").val());
10
	$("#zipcode").val($("#defaultpincode").val());
11
	
11
	
12
	if(typeof Entity != 'undefined'){
12
	if(typeof Entity != 'undefined'){
13
		var select = $("#colorSelector");
13
		var select = $("#colorSelector");
-
 
14
		if(Entity.orderededItems){
14
		$.each(Entity.orderedItems, function(index, sort) {
15
			$.each(Entity.orderedItems, function(index, sort) {
15
			select.find('option[value="' + sort + '"]').appendTo(select);
16
				select.find('option[value="' + sort + '"]').appendTo(select);
16
		});
17
			});
-
 
18
			$("#item_id").val(Entity.orderedItems[0]);
-
 
19
		}
17
		select.find("option:eq(0)").remove();
20
		select.find("option:eq(0)").remove();
18
		$("#item_id").val(Entity.orderedItems[0]);
-
 
19
		updateEstimate(getSeletectedItemId());
21
		updateEstimate(getSeletectedItemId());
20
	}
22
	}
21
 
23
 
22
    var prodid = $("#product_id").val();
24
    var prodid = $("#product_id").val();
23
    
25
    
Line 100... Line 102...
100
		addResearch('', 'single');
102
		addResearch('', 'single');
101
	});
103
	});
102
	
104
	
103
    $('#mobilename').keypress(function(e) {
105
    $('#mobilename').keypress(function(e) {
104
    	if(e.keyCode == 13) {
106
    	if(e.keyCode == 13) {
105
    		return compareProducts();
107
    		return compareProducts($("#compare_continue").attr("producttype"));
106
        }
108
        }
107
    });
109
    });
108
    
110
    
109
    
111
    
110
    $("#compare_continue").click(function() {
112
    $("#compare_continue").click(function() {
111
    	return compareProducts();
113
    	return compareProducts($(this).attr("producttype"));
112
    });
114
    });
113
 
115
 
114
    $('.tooltip').click(function() {
116
    $('.tooltip').click(function() {
115
    	trackEventWithGA('Product', 'Helpdoc Click', $(this).attr('name'));
117
    	trackEventWithGA('Product', 'Helpdoc Click', $(this).attr('name'));
116
    });
118
    });
Line 126... Line 128...
126
    		position: { adjust: {screen: true} }
128
    		position: { adjust: {screen: true} }
127
    		});
129
    		});
128
    	});
130
    	});
129
    	
131
    	
130
    	
132
    	
131
    function compareProducts(){
133
    function compareProducts(productType){
-
 
134
		var hyphenatedProductType = productType.replace(/ +/g, '-').toLowerCase();
-
 
135
    	
132
		var productName = $("#mobilename").val();
136
    	var productName = $("#mobilename").val();
133
		var productTwo = typeof(productIdNames['mobiles'][productName]) == 'undefined' ? productIdNames['laptops'][productName] : productIdNames['mobiles'][productName];
137
		var hypenatedNameTwo = productName.replace(/ +/g, '-').toLowerCase();
134
		
138
		
-
 
139
		var productTwo = productIdNames[productType][productName];
135
		if(typeof productTwo == 'undefined'){
140
		if(typeof productTwo == 'undefined'){
136
			alert("Please select a valid product");
141
			alert("Please select a valid product");
137
			return false;
142
			return false;
138
		}
143
		}
139
		var productOne = $("#catalog_id").val();
144
		var productOne = $("#catalog_id").val();
-
 
145
		var prodDetail = $("#productDetail");
-
 
146
		var productNameOne = $(prodDetail).find("span.brand").html() + " " + $(prodDetail).find("span.product-name").html();  
-
 
147
		var hyphenateNameOne = productNameOne.replace(/ +/g, '-').toLowerCase();  
-
 
148
		window.location = "/compare-" + hyphenatedProductType + "/" 
140
		window.location = "/compare-mobile-phones?p1="+productOne+"&p2="+productTwo;	
149
			+ hyphenateNameOne + "-vs-" + hypenatedNameTwo + "?p1="+productOne+"&p2="+productTwo;	
141
	}
150
	}
142
    
151
    
143
    $("#accessories table td div a").live('click', function() {
152
    $("#accessories table td div a").live('click', function() {
144
    	var productId = $(this).parent().parent().parent().children().find('input[type=checkbox]').val();
153
    	var productId = $(this).parent().parent().parent().children().find('input[type=checkbox]').val();
145
    	trackEventWithGA('Widget', 'Accessory Click', productId);
154
    	trackEventWithGA('Widget', 'Accessory Click', productId);