`;//`; for (productId in groupLists[key]) { if ({}.hasOwnProperty.call(groupLists[key], productId)) { data += ""); } } data += '
`; for (productDetailKey in groupLists[key][groupName]) { let productDetail = groupLists[key][groupName][productDetailKey]; const currentClass = currentProduct == productDetail.productId ? "active-similar-product" : ""; //$(`.product-in-similar-category-tn[data-group='${groupName}'] .similar-product-${productId}`).append(` data += ` `; } data += '
Please enter valid email
'); return false; } $("".concat($form, " .price_drop_submit_btn")).attr('disabled','disabled'); $("".concat($form, " .price_drop_submit_btn")).val('Submitting...'); var current_price = $($form).closest('.productView').attr('data-product-price'); var data = { Customer_Email: emailVal, Product_Title: $('.productView-title').html(), Customer_Phone: $("".concat($form, " #contact_phone")).val(),Customer_Name: $("".concat($form, " #contact_name")).val(), Product_ID: productIdVal,Alert_At_Price:$("".concat($form, " #price")).val(),Product_URL:product_url,Current_Price:current_price }; $.ajax({ url: url, method: 'GET', dataType: 'json', data : data, }).done(function() { $('.price_drop_form_container').find('#PageContent').html('Thank you, your message has been received!
'); }); return false; }, submitClickAndCollect: function() { var $form = 'form#click_n_collect_form'; var url = 'https://script.google.com/macros/s/AKfycbwllKjoQ0yoTiJEqmvl_KQKEHzoaoXlSzEIGjzwsJ28aYIFgqc/exec'; var emailVal = $("".concat($form, " #contact_email")).val(); var productIdVal = $("".concat($form, " #product_id")).val(); var product_url = $(location).attr('href').split('?')[0]; if (!$("".concat($form, " #contact_name")).val()) { $($form).parent().find('.formMessage').html('Please enter name
'); return false; } if (!$("".concat($form, " #contact_phone")).val()) { $($form).parent().find('.formMessage').html('Please enter phone
'); return false; } if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailVal)) { $($form).parent().find('.formMessage').html('Please enter valid email
Please enter collection date
'); return false; } $("".concat($form, " .click_n_collect_submit_btn")).attr('disabled','disabled'); $("".concat($form, " .click_n_collect_submit_btn")).val('Submitting...'); var current_price = $($form).closest('.productView').attr('data-product-price'); var collection_date = $("".concat($form, " #date_of_collection")).val().split("-").reverse().join("-"); var data = { Customer_Email: emailVal, Product_Title: $('.productView-title').html(), Customer_Phone: $("".concat($form, " #contact_phone")).val(),Customer_Name: $("".concat($form, " #contact_name")).val(), Product_ID: productIdVal,Collection_Date:collection_date,Product_URL:product_url,Current_Price:current_price }; $.ajax({ url: url, method: 'GET', dataType: 'json', data : data, }).done(function() { $('.click_n_collect_form_container').find('#PageContent').html('Your request has been received. We will notify you when the product is ready for collection.
'); }); return false; }, submitPriceMatch: function() { var currentHours1 = this.calcTime('+1'); var $form = 'form#price_match_form'; var url = 'https://script.google.com/macros/s/AKfycbxfrjpm5oOuVxgVyW3AS56w9m-1R-bpCadH_4X6q1msjQeWMr9n/exec'; var emailVal = $("".concat($form, " #contact_email")).val(); var productIdVal = $("".concat($form, " #product_id")).val(); var product_url = $(location).attr('href').split('?')[0]; var current_price = $($form).closest('.productView').attr('data-product-price'); if (!$("".concat($form, " #price_match_to")).val()) { $($form).parent().find('.formMessage').html('Please enter Price-match to
'); return false; } if (!$("".concat($form, " #where_seen_price")).val()) { $($form).parent().find('.formMessage').html('Please enter Where you have seen this price
'); return false; } if (!$("".concat($form, " #contact_name")).val()) { $($form).parent().find('.formMessage').html('Please enter name
'); return false; } if (!$("".concat($form, " #contact_phone")).val()) { $($form).parent().find('.formMessage').html('Please enter phone
'); return false; } if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailVal)) { $($form).parent().find('.formMessage').html('Please enter valid email
'); return false; } $("".concat($form, " .price_match_submit_btn")).attr('disabled','disabled'); $("".concat($form, " .price_match_submit_btn")).val('Submitting...'); var data = { Customer_Email: emailVal, Product_Title: $('.productView-title').html(), Customer_Phone: $("".concat($form, " #contact_phone")).val(),Customer_Name: $("".concat($form, " #contact_name")).val(), Product_ID: productIdVal,Price_Match_To:$("".concat($form, " #price_match_to")).val(),Where_Seen:$("".concat($form, " #where_seen_price")).val(),Where_URL:$("".concat($form, " #page_url")).val(),Our_Product_URL:product_url,Our_Current_Price:current_price }; $.ajax({ url: url, method: 'GET', dataType: 'json', data : data, }).done(function() { var success_msg = 'Thank you for submitting price-match request. '; success_msg+='
If we are able to match the price, we will notify by email or phone. This usually takes 1-2 hours on business days.
'; if(currentHours1.getHours()>= 9 && currentHours1.getHours() <=17 && currentHours1.getDay() != 6 && currentHours1.getDay() !=0) { success_msg+='
If you would like a quicker response, CHAT WITH US (During business hours)
Let customers speak for us
${el.service.title != undefined? el.service.title : ''}
${el.service.review}
${el.customer != undefined?'By ' + el.customer.display_name: ''} ${dateDiffrence(el.service.created_at) <= 7 ? 'On ' + date.getDate().toString().padStart(2, "0") +'/'+ (date.getMonth() + 1).toString().padStart(2, "0") + '/' + date.getFullYear(): ''}
Thank you, your message has been received!
').fadeOut(5000); }); return false;}$(document).on('click','.subscribe_to_brand_btn',function(){ submitSubscribeToBrand();})//start req - 141 subscribe / signup function getBrandCoupon(brandname){ var brands = { /* */ /* */ /* */ /* */ /* */ /* G Shock */ /* */ /* Garmin */ /* */ }; return brands[brandname];}function signupToNewsletter(){ var source_url=window.location.href; var btnSubscribeValue=$("#btnSubscribeToNewsletter").val(); if($("#first_nameError").length){ $("#first_nameError").remove(); } if($("#last_nameError").length){ $("#last_nameError").remove(); } if($("#subscribetonewsletter_emailError").length){ $("#subscribetonewsletter_emailError").remove(); } if($("#notgenerate_couponError").length){ $("#notgenerate_couponError").remove(); } var hasErrorCount = 0; var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var first_name=$.trim($("#first_name").val()); var last_name=$.trim($("#last_name").val()); var subscribetonewsletter_email=$("#subscribetonewsletter_email").val(); if(first_name=="" || first_name.length==0) { $("#first_name").after('Enter your first name.'); hasErrorCount++; } if(last_name=="" || last_name.length==0) { $("#last_name").after('Enter your last name.'); hasErrorCount++; } if(subscribetonewsletter_email=="" || subscribetonewsletter_email.length==0) { $("#subscribetonewsletter_email").after('Enter a valid email address.'); hasErrorCount++; }else if(!emailReg.test(subscribetonewsletter_email)) { $("#subscribetonewsletter_email").after('Enter a valid email address.'); hasErrorCount++; } if(hasErrorCount==0){ $("#btnSubscribeToNewsletter").val('Submitting...'); $("#btnSubscribeToNewsletter").attr('disabled',true); var currentProduct = $('input[name=product_id]').val(); var product_title = $('.productView-title').html(); var product_price = $('.price.price--withTax').html().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/^\D+/g, ''); var coupon_code=generaterandomstring('N'+currentProduct,3); var brand_name=$(".productView").data().productBrand; var brandDisc=getBrandCoupon(currentProduct); if(brandDisc==undefined){ brandDisc=getBrandCoupon(brand_name); } var discount_percentage=brandDisc.discount_percentage; var cdate = new Date(); cdate.setDate(cdate.getDate() + 4); //var newdate=cdate.toLocaleString('en-GB', { timeZone: 'Europe/London' }); var getMonth=cdate.getMonth()+1; if(getMonth<=9){ getMonth='0'+getMonth; } var currentDateTime=getActualCurrentDateTime(); var current_date_time=currentDateTime.split(" "); var currentDate=current_date_time[0]; var currentTime=current_date_time[1]; var expiryDate=cdate.toUTCString(); var datastring={ "name":coupon_code,//discount_percentage+"% OFF each item in the order - "+coupon_code, "type":"percentage_discount", "code":coupon_code, "enabled":true, "amount":discount_percentage, "max_uses":1, "max_uses_per_customer":1, "applies_to_entity":"products", "applies_to_ids":currentProduct, "expires":expiryDate, "applies_to":{ "entity":"products", "ids":[currentProduct] } }; var settings = { "async": true, "crossDomain": true, "url": "https://cors-anywhere.herokuapp.com/https://api.bigcommerce.com/stores/jrb41cpnia/v2/coupons", "method": "POST", "headers": { "accept": "application/json", "content-type": "application/json", "x-auth-token": "eb66kbcictzvumf8e16u21pt5lb0o3r", "x-auth-client": "k2orqcz44xxhs9dzsb9wi0on1ywjdni" }, "processData": false, "data": JSON.stringify(datastring) } if(CsObj.useSignupToNewsletter2){ var settings = { "headers": { "Accept": "application/json"}, "async": true, "crossDomain": true, "url": "https://script.google.com/macros/s/AKfycbzlBuussoHlpsf5SuMJ5Plq4ry0qltBVJulGXn3keNnnL7rgs8meEv-6p8LBGhd3exR6g/exec", "method": "GET", "dataType": 'json', "data": datastring } } //Step -1 entry into google sheet var subject=encodeURIComponent('Sign-up Confirmation & Your Voucher Code Enclosed'); var datastring='currentDate='+currentDate+'¤tTime='+currentTime+'&first_name='+first_name+'&last_name='+last_name+'&email='+subscribetonewsletter_email+'&brand='+brand_name+'&product_id='+currentProduct+'&product_title='+product_title+'&product_price='+product_price+'&coupon_code='+coupon_code+'&subject='+subject+'&enable_to_send_vouchercode_email='+enable_to_send_vouchercode_email+'&source_url='+source_url; //var url = "https://script.google.com/macros/s/AKfycbwWALc4N9j7TdyYQ2xmLvSQszZ2pjlS9FhT5A_uKnAWamwy1EQ/exec"; Local //var url = "https://script.google.com/macros/s/AKfycbyrTGF9J9A-h3D-HGfyGOSLome8kNBbAjPq__57j2qPDb8idWX7/exec"; //Live //doc file https://docs.google.com/spreadsheets/d/1U8Bj1i2ecYHVzWiohh4o2K3GC_yrDLvUKcsHt8XgdzQ/edit#gid=0 var url = "https://script.google.com/macros/s/AKfycbyExLrq1ciT1-qL1csIKRyS06R2IelnTWa9RTO2-cNvwOwzlUWT25OjFOs7cI6aTRWdHw/exec"; //var url = 'https://script.google.com/macros/s/AKfycbwUMjWNRVv4xkjxM2SRH8qDNa3bknYj0noiJVez_L0JlkVyQjU6/exec'; //temp //var url = 'https://script.google.com/macros/s/AKfycbxuVdm4g05D1aiy1nP7E89KO8BTbvjV6oM2wc-XcC9UeghzWS3d/exec'; $.ajax({ headers: { "Accept": "application/json"}, url: url, method: 'GET', dataType: 'json', data : datastring, crossDomain: true, success:function(response){ $("#first_name").val(''); $("#last_name").val(''); $("#subscribetonewsletter_email").val(''); $('#btnSubscribeToNewsletter').val(btnSubscribeValue); $('#btnSubscribeToNewsletter').attr('disabled',false); if(enable_to_show_vouchercode_on_page=='yes'){ $("#subscribetoNewsletterSuccessMsg").css('display','block'); $("#span_coupon_code").text(coupon_code); } }, error:function (xhr, ajaxOptions, thrownError){ console.log(xhr.status); console.log(thrownError); } }); //step 2 - entry for coupon code via bigcommerce API $.ajax(settings).done(function (response) { }); }}//end req - 141function getActualCurrentDateTime(){ var newdate = new Date(); var current_date_time=newdate.toLocaleString('en-GB', { timeZone: 'Europe/London' }); current_date_time=current_date_time.replace(',', ''); return current_date_time;}function generaterandomstring(stringtojoin='NX',length=1){ //generate random strings var d = new Date(); var currentTime=d.getTime(); // declare all characters //let characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZ'+currentTime+'abcdefghijklmnopqrstuvwxyz'; let characters ='ABCDEFGHIJKLMNO'+currentTime+'PQRSTUVWXYZ'; let result = ''; let charactersLength = characters.length; for ( let i = 0; i < length; i++ ) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } if(stringtojoin!=""){ result=stringtojoin+result; } return result;}×