| 1456 |
varun.gupt |
1 |
$(function(){
|
| 7744 |
amit.gupta |
2 |
jQuery('.mk_videoclick').click(function(){
|
|
|
3 |
var clicked = jQuery(this);
|
|
|
4 |
var scrollTo = jQuery("#recommendedvids");
|
|
|
5 |
if(currentVideoId!=currentVideoIds[clicked.attr("slidecounter")]){
|
|
|
6 |
scrollTo.find('li[ytid=' + currentVideoIds[clicked.attr("slidecounter")] + ']').click();
|
|
|
7 |
}
|
|
|
8 |
trackEventWithGA('Product', 'VideoTabClicked', $('title').text().split('|')[0].trim() + "|" + clicked.attr("slidename"));
|
|
|
9 |
jQuery('html, body').animate({ scrollTop: scrollTo.offset().top }, 'medium');
|
|
|
10 |
return false;
|
|
|
11 |
});
|
| 7853 |
amit.gupta |
12 |
|
|
|
13 |
var bankEle = jQuery("#bank-name");
|
|
|
14 |
var first = true;
|
|
|
15 |
var allBankImgs = {
|
|
|
16 |
1:"/images/hdfc-icon.png",
|
|
|
17 |
2:"/images/axis-icon.png",
|
|
|
18 |
3:"/images/icici-icon.png",
|
|
|
19 |
4:"/images/indusind-icon.png",
|
|
|
20 |
5:"/images/citi-icon.png",
|
|
|
21 |
6:"/images/std-chartered-icon.png",
|
|
|
22 |
7:"/images/hsbc-icon.png",
|
|
|
23 |
8:"/images/kotak-icon.png",
|
|
|
24 |
9:"/images/sbi-icon.png",
|
|
|
25 |
};
|
| 7744 |
amit.gupta |
26 |
|
| 7853 |
amit.gupta |
27 |
|
|
|
28 |
var minEmi = 999999;
|
| 9149 |
amit.gupta |
29 |
if(typeof EMI === "undefined"){
|
|
|
30 |
EMI={};
|
|
|
31 |
}
|
|
|
32 |
EMI.lowestEmiBank = 0;
|
| 7853 |
amit.gupta |
33 |
jQuery.each(emiObj, function(index, opt) {
|
|
|
34 |
if(sellingPrice >= opt.minAmount){
|
|
|
35 |
if(typeof banks[opt.bankId] == "undefined") {
|
|
|
36 |
banks[opt.bankId] = {};
|
|
|
37 |
banks[opt.bankId].name = opt.bankName;
|
|
|
38 |
banks[opt.bankId].emis = {};
|
|
|
39 |
banks[opt.bankId].active = true;
|
|
|
40 |
banks[opt.bankId].img = allBankImgs[opt.bankId];
|
|
|
41 |
}
|
|
|
42 |
var bank = banks[opt.bankId];
|
|
|
43 |
var bankTenure = {};
|
|
|
44 |
bankTenure.tenureDescription = opt.tenureDescription;
|
| 8950 |
amit.gupta |
45 |
var r = opt.interestRate/12/100;
|
| 12031 |
amit.gupta |
46 |
var installment = sellingPrice*r*Math.pow(1+r,opt.tenure)/(Math.pow(1+r,opt.tenure) - 1);
|
| 8950 |
amit.gupta |
47 |
bankTenure.monthlyEmi = (Math.round(installment*100)/100).toFixed(2);
|
|
|
48 |
bankTenure.interestRate = opt.interestRate;
|
| 12051 |
amit.gupta |
49 |
bankTenure.tenure = opt.tenure;
|
| 9149 |
amit.gupta |
50 |
if(minEmi > installment){
|
|
|
51 |
minEmi = installment;
|
| 12026 |
amit.gupta |
52 |
EMI.interestRate = r;
|
|
|
53 |
EMI.tenure = opt.tenure;
|
| 9149 |
amit.gupta |
54 |
EMI.lowestEmiBank = opt.bankId;
|
| 7853 |
amit.gupta |
55 |
}
|
|
|
56 |
bank.emis[opt.id] = bankTenure;
|
|
|
57 |
}
|
|
|
58 |
});
|
|
|
59 |
jQuery.each(banks, function(index, bank){
|
|
|
60 |
var style = ' style="background: url(\'' + bank.img + '\') no-repeat right"';
|
|
|
61 |
if(first){
|
|
|
62 |
bankEle.append('<li title="' + bank.name + '"' + style +'><input type="radio" id="' + index +'" value="' + index +'" name="bankselected"' + (bank.active ? '""' : 'disabled="disabled"') + ' checked="checked"/></li>');
|
|
|
63 |
first = false;
|
|
|
64 |
}else {
|
|
|
65 |
bankEle.append('<li title="' + bank.name +'"' + style +'><input type="radio" id="' + index +'" value="' + index +'" name="bankselected"' + (bank.active ? '""' : 'disabled="disabled"') + ' /></li>');
|
|
|
66 |
}
|
|
|
67 |
});
|
|
|
68 |
|
|
|
69 |
bankEle.find("input[type='radio']").click(onBankClicked);
|
|
|
70 |
|
| 12042 |
amit.gupta |
71 |
jQuery("#emi_more,#emi_more1").live('click',function(){
|
| 7853 |
amit.gupta |
72 |
|
|
|
73 |
$.colorbox({
|
|
|
74 |
inline:true,
|
|
|
75 |
href:"#emiLightBox",
|
|
|
76 |
width:"600px",
|
|
|
77 |
height:"410px",
|
|
|
78 |
|
|
|
79 |
onComplete: function(){
|
|
|
80 |
$('#emiLightBox').show();
|
| 9149 |
amit.gupta |
81 |
if(EMI.lowestEmiBank == 0) {
|
|
|
82 |
bankEle.find("input[type='radio']:first").trigger('click');
|
|
|
83 |
}
|
|
|
84 |
else {
|
| 9153 |
amit.gupta |
85 |
bankEle.find("#" + EMI.lowestEmiBank).trigger('click');
|
| 9149 |
amit.gupta |
86 |
}
|
| 7853 |
amit.gupta |
87 |
},
|
|
|
88 |
onCleanup: function(){
|
|
|
89 |
$('#emiLightBox').hide();
|
|
|
90 |
}
|
|
|
91 |
});
|
|
|
92 |
trackEventWithGA('Product', 'Emi Know More Clicked', $('title').text().split('|')[0].trim());
|
|
|
93 |
});
|
|
|
94 |
|
| 1456 |
varun.gupt |
95 |
$('#loopedSlider').loopedSlider();
|
|
|
96 |
|
|
|
97 |
runEffect();
|
|
|
98 |
|
|
|
99 |
$(".controls").tabs();
|
|
|
100 |
|
|
|
101 |
$('#forgot_username_link').tipsy({gravity: 'w'});
|
|
|
102 |
|
|
|
103 |
$("#zipcode").val($("#defaultpincode").val());
|
| 4934 |
amit.gupta |
104 |
|
|
|
105 |
if(typeof Entity != 'undefined'){
|
|
|
106 |
var select = $("#colorSelector");
|
| 5373 |
rajveer |
107 |
if(Entity.orderedItems){
|
| 5347 |
amit.gupta |
108 |
$.each(Entity.orderedItems, function(index, sort) {
|
|
|
109 |
select.find('option[value="' + sort + '"]').appendTo(select);
|
|
|
110 |
});
|
|
|
111 |
$("#item_id").val(Entity.orderedItems[0]);
|
| 5889 |
amit.gupta |
112 |
onColorSelectorChange(Entity.orderedItems[0]);
|
| 11672 |
anikendra |
113 |
if(typeof deliveryEstimate != 'undefined') {
|
|
|
114 |
$("#shipping_time").show();
|
|
|
115 |
$("#shipping_time_1").hide();
|
|
|
116 |
//$("#shipping_time .red").html("<img src='/images/loader_l.gif'>");
|
|
|
117 |
populateEstimate(deliveryEstimate);
|
|
|
118 |
}else{
|
|
|
119 |
updateEstimate(Entity.orderedItems[0]);
|
|
|
120 |
}
|
| 5347 |
amit.gupta |
121 |
}
|
| 4934 |
amit.gupta |
122 |
select.find("option:eq(0)").remove();
|
|
|
123 |
}
|
| 1456 |
varun.gupt |
124 |
|
| 1761 |
vikas |
125 |
var prodid = $("#product_id").val();
|
|
|
126 |
|
|
|
127 |
add_to_storage_set("histitems", prodid);
|
|
|
128 |
|
| 2652 |
rajveer |
129 |
load_accessories_widget();
|
| 3406 |
rajveer |
130 |
|
|
|
131 |
load_most_compared_widget();
|
| 2754 |
rajveer |
132 |
|
| 2731 |
varun.gupt |
133 |
|
| 4489 |
varun.gupt |
134 |
// Fix to always show first image's title on page load
|
| 4530 |
mandeep.dh |
135 |
if ("undefined" != typeof(title_1)){
|
|
|
136 |
$('.slides .modelName').html(title_1[0]);
|
|
|
137 |
}
|
| 4489 |
varun.gupt |
138 |
|
| 4530 |
mandeep.dh |
139 |
|
| 3830 |
chandransh |
140 |
function getSeletectedItemId(){
|
|
|
141 |
return $("#item_id").val();
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
|
| 1922 |
varun.gupt |
145 |
/**
|
|
|
146 |
* Code to track user clicks on Product slides and 'Proceed to Payment' option
|
|
|
147 |
*/
|
|
|
148 |
$('a.vt').click(function(){
|
|
|
149 |
trackEventWithGA('Product', $(this).children('span').text(), $('title').text().split('|')[0].trim());
|
|
|
150 |
});
|
|
|
151 |
|
| 3830 |
chandransh |
152 |
$('#computeShippingEstimate').click(function(){
|
|
|
153 |
updateEstimate(getSeletectedItemId());
|
|
|
154 |
});
|
|
|
155 |
|
|
|
156 |
$("#addToCart").click(function(){
|
| 12626 |
amit.gupta |
157 |
if($(this).attr("href")!=undefined){
|
| 12632 |
amit.gupta |
158 |
trackEventWithGA('Affiliate', $(this).attr("affname"), document.title);
|
| 12626 |
amit.gupta |
159 |
return true;
|
|
|
160 |
}
|
| 2811 |
rajveer |
161 |
jQuery.ajax({
|
| 1456 |
varun.gupt |
162 |
type: "POST",
|
| 1614 |
rajveer |
163 |
url: "/addtocart",
|
| 3830 |
chandransh |
164 |
data: "productid=" + getSeletectedItemId(),
|
| 1456 |
varun.gupt |
165 |
success: function(msg) {
|
| 4530 |
mandeep.dh |
166 |
if(msg == "") {
|
| 3830 |
chandransh |
167 |
trackEventWithGA('Order', 'Add to Cart', getSeletectedItemId() + '');
|
| 2036 |
rajveer |
168 |
window.location = "/cart";
|
| 4530 |
mandeep.dh |
169 |
} else {
|
| 4934 |
amit.gupta |
170 |
var productDetail = $("#productDetail");
|
|
|
171 |
var prodInfo = $(productDetail).find("span.brand").html() + $(productDetail).find("span.product-name").html();
|
| 2810 |
rajveer |
172 |
displayRelatedProducts(msg);
|
| 4934 |
amit.gupta |
173 |
trackEventWithGA('Order', 'OOS Lightbox', prodInfo);
|
| 4530 |
mandeep.dh |
174 |
}
|
| 2754 |
rajveer |
175 |
}
|
| 1456 |
varun.gupt |
176 |
});
|
|
|
177 |
});
|
|
|
178 |
|
| 3830 |
chandransh |
179 |
$("#colorSelector").change(function(){
|
|
|
180 |
var itemid = $("#colorSelector option:selected").val();
|
| 5889 |
amit.gupta |
181 |
onColorSelectorChange(itemid);
|
| 11672 |
anikendra |
182 |
updateEstimate(itemid);
|
| 1456 |
varun.gupt |
183 |
return false;
|
|
|
184 |
});
|
|
|
185 |
|
| 3830 |
chandransh |
186 |
$(".util_compare").click(function() {
|
| 2755 |
rajveer |
187 |
$.colorbox({
|
|
|
188 |
inline:true,
|
|
|
189 |
href:"#compareLightBox",
|
|
|
190 |
width:"350px",
|
|
|
191 |
height:"230px",
|
|
|
192 |
|
|
|
193 |
onComplete: function(){
|
|
|
194 |
$('#compareLightBox').show();
|
|
|
195 |
},
|
|
|
196 |
onCleanup: function(){
|
|
|
197 |
$('#compareLightBox').hide();
|
|
|
198 |
}
|
|
|
199 |
});
|
| 2228 |
rajveer |
200 |
});
|
| 3830 |
chandransh |
201 |
|
|
|
202 |
$('.util_addnewresearch').click(function(){
|
|
|
203 |
addResearch('', 'single');
|
|
|
204 |
});
|
|
|
205 |
|
| 2236 |
rajveer |
206 |
$('#mobilename').keypress(function(e) {
|
|
|
207 |
if(e.keyCode == 13) {
|
| 5347 |
amit.gupta |
208 |
return compareProducts($("#compare_continue").attr("producttype"));
|
| 2236 |
rajveer |
209 |
}
|
|
|
210 |
});
|
|
|
211 |
|
|
|
212 |
|
| 2228 |
rajveer |
213 |
$("#compare_continue").click(function() {
|
| 5347 |
amit.gupta |
214 |
return compareProducts($(this).attr("producttype"));
|
| 2228 |
rajveer |
215 |
});
|
| 2236 |
rajveer |
216 |
|
| 3305 |
rajveer |
217 |
$('.tooltip').click(function() {
|
|
|
218 |
trackEventWithGA('Product', 'Helpdoc Click', $(this).attr('name'));
|
|
|
219 |
});
|
|
|
220 |
|
| 2320 |
rajveer |
221 |
$('.tooltip').each(function(index) {
|
|
|
222 |
$(this).qtip({
|
|
|
223 |
style: { width: 300, overflow: 'auto',
|
|
|
224 |
tip: { corner: 'topLeft' },
|
|
|
225 |
border: { width: 2, radius: 2, color: '#DDDDDD' } },
|
|
|
226 |
show: { when: { event: 'click' } },
|
|
|
227 |
content: { url: "/helpdocs/" + $(this).attr('name'), title: { text: ' ', button: 'Close'} },
|
|
|
228 |
hide: { when: { event: 'unfocus' } },
|
|
|
229 |
position: { adjust: {screen: true} }
|
|
|
230 |
});
|
|
|
231 |
});
|
|
|
232 |
|
|
|
233 |
|
| 5347 |
amit.gupta |
234 |
function compareProducts(productType){
|
|
|
235 |
var hyphenatedProductType = productType.replace(/ +/g, '-').toLowerCase();
|
|
|
236 |
|
|
|
237 |
var productName = $("#mobilename").val();
|
| 5358 |
amit.gupta |
238 |
var hypenatedNameTwo = productName.replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();
|
| 4143 |
varun.gupt |
239 |
|
| 5347 |
amit.gupta |
240 |
var productTwo = productIdNames[productType][productName];
|
| 2236 |
rajveer |
241 |
if(typeof productTwo == 'undefined'){
|
|
|
242 |
alert("Please select a valid product");
|
|
|
243 |
return false;
|
|
|
244 |
}
|
| 2827 |
rajveer |
245 |
var productOne = $("#catalog_id").val();
|
| 5347 |
amit.gupta |
246 |
var prodDetail = $("#productDetail");
|
|
|
247 |
var productNameOne = $(prodDetail).find("span.brand").html() + " " + $(prodDetail).find("span.product-name").html();
|
| 5358 |
amit.gupta |
248 |
var hyphenateNameOne = productNameOne.replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();
|
| 5347 |
amit.gupta |
249 |
window.location = "/compare-" + hyphenatedProductType + "/"
|
| 5552 |
phani.kuma |
250 |
+ hyphenateNameOne + "-vs-" + hypenatedNameTwo + "?p1="+productOne+"&p2="+productTwo+"&fromsrc=product_page";
|
| 2236 |
rajveer |
251 |
}
|
| 2228 |
rajveer |
252 |
|
| 2802 |
rajveer |
253 |
$("#accessories table td div a").live('click', function() {
|
| 10537 |
amit.gupta |
254 |
var productId = $(this).attr('title');
|
| 2802 |
rajveer |
255 |
trackEventWithGA('Widget', 'Accessory Click', productId);
|
|
|
256 |
});
|
|
|
257 |
|
| 5862 |
amit.gupta |
258 |
|
|
|
259 |
$('.nextSlide-anchorLink').live('click', function() {
|
|
|
260 |
var nextSlideLink = $(this).attr('nextSlideId');
|
|
|
261 |
$('a[href="' + nextSlideLink +'"]').click();
|
|
|
262 |
return false;
|
|
|
263 |
});
|
|
|
264 |
|
| 5552 |
phani.kuma |
265 |
$('a.compare-now').live('click', function(){
|
|
|
266 |
var productType = $(this).attr('producttype');
|
|
|
267 |
productType = productType.replace(/ +/g, '-').toLowerCase();
|
|
|
268 |
|
|
|
269 |
var productOne = $("#catalog_id").val();
|
|
|
270 |
var prodDetail = $("#productDetail");
|
|
|
271 |
var productNameOne = $(prodDetail).find("span.brand").html() + " " + $(prodDetail).find("span.product-name").html();
|
|
|
272 |
var hyphenateNameOne = productNameOne.replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();
|
|
|
273 |
|
|
|
274 |
var productTwo = $(this).attr("value");
|
|
|
275 |
var hypenatedNameTwo = $(this).attr("title").replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();
|
|
|
276 |
|
|
|
277 |
window.location = "/compare-" + productType + "/" + hyphenateNameOne + "-vs-" + hypenatedNameTwo + "?p1="+productOne+"&p2="+productTwo+"&fromsrc=most_compared_widget";
|
|
|
278 |
});
|
|
|
279 |
|
| 1456 |
varun.gupt |
280 |
});
|
|
|
281 |
|
|
|
282 |
function changeSignInClass(){
|
|
|
283 |
if(document.getElementById("signinClass").className.indexOf("signin1") > -1) {
|
|
|
284 |
document.getElementById("signinClass").className = 'signin';
|
|
|
285 |
} else {
|
|
|
286 |
document.getElementById("signinClass").className = 'signin1';
|
|
|
287 |
}
|
|
|
288 |
}
|
|
|
289 |
|
| 11672 |
anikendra |
290 |
function populateEstimate(msg) {
|
|
|
291 |
var response = eval('(' + msg + ')');
|
|
|
292 |
var deliveryEstimate = response['delivery_estimate'];
|
|
|
293 |
var codDeliveryEstimate = response['cod_delivery_estimate'];
|
|
|
294 |
var isCODAvailableForLocation = (response['is_cod_available_for_location'] === 'true');
|
|
|
295 |
var isOTG = (response['on_time_guarantee'] === 'true');
|
|
|
296 |
var businessDays = response['business_days'];
|
|
|
297 |
|
|
|
298 |
if(deliveryEstimate == -1) {
|
|
|
299 |
$("#shipping_time").hide();
|
|
|
300 |
$("#shipping_time_1").show();
|
|
|
301 |
$('#cod_know_more').hide();
|
|
|
302 |
} else {
|
|
|
303 |
$('#cod_know_more').hide();
|
|
|
304 |
if($("#shipping_time").html().indexOf('after arrival')>-1){
|
|
|
305 |
$("#shipping_time .red").html(businessDays + " Days");
|
|
|
306 |
}else{
|
|
|
307 |
if(isCODAvailableForLocation && (codDeliveryEstimate != deliveryEstimate)){
|
|
|
308 |
$("#shipping_time .cod").html("Cash On Delivery orders is " + codDeliveryEstimate);
|
|
|
309 |
$('#cod_know_more').show();
|
|
|
310 |
}
|
|
|
311 |
$("#shipping_time .red").html(deliveryEstimate);
|
|
|
312 |
}
|
|
|
313 |
}
|
|
|
314 |
|
|
|
315 |
if (isCODAvailableForLocation) {
|
|
|
316 |
$('#cod').show();
|
|
|
317 |
} else {
|
|
|
318 |
$('#cod').hide();
|
|
|
319 |
}
|
|
|
320 |
|
|
|
321 |
if (isOTG) {
|
|
|
322 |
$('#otg').show();
|
|
|
323 |
} else {
|
|
|
324 |
$('#otg').hide();
|
|
|
325 |
}
|
|
|
326 |
}
|
| 2228 |
rajveer |
327 |
|
| 1456 |
varun.gupt |
328 |
function updateEstimate(itemId) {
|
| 3830 |
chandransh |
329 |
itemId = itemId || $("#colorSelector option:selected").val();
|
| 1456 |
varun.gupt |
330 |
|
|
|
331 |
jQuery.ajax({
|
|
|
332 |
type: "GET",
|
| 1919 |
rajveer |
333 |
url: "/estimate/" + $("#zipcode").val() + "_" + itemId,
|
| 1456 |
varun.gupt |
334 |
beforeSend: function() {
|
| 5234 |
amit.gupta |
335 |
$("#shipping_time").show();
|
|
|
336 |
$("#shipping_time_1").hide();
|
| 7893 |
rajveer |
337 |
$("#shipping_time .red").html("<img src='/images/loader_l.gif'>");
|
| 1456 |
varun.gupt |
338 |
},
|
|
|
339 |
success: function(msg) {
|
| 11672 |
anikendra |
340 |
populateEstimate(msg);
|
| 1456 |
varun.gupt |
341 |
}
|
|
|
342 |
});
|
| 2228 |
rajveer |
343 |
}
|
|
|
344 |
|
| 3406 |
rajveer |
345 |
function load_most_compared_widget(){
|
| 10198 |
amit.gupta |
346 |
if(Entity.isComparable) {
|
|
|
347 |
jQuery.ajax({
|
|
|
348 |
type : "GET",
|
|
|
349 |
url : "/most-compared-products/" + $("#product_id").val(),
|
|
|
350 |
cache: false,
|
|
|
351 |
success : function(html) {
|
|
|
352 |
$("#mostcompared").html(html);
|
|
|
353 |
|
|
|
354 |
// Product Title
|
|
|
355 |
$("#mostcompared table td div a").each(function() {
|
|
|
356 |
if($(this).attr('class') != "compare-now"){
|
|
|
357 |
$(this).truncate({addtitle : true});
|
|
|
358 |
}
|
|
|
359 |
});
|
|
|
360 |
|
|
|
361 |
// Product Price
|
|
|
362 |
$("#mostcompared table td div div.price").each(function() {
|
|
|
363 |
$(this).truncate({addtitle : true});
|
|
|
364 |
});
|
|
|
365 |
|
|
|
366 |
// Product Details
|
|
|
367 |
$("#mostcompared table td div div.text").each(function() {
|
|
|
368 |
$(this).truncate( {addtitle : true});
|
|
|
369 |
});
|
|
|
370 |
}
|
|
|
371 |
});
|
|
|
372 |
}
|
| 5889 |
amit.gupta |
373 |
}
|
|
|
374 |
function onColorSelectorChange(itemid){
|
| 12626 |
amit.gupta |
375 |
$('div.shipping1').remove();
|
| 12631 |
amit.gupta |
376 |
$('span.mk_emi').show();
|
| 12626 |
amit.gupta |
377 |
$('div.shipping').show();
|
|
|
378 |
$('#addToCart').removeAttr("href");
|
| 12632 |
amit.gupta |
379 |
$('#addToCart').removeAttr("affname");
|
| 15635 |
kshitij.so |
380 |
$("#item_id").val(itemid);
|
| 12026 |
amit.gupta |
381 |
if(typeof privateDeals[itemid]== "undefined") {
|
|
|
382 |
sellingPrice = Number(PARAMETERS[itemid].SP);
|
|
|
383 |
if($('#sp').length>0){
|
|
|
384 |
$('#sp').html(PARAMETERS[itemid].SP);
|
|
|
385 |
$('#mrp').html(PARAMETERS[itemid].MRP);
|
|
|
386 |
$('#saving').html(PARAMETERS[itemid].SAVING);
|
| 12626 |
amit.gupta |
387 |
var exclusiveAffiliateItem;
|
|
|
388 |
if(typeof ExclusiveAffItems != "undefined"){
|
|
|
389 |
for(i in ExclusiveAffItems){
|
|
|
390 |
if (ExclusiveAffItems[i].itemId==itemid){
|
|
|
391 |
exclusiveAffiliateItem = ExclusiveAffItems[i];
|
|
|
392 |
break;
|
|
|
393 |
}
|
|
|
394 |
}
|
|
|
395 |
sellerImg = {
|
|
|
396 |
1 : 'flipkart_logo.png',
|
| 12682 |
amit.gupta |
397 |
2 : 'amazon_logo.jpg',
|
| 12626 |
amit.gupta |
398 |
3 : 'snapdeal_logo.png'
|
|
|
399 |
};
|
|
|
400 |
if(typeof exclusiveAffiliateItem != "undefined"){
|
|
|
401 |
var innerhtml = '<div class="shipping1 left"><div style="background-color: #FAFAFA;padding:4px;font-size: 14px;">Available on '
|
| 12631 |
amit.gupta |
402 |
+ exclusiveAffiliateItem.affiliateName+'</div><div style="padding: 10px;background-color:#FFF;padding-left: 136px;background-image: url(\'/unversioned/images/' + sellerImg[exclusiveAffiliateItem.affiliateId] + '\');background-repeat: no-repeat;background-size: 120px;color: #777777;font-size: 14px;background-position:left">'
|
| 12626 |
amit.gupta |
403 |
+ (typeof exclusiveAffiliateItem.offerText=="undefined"?'':exclusiveAffiliateItem.offerText) + '</div></div>';
|
| 12632 |
amit.gupta |
404 |
$("#addToCart").attr("href", exclusiveAffiliateItem.affiliateUrl).attr("affname", exclusiveAffiliateItem.affiliateName);
|
| 12626 |
amit.gupta |
405 |
$('div.shipping').hide();
|
| 12631 |
amit.gupta |
406 |
$('span.mk_emi').hide();
|
| 12626 |
amit.gupta |
407 |
$(innerhtml).insertAfter('div.shipping');
|
|
|
408 |
}
|
|
|
409 |
|
|
|
410 |
}
|
| 12026 |
amit.gupta |
411 |
}
|
| 12040 |
amit.gupta |
412 |
$('div.mk_deal').hide();
|
| 12026 |
amit.gupta |
413 |
$('div.mk_nodeal').show();
|
|
|
414 |
} else {
|
|
|
415 |
var itemp = privateDeals[itemid];
|
|
|
416 |
sellingPrice = itemp.dealPojo.dealPrice;
|
| 12031 |
amit.gupta |
417 |
var installment = sellingPrice*EMI.interestRate*Math.pow(1+EMI.interestRate,EMI.tenure)/(Math.pow(1+EMI.interestRate,EMI.tenure) - 1);
|
| 12027 |
amit.gupta |
418 |
if(typeof itemp.mrp == "undefined" || itemp.mrp =="") itemp.mrp = itemp.sellingPrice
|
| 12026 |
amit.gupta |
419 |
var percentoff = Math.round((1-itemp.dealPojo.dealPrice/itemp.mrp)*100);
|
|
|
420 |
var dealLeft = '';
|
|
|
421 |
var dealRight = '';
|
|
|
422 |
if(itemp.dealPojo.dealTextOption==0){
|
|
|
423 |
dealRight = itemp.bestDealText;
|
|
|
424 |
}else if(itemp.dealPojo.dealTextOption==1){
|
|
|
425 |
dealLeft=itemp.bestDealText;
|
|
|
426 |
}else {
|
|
|
427 |
dealRight=itemp.bestDealText;
|
|
|
428 |
dealLeft = itemp.dealPojo.dealText
|
|
|
429 |
}
|
|
|
430 |
|
|
|
431 |
var html = [];
|
| 12066 |
amit.gupta |
432 |
html.push('<div>');
|
| 12081 |
amit.gupta |
433 |
html.push('<div class="left rupeeimage"></div><span class="bold" style="text-decoration:line-through;font-size:14px;">'+ itemp.mrp +'</span>');
|
| 12066 |
amit.gupta |
434 |
if(itemp.mrp!=itemp.sellingPrice) {
|
| 12081 |
amit.gupta |
435 |
html.push('<span style="text-decoration:line-through;font-size:14px;padding-left:4px">'+ itemp.sellingPrice +'</span>');
|
| 12066 |
amit.gupta |
436 |
}
|
|
|
437 |
if(typeof dealRight != "undefined" && dealRight != ''){
|
| 12081 |
amit.gupta |
438 |
html.push('<span style="padding-bottom:3px;padding-left:6px;text-decoration:line-through;">' + dealRight +'</span>');
|
| 12066 |
amit.gupta |
439 |
}
|
| 12069 |
amit.gupta |
440 |
html.push('</div>');
|
| 12073 |
amit.gupta |
441 |
|
| 13177 |
amit.gupta |
442 |
html.push('<div style="font-size:14px;padding-top:3px"><b>Only for You: </b><span class="red">Rs.' + sellingPrice + '</span> (' + percentoff + '% Off)</div>');
|
| 12073 |
amit.gupta |
443 |
|
|
|
444 |
html.push('<div>');
|
| 12049 |
amit.gupta |
445 |
if(typeof dealLeft != "undefined" && dealLeft != ''){
|
| 12091 |
amit.gupta |
446 |
html.push('<span style="padding-right:10px">');
|
| 12073 |
amit.gupta |
447 |
html.push('<span class="red" style="font-weight:bold;padding-bottom:3px">' + dealLeft +' </span>');
|
| 12080 |
amit.gupta |
448 |
if($(".mk_best_deal_detail").size()>0){
|
|
|
449 |
html.push('<a class="mk_best_deal_detail" href="javascript:void(0)" style="padding-left:2px"><img src="/images/quesmark.png" style="vertical-align: middle;"></a>');
|
|
|
450 |
}
|
| 12076 |
amit.gupta |
451 |
html.push('</span>');
|
| 12026 |
amit.gupta |
452 |
}
|
| 12073 |
amit.gupta |
453 |
html.push('<span class="mk_emi" style="font-size:14px;">EMIs from <span class="red">Rs.' + Math.round(installment) +'</span> per month<a style="padding-left:2px" href="javascript:void(0)" id="emi_more1"><img style="vertical-align: middle;" src="/images/quesmark.png"></a></span>')
|
|
|
454 |
html.push('</div>');
|
| 12066 |
amit.gupta |
455 |
|
| 12026 |
amit.gupta |
456 |
html.push('</div>');
|
| 12040 |
amit.gupta |
457 |
$('div.mk_nodeal').hide();
|
| 12091 |
amit.gupta |
458 |
$('div.mk_deal').css("background-color","#f2ed69").html(html.join('')).show();
|
| 6021 |
amit.gupta |
459 |
}
|
| 7853 |
amit.gupta |
460 |
}
|
|
|
461 |
|
|
|
462 |
banks = {};
|
|
|
463 |
var first = true;
|
|
|
464 |
for (obj in PARAMETERS) {
|
|
|
465 |
sellingPrice = Number(PARAMETERS[obj].SP);
|
|
|
466 |
break;
|
|
|
467 |
}
|
|
|
468 |
|
|
|
469 |
function onBankClicked(){
|
|
|
470 |
var bankId = jQuery(this).val();
|
|
|
471 |
var bank = banks[bankId];
|
|
|
472 |
var emiTableEle = jQuery("#emi_options");
|
|
|
473 |
var tdHtml=[];
|
|
|
474 |
var tenureHtml=[];
|
| 8948 |
amit.gupta |
475 |
var percentHtml=[];
|
| 9145 |
rajveer |
476 |
tdHtml.push("<td><b>Installment<br>(Including Interest)</b></td>");
|
| 8960 |
rajveer |
477 |
percentHtml.push("<td><b>Interest Rate<br>(Annualized)</b></td>");
|
| 7853 |
amit.gupta |
478 |
jQuery.each(bank.emis, function(key,val){
|
| 12050 |
amit.gupta |
479 |
var r = val.interestRate/12/100;
|
| 12051 |
amit.gupta |
480 |
var installment = sellingPrice*r*Math.pow(1+r,val.tenure)/(Math.pow(1+r,val.tenure) - 1);
|
| 12050 |
amit.gupta |
481 |
val.monthlyEmi = (Math.round(installment*100)/100).toFixed(2);
|
| 7853 |
amit.gupta |
482 |
tdHtml.push('<td><span style="font-size:11px" class="rupee-icon"><b>' + val.monthlyEmi+ '</b></span></td>');
|
|
|
483 |
tenureHtml.push('<td><span style="font-size:11px"><b>' + val.tenureDescription + '</b></span></td>');
|
| 8948 |
amit.gupta |
484 |
percentHtml.push('<td><span style="font-size:11px"><b>' + val.interestRate + '%</b></span></td>');
|
| 7853 |
amit.gupta |
485 |
});
|
| 8948 |
amit.gupta |
486 |
emiTableEle.find("td.mk_bankname").html(bank.name);
|
| 7853 |
amit.gupta |
487 |
emiTableEle.find("td.mk_emioptions").attr("colspan", count(bank.emis));
|
|
|
488 |
emiTableEle.find("tr.emirow").html(tdHtml.join(""));
|
|
|
489 |
emiTableEle.find("tr.mk_tenure").html(tenureHtml.join(""));
|
| 8948 |
amit.gupta |
490 |
emiTableEle.find("tr.mk_percent").html(percentHtml.join(""));
|
| 7853 |
amit.gupta |
491 |
}
|
|
|
492 |
|
|
|
493 |
function count(obj) {
|
|
|
494 |
var count=0;
|
|
|
495 |
for(var prop in obj) {
|
|
|
496 |
if (obj.hasOwnProperty(prop)) {
|
|
|
497 |
++count;
|
|
|
498 |
}
|
|
|
499 |
}
|
|
|
500 |
return count;
|
| 11970 |
amit.gupta |
501 |
}
|
| 12026 |
amit.gupta |
502 |
privateDeals={};
|
| 11970 |
amit.gupta |
503 |
if(typeof prodJson!="undefined"){
|
|
|
504 |
for(i in prodJson.response.itemPojos){
|
|
|
505 |
var deal = prodJson.response.itemPojos[i].dealPojo;
|
|
|
506 |
if (typeof deal != "undefined"){
|
| 12029 |
amit.gupta |
507 |
privateDeals[prodJson.response.itemPojos[i].id] = prodJson.response.itemPojos[i];
|
| 11970 |
amit.gupta |
508 |
}
|
|
|
509 |
}
|
| 12026 |
amit.gupta |
510 |
}
|
|
|
511 |
|
|
|
512 |
function highlightDeal(){
|
|
|
513 |
|
| 3406 |
rajveer |
514 |
}
|