Subversion Repositories SmartDukaan

Rev

Rev 26744 | Rev 27184 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
26493 tejbeer 1
$(function() {
2
	$(".product-detail").live('click', function() {
3
		loadItems("main-content");
4
	});
5
	$(".product-info").live(
6
			'click',
7
			function() {
8
				console.log(itemCatalogId);
9
				doAjaxRequestHandler(context + "/getProductInfo?catalogId="
10
						+ itemCatalogId, "GET", function(response) {
11
					$('.product-info-container').html(response);
26512 amit.gupta 12
					$("#compareItem").hide();
26493 tejbeer 13
				});
14
			});
15
 
26512 amit.gupta 16
	$(".compare-with").live('click', function() {
17
		$("#compareItem").show();
26493 tejbeer 18
	});
19
 
27047 amit.gupta 20
	catalogIds = [1021975, 1022020];
26744 amit.gupta 21
	$(".product-compare-info").live('click',function() {
27047 amit.gupta 22
		changedIndex = $(this).closest('th').index()-1;
26744 amit.gupta 23
		if(typeof compareCatalogId!="undefined") {
27047 amit.gupta 24
			//always push to last
25
			if(changedIndex==-2) {
26
				catalogIds[2] = compareCatalogId;
27
			} else {
28
				catalogIds[changedIndex] = compareCatalogId;
29
			}
26744 amit.gupta 30
		}
31
		doAjaxRequestHandler(`${context}/getProductCompareInfo?catalogIds=` + catalogIds.join(","), "GET", 
32
		function(response) {
33
			console.log(response)
34
			$('#' + "main-content").html(response);
35
		});
36
	});
26493 tejbeer 37
});
38
 
39
function loadItems(domId) {
40
	doAjaxRequestHandler(context + "/getProducts", "GET", function(response) {
41
		$('#' + domId).html(response);
42
	});
43
}