Subversion Repositories SmartDukaan

Rev

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

Rev 5347 Rev 5358
Line 132... Line 132...
132
    	
132
    	
133
    function compareProducts(productType){
133
    function compareProducts(productType){
134
		var hyphenatedProductType = productType.replace(/ +/g, '-').toLowerCase();
134
		var hyphenatedProductType = productType.replace(/ +/g, '-').toLowerCase();
135
    	
135
    	
136
    	var productName = $("#mobilename").val();
136
    	var productName = $("#mobilename").val();
137
		var hypenatedNameTwo = productName.replace(/ +/g, '-').toLowerCase();
137
		var hypenatedNameTwo = productName.replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();
138
		
138
		
139
		var productTwo = productIdNames[productType][productName];
139
		var productTwo = productIdNames[productType][productName];
140
		if(typeof productTwo == 'undefined'){
140
		if(typeof productTwo == 'undefined'){
141
			alert("Please select a valid product");
141
			alert("Please select a valid product");
142
			return false;
142
			return false;
143
		}
143
		}
144
		var productOne = $("#catalog_id").val();
144
		var productOne = $("#catalog_id").val();
145
		var prodDetail = $("#productDetail");
145
		var prodDetail = $("#productDetail");
146
		var productNameOne = $(prodDetail).find("span.brand").html() + " " + $(prodDetail).find("span.product-name").html();  
146
		var productNameOne = $(prodDetail).find("span.brand").html() + " " + $(prodDetail).find("span.product-name").html();  
147
		var hyphenateNameOne = productNameOne.replace(/ +/g, '-').toLowerCase();  
147
		var hyphenateNameOne = productNameOne.replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();  
148
		window.location = "/compare-" + hyphenatedProductType + "/" 
148
		window.location = "/compare-" + hyphenatedProductType + "/" 
149
			+ hyphenateNameOne + "-vs-" + hypenatedNameTwo + "?p1="+productOne+"&p2="+productTwo;	
149
			+ hyphenateNameOne + "-vs-" + hypenatedNameTwo + "?p1="+productOne+"&p2="+productTwo;	
150
	}
150
	}
151
    
151
    
152
    $("#accessories table td div a").live('click', function() {
152
    $("#accessories table td div a").live('click', function() {