Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (2024)

The store will not work correctly in the case when cookies are disabled.

Current Selection : "+sizeCookies['widthValue']+" / "+ sizeCookies['heightValue']+" R"+sizeCookies['rimsizeValue']+"

Enter Your Location(Required)

Locate me

').append(""); $(cityI).appendTo('.loc').val(locations).attr('type','text'); $('#searchbysize-popup').find("#cityI").prop('required',true); $('#cityI').prop('disabled',false); } $("#searchbysize-popup").modal("openModal"); } else if((widthValue != null && heightValue !=null && rimsizeValue !=null) && ($('.rear_tyres').is(":hidden")) && (location != '')){ $('#cityI').removeClass('empty_location'); $('#cityRearInput').removeClass('empty_location'); $('#cityInput').removeClass('empty_location'); var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru = 0; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(location).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru =1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } if(typeof loc['location'] !== 'undefined') { loc['location'] = location ; }else{ loc['location']= location ; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = long ; }else{ loc['longitude']= long ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = lat ; }else{ loc['latitude']= lat ; } setcookie("fme_customer_data", JSON.stringify(loc)); updateCartTotals(); // setFrontSizeCookiesArray(); var frontsize='results/f/'+sizeCookies['widthValue']+'-'+sizeCookies['heightValue']+'-'+sizeCookies['rimsizeValue']; setcookie("search", 1); window.location.href = frontsize; $("form").submit(function(e){ e.preventDefault(); }); } else if((widthValue !=null && heightValue !=null && rimsizeValue !=null) && ($('.rear_tyres').is(":visible")) && (rearwidthValue !=null && rearheightValue != null && rearrimsizeValue != null) && (location != '')){ $('#cityI').removeClass('empty_location'); $('#cityRearInput').removeClass('empty_location'); $('#cityInput').removeClass('empty_location'); var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =0; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(location).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru =1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } if(typeof loc['location'] !== 'undefined') { loc['location'] = location ; }else{ loc['location']= location ; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = long ; }else{ loc['longitude']= long ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = lat ; }else{ loc['latitude']= lat ; } setcookie("fme_customer_data", JSON.stringify(loc)); updateCartTotals(); // setFrontSizeCookiesArray(); var rearUrl = '/viewall/f/'+sizeCookies['widthValue']+'-'+sizeCookies['heightValue']+'-'+sizeCookies['rimsizeValue']+'/r/'+sizeCookies['rearwidthValue']+'-'+sizeCookies['rearheightValue']+'-'+sizeCookies['rearrimsizeValue']; setcookie("search", 1); window.location.href = rearUrl; $("form").submit(function(e){ e.preventDefault(); }); } else if((widthValue !=null && heightValue !=null && rimsizeValue !=null) && ($('.rear_tyres').is(":visible")) && (rearwidthValue !=null && rearheightValue != null && rearrimsizeValue != null) && (location == '')){ $('#cityInput').addClass('empty_location'); $('#cityRearInput').addClass('empty_location'); $("form").submit(function(e){ e.preventDefault(); }); } else if(($('.rear_tyres').is(":hidden")) && (location !='') && (widthValue ==null) || (heightValue == null) || (rimsizeValue == null )){ $("form").submit(function(e){ e.preventDefault(); }); addWidthClass(); $("#searchbysize-popup").empty(); $(".search_by").find('.search_by_size').empty(); widthPopUpImages(); showWidthPopUp(); $("#searchbysize-popup").modal("openModal"); } else if((widthValue !=null && heightValue !=null && rimsizeValue !=null) && ($('.rear_tyres').is(":visible")) && (rearwidthValue ==null || rearheightValue == null || rearrimsizeValue == null)){ $("form").submit(function(e){ e.preventDefault(); }); rearFilter1(); } } function widthPopUpImages(){ $(".search_by").find('.search_by_size').append("

  • width
  • height
  • rim size
  • 205
  • /
  • 65
  • R 16

"); $(".search_by").find('.popup_breadcrumb').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (1)'); $(".search_by").find('.img').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (2)'); } function rearWidthPopUpImages(){ $(".search_by").find('.search_by_size').append("

  • width
  • height
  • rim size
  • 205
  • /
  • 65
  • R 16

"); $(".search_by").find('.popup_breadcrumb').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (3)'); $(".search_by").find('.img').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (4)'); } function heightPopUpImages(){ $(".search_by").find('.search_by_size').append("

  • width
  • height
  • rim size
  • "+sizeCookies['widthValue']+"
  • /
  • 65
  • R 16

"); $(".search_by").find('.popup_breadcrumb').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (5)'); $(".search_by").find('.img').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (6)'); } function rearheightPopUpImages(){ $(".search_by").find('.search_by_size').append("

  • width
  • height
  • rim size
  • "+sizeCookies['rearwidthValue']+"
  • /
  • 65
  • R 16

"); $(".search_by").find('.popup_breadcrumb').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (7)'); $(".search_by").find('.img').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (8)'); } function rimsizePopUpImages(){ $(".search_by").find('.search_by_size').append("

  • width
  • height
  • rim size
  • "+sizeCookies['widthValue']+"
  • /
  • "+sizeCookies['heightValue']+"
  • R 16

"); $(".search_by").find('.popup_breadcrumb').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (9)'); $(".search_by").find('.img').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (10)'); } function rearrimsizePopUpImages(){ $(".search_by").find('.search_by_size').append("

  • width
  • height
  • rim size
  • "+sizeCookies['rearwidthValue']+"
  • /
  • "+sizeCookies['rearheightValue']+"
  • R 16

"); $(".search_by").find('.popup_breadcrumb').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (11)'); $(".search_by").find('.img').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (12)'); } function locationPopUpImages(){ $(".search_by").find('.search_by_size').append("

  • width
  • height
  • rim size
  • "+sizeCookies['widthValue']+"
  • /
  • "+sizeCookies['heightValue']+"
  • R "+sizeCookies['rimsizeValue']+"

"); $(".search_by").find('.popup_breadcrumb').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (13)'); $(".search_by").find('.img').append('Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (14)'); } function showWidthPopUp(){ clearHeader(); $(".search_by").find('.search_by_size').empty(); widthPopUpImages(); $("

Current Selection :

").insertAfter($(".search_by").find('.tyre_model')); $('').insertAfter($(".search_by").find('.current_selection')); $('.fmeproductfinder-hidden:first').clone(true,true).appendTo('#searchbysize-popup').css({'display':'block'}); } function frontPopupAppend(){ $("

").insertAfter($('.search_by_size').find('.top_section')); $('.fmeproductfinder-select').append('

    '); } function rearPopupAppend(){ $("

    ").insertAfter($('#searchbysize-popup').find('.top_section')); $('.fmeproductfinder-selects').append('

      '); } function rimsizeArray(rimsize){ $.each(rimsize, function(i,val) { $('.fmeproductfinder-select').find('ul.value_no').append("

    • "); }); } function backTolocation(){ var wid = 'width'; $(".search_by").find('.modal-header').prepend(''); } function noFrontSize(){ $("

      Front Tyre Selection : Width / Height RRimsize

      ").insertAfter($(".search_by").find('.tyre_model')); } function backToRimSize(){ var rs = 'rim_size'; $(".search_by").find('.modal-header').prepend(''); } function rearWidthValue(){ $('.current_selection').append("

      Rear Tyre Selection : "+sizeCookies['rearwidthValue']+"

      "); } function backTorearHeight(){ var hei = 'height'; $(".search_by").find('.modal-header').prepend(''); } function backToHeight(){ var hei = 'height'; $(".search_by").find('.modal-header').prepend(''); } function backToRearRimSize(){ var rs = 'rim_size'; $(".search_by").find('.modal-header').prepend(''); } function rearWidth(){ $('.fmeproductfinder-sel:first').clone(true,true).appendTo('#searchbysize-popup').css({'display':'block'}); } function backToRearWidth(){ var wid = 'width'; $(".search_by").find('.modal-header').prepend(''); } function toRearWidth(){ $('.fmeproductfinders-hidden:first').clone(true,true).appendTo('#searchbysize-popup').css({'display':'block'}); } function setFrontSizeCookiesArray(){ var sizesData = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(temporaryHeight !=null){ if(typeof sizesData['height'] !== 'undefined') { sizesData['height'] = temporaryHeight; }else{ sizesData['height']= temporaryHeight; } } if(temporaryRearHeight !=null){ if(typeof sizesData['rear_height'] !== 'undefined') { sizesData['rear_height'] = temporaryRearHeight; }else{ sizesData['rear_height']= temporaryRearHeight; } } if(temporaryRimSize !=null){ if(typeof sizesData['rim_size'] !== 'undefined') { sizesData['rim_size'] = temporaryRimSize; }else{ sizesData['rim_size']= temporaryRimSize; } } if(temporaryRearRimSize !=null){ if(typeof sizesData['rear_rim_size'] !== 'undefined') { sizesData['rear_rim_size'] = temporaryRearRimSize; }else{ sizesData['rear_rim_size']= temporaryRearRimSize; } } setcookie("fme_sizes_data", JSON.stringify(sizesData)); } $(document).on('click', '.previous', function() { var widthValue = sizeCookies['widthValue']; var heightValue = sizeCookies['heightValue']; var rimsizeValue = sizeCookies['rimsizeValue']; var rearwidthValue = sizeCookies['rearwidthValue']; var rearheightValue = sizeCookies['rearheightValue']; var rearrimsizeValue = sizeCookies['rearrimsizeValue']; var previousField = $(this).attr('id'); var rs = 'rim_size'; var hei = 'height'; var wid = 'width'; if(previousField == wid){ addWidthClass(); showWidthPopUp(); $('div.search_by_size').removeClass('rearsizeactive'); } if(previousField == hei){ addHeightClass(); var size = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(typeof size['height'] !== 'undefined') { var heights= size['height']; }else{ var heights= size['height']; } var height = $.parseJSON(heights); clearHeader(); var wid = 'width'; $(".search_by").find('.modal-header').prepend(''); $(".search_by").find('.search_by_size').empty(); heightPopUpImages(); frontPopupAppend(); if(temporaryHeight !=null){ var height = $.parseJSON(temporaryHeight); $.each(height, function(i,val) { $('.fmeproductfinder-select').find('ul.value_no').append("

    • "); }); }else{ $.each(height, function(i,val) { $('.fmeproductfinder-select').find('ul.value_no').append("

    • "); }); } if(widthValue != null){ $("

      Current Selection : "+widthValue+"

      ").insertAfter($(".search_by").find('.tyre_model')); } $('').insertAfter($(".search_by").find('.current_selection')); $('div.search_by_size').removeClass('rearsizeactive'); } if(previousField == rs){ addRimSizeClass(); var size = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(typeof size['rim_size'] !== 'undefined') { var rim_sizes= size['rim_size']; }else{ var rim_sizes= size['rim_size']; } var rimsize = $.parseJSON(rim_sizes); if((rimsize == null || rimsize == '') && (temporaryRimSize == null || temporaryRimSize == '') ){ $('.action-close').trigger('click'); }else{ clearHeader(); backToHeight(); $(".search_by").find('.search_by_size').empty(); rimsizePopUpImages(); if(widthValue != null && heightValue != null && rimsizeValue != null ){ $("

      Current Selection : "+sizeCookies['widthValue']+" / "+ sizeCookies['heightValue']+"

      ").insertAfter($(".search_by").find('.tyre_model')); } frontPopupAppend(); if(temporaryRimSize != null){ temporaryRimSizes = $.parseJSON(temporaryRimSize); $.each(temporaryRimSizes, function(i,val) { $('.fmeproductfinder-select').find('ul.value_no').append("

    • "); }); }else{ rimsizeArray(rimsize); } } $('').insertAfter($(".search_by").find('.current_selection')); $('div.search_by_size').removeClass('rearsizeactive'); } }); $(document).on('click', '.rearpreviouslocation', function() { addLocationClass(); var widthValue = sizeCookies['widthValue']; var heightValue = sizeCookies['heightValue']; var rimsizeValue = sizeCookies['rimsizeValue']; var rearwidthValue = sizeCookies['rearwidthValue']; var rearheightValue = sizeCookies['rearheightValue']; var rearrimsizeValue = sizeCookies['rearrimsizeValue']; var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } var size = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(typeof size['rim_size'] !== 'undefined') { var rim_sizes= size['rim_size']; }else{ var rim_sizes= size['rim_size']; } var rimsize = $.parseJSON(rim_sizes); if(rimsizeValue == null){ showWidthPopUp(); }else{ $(".search_by").find('.search_by_size').empty(); clearHeader(); rimsizePopUpImages(); if($('#searchbysize-popup').find('p').length == 0){ if(widthValue != null && heightValue != null && rimsizeValue != null ){ $("

      Current Selection : "+widthValue+" / "+ heightValue+" R"+rimsizeValue+"

      ").insertAfter($(".search_by").find('.tyre_model')); } else{ $("

      Current Selection :/

      ").insertAfter($(".search_by").find('.tyre_model')); } } } backToRimSize(); var locations = location; if(location==null){ locations =''; } $('#searchbysize-popup').append('

      '); $('#searchbysize-popup').find('.location_block').append('

      Add a different rear tyre size?

      ').append('

      Enter Your Location(Required)

      Locate me

      ').append(""); $(cityI).appendTo('.loc').val(locations).attr('type','text'); $('#searchbysize-popup').find("#cityInput").prop('required',true); var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } if($('#searchbysize-popup').children('.reartyre').children('.rear_tyres_hidden').length !=0 ){ if(sizeCookies['click']==0 || sizeCookies['click']==null ){ $('#searchbysize-popup').children('.reartyre').children('.rear_tyres_hidden').toggle(); }else{ $('#searchbysize-popup').children('.reartyre').children('.rear_tyres_hidden'); } } $('#searchbysize-popup').find('.fmeproductfinder-select').remove(); if($(".rear_tyres_hidden").length !=0){ if($('#searchbysize-popup').children('.reartyre').children('.rear_tyres_hidden').length == 0){ if(sizeCookies['click']==0 || sizeCookies['click']==null ){ $(".rear_tyres_hidden").clone(true,true).appendTo(".reartyre").css({'display':'block','overflow':'visible','opacity':1}).toggle(); }else{ $(".rear_tyres_hidden").clone(true,true).appendTo(".reartyre").css({'display':'block','overflow':'visible','opacity':1}); } var locations = location; if(location==null){ locations =''; } $('#searchbysize-popup').children('#cityI').remove(); $(cityI).val(locations).attr('type','text').insertAfter($('#searchbysize-popup').children('.reartyre').children('.rear_tyres_hidden')); $('#searchbysize-popup').children('.reartyre').children('#cityI').removeAttr('disabled'); $('#searchbysize-popup').children('#submitButton').remove(); $(".fmepf-find-btn").clone(true,true).attr('id','submitButton').insertAfter($('#searchbysize-popup').children('.reartyre').children('.rear_tyres_hidden').next('#cityI')).css({'overflow':'visible','opacity':1}); if($('#searchbysize-popup').children('.reartyre').children('#cityI').val() !=null){ $('#searchbysize-popup').children('.reartyre').children('.fmepf-find-btn').removeAttr('disabled'); } } } }); //on rear previous clicks $(document).on('click', '.rearprevious', function() { var previousField = $(this).attr('id'); var rs = 'rim_size'; var hei = 'height'; var wid = 'width'; if(previousField == wid){ $('#searchbysize-popup').parents('.search_by').addClass('rearwidth_popup'); $('#searchbysize-popup').parents('.search_by').removeClass('rearheight_popup'); $('#searchbysize-popup').parents('.search_by').removeClass('rearrimsize_popup'); $('#searchbysize-popup').parents('.search_by').removeClass('location_popup'); $(".search_by").find('.search_by_size').empty(); rearWidthPopUpImages(); clearHeader(); backTolocation(); if(sizeCookies['widthValue'] != null && sizeCookies['heightValue'] != null && sizeCookies['rimsizeValue'] != null ){ $("

      Front Tyre Selection : "+sizeCookies['widthValue']+" / "+ sizeCookies['heightValue']+" R"+sizeCookies['rimsizeValue']+"

      ").insertAfter($(".search_by").find('.tyre_model')); } else{ noFrontSize(); } $('.current_selection').append("

      Rear Tyre Selection :

      "); $('').insertAfter($(".search_by").find('.current_selection')); toRearWidth(); $('div.search_by_size').addClass('rearsizeactive'); } if(previousField == hei){ addRearheightClass(); clearHeader(); backToRearWidth(); $(".search_by").find('.search_by_size').empty(); rearheightPopUpImages(); rearPopupAppend(); if(sizeCookies['widthValue'] != null && sizeCookies['heightValue'] != null && sizeCookies['rimsizeValue'] != null ){ $("

      Front Tyre Selection : "+sizeCookies['widthValue']+" / "+ sizeCookies['heightValue']+" R"+sizeCookies['rimsizeValue']+"

      ").insertAfter($(".search_by").find('.tyre_model')); } else{ noFrontSize(); } $('.current_selection').append("

      Rear Tyre Selection : "+sizeCookies['rearwidthValue']+"

      "); $('').insertAfter($(".search_by").find('.current_selection')); var size = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(typeof size['rear_height'] !== 'undefined') { var rear_height= size['rear_height']; }else{ var rear_height= size['rear_height']; } var height = $.parseJSON(rear_height); if(temporaryRearHeight !=null){ var height = $.parseJSON(temporaryRearHeight); $.each(height, function(i,val) { $('.fmeproductfinder-selects').find('ul.value_no').append("

    • "); }); }else{ $.each(height, function(i,val) { $('.fmeproductfinder-selects').find('ul.value_no').append("

    • "); }); } $('div.search_by_size').addClass('rearsizeactive'); } if(previousField == 'rear_'+rs){ addRearRimsizeClass(); clearHeader(); backTorearHeight(); var size = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(typeof size['rear_rim_size'] !== 'undefined') { var rear_rim_size= size['rear_rim_size']; }else{ var rear_rim_size= size['rear_rim_size']; } var rim_size = $.parseJSON(rear_rim_size); $(".search_by").find('.search_by_size').empty(); rearrimsizePopUpImages(); rearPopupAppend(); if(sizeCookies['widthValue'] != null && sizeCookies['heightValue'] != null && sizeCookies['rimsizeValue'] != null ){ $("

      Front Tyre Selection : "+sizeCookies['widthValue']+" / "+ sizeCookies['heightValue']+" R"+sizeCookies['rimsizeValue']+"

      ").insertAfter($(".search_by").find('.tyre_model')); } else{ noFrontSize(); } $('.current_selection').append("

      Rear Tyre Selection : "+sizeCookies['rearwidthValue']+" / "+ sizeCookies['rearheightValue']+"

      "); $('').insertAfter($(".search_by").find('.current_selection')); if(temporaryRearRimSize != null){ var temporaryRearRimSizes = $.parseJSON(temporaryRearRimSize); $.each(temporaryRearRimSizes, function(i,val) { $('.fmeproductfinder-selects').find('ul.value_no').append("

    • "); }); }else{ $.each(rim_size, function(i,val) { $('.fmeproductfinder-selects').find('ul.value_no').append("

    • "); }); } $('div.search_by_size').addClass('rearsizeactive'); } }); //front popup submit $(document).on('click','#submitButton',function(){ var widthValue = sizeCookies['widthValue']; var heightValue = sizeCookies['heightValue']; var rimsizeValue = sizeCookies['rimsizeValue']; var city = $(this).prev('.enter_location').find('input#cityI').val(); if(city == ''){ $(this).prev('.enter_location').find('input#cityI').addClass('empty_location'); } else if(widthValue != null && heightValue !=null && rimsizeValue !=null){ $('#cityInput').val(city); var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { loc['location'] = $.trim(city); }else{ loc['location'] = $.trim(city); } var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =1; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(city).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru=1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = long ; }else{ loc['longitude']= long ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = lat ; }else{ loc['latitude']= lat ; } setcookie("fme_customer_data", JSON.stringify(loc)); updateCartTotals(); // setFrontSizeCookiesArray(); var frontsize=window.BaseUrl+'results/f/'+sizeCookies['widthValue']+'-'+sizeCookies['heightValue']+'-'+sizeCookies['rimsizeValue']; setcookie("search", 1); window.location.href = frontsize; $("form").submit(function(e){ e.preventDefault(); }); } }); $(document).on('click','#submitlocButton',function(){ var rearwidthValue = sizeCookies['rearwidthValue']; var rearheightValue = sizeCookies['rearheightValue']; var rearrimsizeValue = sizeCookies['rearrimsizeValue']; var widthValue = sizeCookies['widthValue']; var heightValue = sizeCookies['heightValue']; var rimsizeValue = sizeCookies['rimsizeValue']; var city = $(this).prev('.enter_location').find('input#cityI').val(); if(city == ''){ $(this).prev('.enter_location').find('input#cityI').addClass('empty_location'); } else if((city !='' ) && (widthValue !=null && heightValue !=null && rimsizeValue != null) && (rearwidthValue !=null && rearheightValue !=null && rearrimsizeValue != null) && ($('.rear_tyres').is(":visible"))){ $('#cityInput').val(city); var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { loc['location'] = $.trim(city); }else{ loc['location'] = $.trim(city); } var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =0; $.each(locCity, function(i,val) { tru =1; var newArray = val.split('=>'); var locf = $.trim(city).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = long ; }else{ loc['longitude']= long ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = lat ; }else{ loc['latitude']= lat ; } setcookie("fme_customer_data", JSON.stringify(loc)); updateCartTotals(); $('#cityInput').val(city); // setFrontSizeCookiesArray(); var rearUrl =window.BaseUrl+'/viewall/f/'+sizeCookies['widthValue']+'-'+sizeCookies['heightValue']+'-'+sizeCookies['rimsizeValue']+'/r/'+sizeCookies['rearwidthValue']+'-'+sizeCookies['rearheightValue']+'-'+sizeCookies['rearrimsizeValue']; setcookie("search", 1); window.location.href = rearUrl; $("form").submit(function(e){ e.preventDefault(); }); } else if((widthValue != null && heightValue != null && rimsizeValue != null)&& ($('.rear_tyres').is(":hidden")) ){ $('#cityInput').val(city); var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { loc['location'] = $.trim(city); }else{ loc['location'] = $.trim(city); } var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =0; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(city).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru =1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = long ; }else{ loc['longitude']= long ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = lat ; }else{ loc['latitude']= lat ; } setcookie("fme_customer_data", JSON.stringify(loc)); updateCartTotals(); $('#cityInput').val(city); $('#widthvalue').val(sizeCookies['widthId']); $('#heightvalue').val(sizeCookies['heightId']); $('#rim_sizevalue').val(sizeCookies['rimsizeId']); // setFrontSizeCookiesArray(); var frontsize='results/f/'+sizeCookies['widthValue']+'-'+sizeCookies['heightValue']+'-'+sizeCookies['rimsizeValue']; setcookie("search", 1); window.location.href = frontsize; $("form").submit(function(e){ e.preventDefault(); }); } else if(widthValue == null || heightValue == null || rimsizeValue == null){ $(".search_by").find('.search_by_size').empty(); showWidthPopUp(); } }); $(document).on('click','#find-1',function(){ if(cityI == ''){ cityI = $('#cityI').detach(); } if(cityRearInput == ''){ cityRearInput = $('#cityRearInput').detach(); } onClickGoButton(); }); $(document).on('click','#find-2',function(){ if(cityI != ''){ cityI = $('#cityI').detach(); } if(cityRearInput != ''){ cityRearInput = $('#cityRearInput').detach(); } onClickGoButton(); }); $(document).on('click', '#submitRearButton', function() { var widthValue = sizeCookies['widthValue']; var heightValue = sizeCookies['heightValue']; var rimsizeValue = sizeCookies['rimsizeValue']; var rearwidthValue = sizeCookies['rearwidthValue']; var rearheightValue = sizeCookies['rearheightValue']; var rearrimsizeValue = sizeCookies['rearrimsizeValue']; var location = $('#searchbysize-popup').find('input#cityRearInput').val(); if(location ==''){ $('#searchbysize-popup').find('input#cityRearInput').addClass('empty_location'); } else if(widthValue == null || heightValue == null || rimsizeValue == null){ $("form").submit(function(e){ e.preventDefault(); }); var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { loc['location'] = $.trim(location); }else{ loc['location'] = $.trim(location); } var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =0; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(location).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru =1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } setcookie("fme_customer_data", JSON.stringify(loc)); updateCartTotals(); clearHeader(); $(".search_by").find('.search_by_size').empty(); showWidthPopUp(); } else{ var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { loc['location'] = $.trim(location); }else{ loc['location'] = $.trim(location); } var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =0; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(location).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru =1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = long ; }else{ loc['longitude']= long ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = lat ; }else{ loc['latitude']= lat ; } setcookie("fme_customer_data", JSON.stringify(loc)); updateCartTotals(); // setFrontSizeCookiesArray(); var rearUrl = '/viewall/f/'+sizeCookies['widthValue']+'-'+sizeCookies['heightValue']+'-'+sizeCookies['rimsizeValue']+'/r/'+sizeCookies['rearwidthValue']+'-'+sizeCookies['rearheightValue']+'-'+sizeCookies['rearrimsizeValue']; setcookie("search", 1); window.location.href = rearUrl; $("form").submit(function(e){ e.preventDefault(); }); } }); // on click city field $(document).on('click','#cityInput',function(){ if(cityI == ''){ cityI = $('#cityI').detach(); } if(cityRearInput == ''){ cityRearInput = $('#cityRearInput').detach(); } $(".search_by").find('.search_by_size').empty(); clearHeader(); var width = sizeCookies['widthValue']; var height = sizeCookies['heightValue']; var rimsize = sizeCookies['rimsizeValue']; var rearwidth = sizeCookies['rearwidthValue']; var rearheight = sizeCookies['rearheightValue']; var rearrimsize = sizeCookies['rearrimsizeValue']; var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } if((width == null && height == null && rimsize == null) && (rearwidth == null && rearheight == null && rearrimsize == null) ){ var locations = location; if(location == null){ locations =''; } backToRimSize(); locationPopUpImages(); addLocationClass(); $("

      Current Selection :

      ").insertAfter($(".search_by").find('.tyre_model')); $('#searchbysize-popup').find('.top_section').append('

      '); // $('.filter_values').append('

      Enter Your Location(Required)

      Locate me

      ').append("

      "); $('.search_by_size').find('.location_block').append('

      ').append('

      Enter Your Location(Required)

      Locate me

      ').append("

      "); $(cityI).appendTo('.loc').val(locations).attr('type','text'); $('#searchbysize-popup').find("#cityI").prop('required',true); $("#searchbysize-popup").modal("openModal"); }else{ if((width !=null && height != null && rimsize != null) && (rearwidth == null || rearheight == null || rearrimsize == null)&& ($('.rear_tyres').is(":visible")) ){ locationPopUpImages(); backToRearRimSize(); $("

      Front Tyre Selection : "+width+" / "+height+" R"+rimsize+"

      Rear Tyre Selection :

      ").insertAfter($(".search_by").find('.tyre_model')); $('div.search_by_size').addClass('rearsizeactive'); } else if((width == null || height == null || rimsize == null) && rearwidth != null && rearheight != null && rearrimsize != null && ($('.rear_tyres').is(":hidden"))){ noFrontSize(); } else if((width == null || height == null || rimsize == null) && (rearwidth != null && rearheight != null && rearrimsize != null) && ($('.rear_tyres').is(":visible"))){ locationPopUpImages(); addLocationClass(); backToRearRimSize(); noFrontSize(); $('.current_selection').append("

      Rear Tyre Selection : "+rearwidth+" / "+rearheight+" R"+rearrimsize+"

      "); $('div.search_by_size').addClass('rearsizeactive'); } else if((width != null && height != null && rimsize != null) && (rearwidth != null && rearheight != null && rearrimsize != null) && ($('.rear_tyres').is(":visible"))){ locationPopUpImages(); addLocationClass(); $("

      Front Tyre Selection : "+width+" / "+height+" R"+rimsize+"

      Rear Tyre Selection :"+rearwidth+" / "+rearheight+" R"+rearrimsize+"

      ").insertAfter($(".search_by").find('.tyre_model')); backToRearRimSize(); $('div.search_by_size').addClass('rearsizeactive'); } else if(width != null && height != null && rimsize != null && ($('.rear_tyres').is(":hidden"))){ backToRimSize(); locationPopUpImages(); addLocationClass(); $("

      Current Selection : "+width+"/"+height+" R"+rimsize+"

      ").insertAfter($(".search_by").find('.tyre_model')); } else if(width == null || height == null || rimsize == null && ($('.rear_tyres').is(":hidden"))){ backToRimSize(); locationPopUpImages(); addLocationClass(); $("

      Current Selection :

      ").insertAfter($(".search_by").find('.tyre_model')); } var locations = location; if(location==null){ locations =''; } if( $('.search_by').find('.rear_tyre').length == 0){ $('#searchbysize-popup').append('

      '); $('#searchbysize-popup').find('.location_block').append('

      Add a different rear tyre size?

      ').append('

      Enter Your Location(Required)

      ').append("

      "); $(cityI).appendTo('.loc').val(locations).attr('type','text'); $('#searchbysize-popup').find("#cityI").prop('required',true); $('#cityI').prop('disabled',false); } $("#searchbysize-popup").modal("openModal"); } }); function setcookie(cookie_name,cookie_value) { var expire11 = new Date(); expire11.setTime(expire11.getTime() + (6 * 60 * 60 * 1000)); $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); if($.mage.cookies.get(cookie_name)!=cookie_value) { $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); } return; } function updateCartTotals(){ var url = "https://www.pitstoparabia.com/en/fmegeneric/index/updatetotals/"; $.ajax({ url: url, type: "POST", showLoader: false, cache: false, success: function(response){ var sections = ['cart']; require('Magento_Customer/js/customer-data').invalidate(sections); require('Magento_Customer/js/customer-data').reload(sections, true); } }); }// $(document).ready(function () {// function getsearchBycustomer(cookie_name)// {// if($.cookie('fme_customer_data')!="" && $.cookie('fme_customer_data')!=null )// {// var jsonData = JSON.parse(($.cookie('fme_customer_data'))); // return jsonData[cookie_name];// }else{// return false;// }// }// function loadcookiesonload()// {// if(!getsearchBycustomer("email"))// {// local_email_cook=""// }// else{// local_email_cook=getsearchBycustomer("email")// }// if(!getsearchBycustomer("name"))// {// local_name_cook=""// }// else{// local_name_cook=getsearchBycustomer("name")// }// if(!getsearchBycustomer("phone_num"))// {// local_phone_num_cook=""// }// else{// local_phone_num_cook=getsearchBycustomer("phone_num")// }// if(!getsearchBycustomer("location"))// {// local_location_cook=""// }// else{// local_location_cook=getsearchBycustomer("location")// }// if(!getsearchBycustomer("deop"))// {// local_deop_cook=""// }// else{// local_deop_cook=getsearchBycustomer("deop")// }// if(!getsearchBycustomer("longitude"))// {// longitude=""// }// else{// longitude=getsearchBycustomer("longitude");// $('#longitude').val(longitude);// }// if(!getsearchBycustomer("latitude"))// {// latitude=""// }// else{// latitude=getsearchBycustomer("latitude");// $('#latitude').val(latitude);// }// if(!getsearchBycustomer("skip"))// {// skip=""// }// else{// skip=getsearchBycustomer("skip")// }// if(!getsearchBycustomer("locationCity"))// {// locationCity=""// }// else{// locationCity=getsearchBycustomer("locationCity")// }// $.mage.cookies.clear('fme_customer_data');// setcookiesCustomer(local_email_cook,local_name_cook,local_phone_num_cook,local_location_cook,local_deop_cook,longitude,latitude,skip,locationCity)// }// loadcookiesonload();// function setcookie(cookie_name,cookie_value)// {// var expire11 = new Date();// expire11.setTime(expire11.getTime() + (6 * 60 * 60 * 1000)); // $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null});// // //alert($.mage.cookies.getCookieVal(cookie_name))// if($.mage.cookies.get(cookie_name)!=cookie_value)// {// $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null});// }// return;// }// function updateCartTotals(){// var url = "https://www.pitstoparabia.com/en/fmegeneric/index/updatetotals/";// $.ajax({ // url: url, // type: "POST", // showLoader: false, // cache: false, // success: function(response){ // var sections = ['cart'];// require('Magento_Customer/js/customer-data').invalidate(sections);// require('Magento_Customer/js/customer-data').reload(sections, true);// } // });// }// function setcookiesCustomer(email,name,phone_num,location,deop,longitude,latitude,skip,locationCity)// {// var fme_customer_data = {};// fme_customer_data['email'] = email;// fme_customer_data['name'] = name;// fme_customer_data['phone_num'] = phone_num;// fme_customer_data['location'] =location;// fme_customer_data['deop'] =deop;// fme_customer_data['longitude'] =longitude;// fme_customer_data['latitude'] =latitude;// fme_customer_data['skip'] =skip;// fme_customer_data['locationCity'] =locationCity;// $.mage.cookies.clear('fme_customer_data');// //locationCity// setcookie('fme_customer_data', JSON.stringify(fme_customer_data))// }// var x = $("form").serializeArray();// $.each(x, function(i, field) {// if(field.name == 'form_key'){// formkey = field.value;// }// });// if ($.mage.cookies.get('fme_sizes_data') == null){// var size ={};// size['height'] = null;// size['rim_size'] = null;// size['rear_height'] = null;// size['rear_rim_size'] = null;// var fme_sizes = JSON.stringify(size);// setcookie('fme_sizes_data',fme_sizes);// }// var location = null;// var longitude = null;// var latitude = null;// var loc = $.parseJSON($.mage.cookies.get('fme_customer_data'));// if(loc !=null){// if(typeof loc['location'] !== 'undefined') {// location = loc['location'];// }else{// location = loc['location'];// }// if(typeof loc['longitude'] !== 'undefined') {// longitude = loc['longitude'];// }else{// longitude = loc['longitude'];// }// if(typeof loc['latitude'] !== 'undefined') {// latitude = loc['latitude'];// }else{// latitude = loc['latitude'];// }// }// if(location !=null){// $('#cityInput').val(location);// }// if(longitude !=null){// $('#longitude').val(longitude);// } // if(latitude !=null){// $('#latitude').val(latitude);// }// var sizeCookie =[];// sizeCookie =$.parseJSON($.mage.cookies.get('sizeCookies'));// var width=null;// var widthId=null;// var height=null;// var heightId=null;// var rimsize=null;// var rimsizeId=null;// var widthRear=null;// var rearwidthId=null;// var heightRear = null;// var rearheight=null;// var rearheightId=null;// var rearrimsize=null;// var rearrimsizeId=null;// sizeCookies['widthValue'] = null;// sizeCookies['heightValue'] = null;// sizeCookies['rimsizeValue'] = null;// sizeCookies['rearwidthValue'] = null;// sizeCookies['rearheightValue'] = null;// sizeCookies['rearrimsizeValue'] = null;// sizeCookies['searchedRearHeigthId'] = null;// sizeCookies['widthId'] = null;// sizeCookies['heightId'] = null;// sizeCookies['rimsizeId'] = null;// sizeCookies['click'] = null;// if(sizeCookie !== null) {// $('#search_size').removeClass('no_value');// width = sizeCookie['searchedWidth'];// if(typeof sizeCookies['widthValue'] !== 'undefined') {// sizeCookies['widthValue'] = $.trim(width);// sizeCookies['heightValue'] = null;// sizeCookies['rimsizeValue'] = null;// }else{// sizeCookies['widthValue'] = $.trim(width);// sizeCookies['heightValue'] = null;// sizeCookies['rimsizeValue'] = null;// }// widthId = sizeCookie['searchedWidthId'];// sizeCookies['widthId'] = widthId;// height = sizeCookie['searchedHeight'];// if(typeof sizeCookies['heightValue'] !== 'undefined') {// sizeCookies['heightValue'] = height;// }else{// sizeCookies['heightValue'] = height;// }// heightId = sizeCookie['searchedHeightId'];// sizeCookies['heightId'] = heightId;// rimsize = sizeCookie['searchedRimSize'];// if(typeof sizeCookies['rimsizeValue'] !== 'undefined') {// sizeCookies['rimsizeValue'] = rimsize;// }else{// sizeCookies['rimsizeValue'] = rimsize;// }// sizeCookies['rearwidthValue'] = sizeCookie['searchedRearWidth'];// sizeCookies['rearheightValue'] = sizeCookie['searchedRearHeight'];// sizeCookies['rearrimsizeValue'] = sizeCookie['searchedRearRimSize'];// rimsizeId = sizeCookie['searchedRimSizeId'];// sizeCookies['rimsizeId'] = rimsizeId;// widthRear = sizeCookie['searchedRearWidth'];// rearwidthId = sizeCookie['searchedRearWidthId'];// heightRear = sizeCookie['searchedRearHeight'];// rearheightId = sizeCookie['searchedRearHeightId'];// rimsizeRear = sizeCookie['searchedRearRimSize'];// rearrimsizeId = sizeCookie['searchedRearRimSizeId'];// if(typeof sizeCookies['searchedRearHeigthId'] !== 'undefined') {// sizeCookies['searchedRearHeigthId'] = rearheightId;// }else{// sizeCookies['searchedRearHeigthId'] = rearheightId;// }// }// if((width !=null && width !='') && (height !=null && height !='') && (rimsize !=null && rimsize !='')){// $('a#filter-'+1+'').text(width);// $('#widthvalue').val(widthId);// $('a#filter-'+2+'').text(height);// $('#heightvalue').val(heightId);// $('a#filter-'+2+'').removeAttr('disabled');// $('a#filter-'+2+'').removeClass('disabled');// $('a#filter-'+3+'').text(rimsize);// $('#rim_sizevalue').val(rimsizeId);// $('a#filter-'+3+'').removeAttr('disabled');// $('a#filter-'+3+'').removeClass('disabled');// $('#cityInput').css({'background-color':''});// $('#submitButton').removeAttr('disabled');// var loc = $.parseJSON($.mage.cookies.get('fme_customer_data'));// if(typeof loc['location'] !== 'undefined') {// var location = loc['location'];// }else{// var location = loc['location'];// }// if(location !=null){// $('#cityInput').css({'background-color':''});// $('#cityInput').val(location);// }// }// $('#find-1').removeAttr('disabled');// $('#find-2').removeAttr('disabled');// if((widthRear !=null && widthRear !='') && (heightRear !=null && heightRear !='') && (rimsizeRear !=null && rimsizeRear !='')){// $('a#rearfilter-'+1+'').text(widthRear);// $('#widthrearvalue').val(rearwidthId);// $('a#rearfilter-'+2+'').text(heightRear);// $('#heightrearvalue').val(rearheightId);// $('a#rearfilter-'+2+'').removeAttr('disabled');// $('a#rearfilter-'+2+'').removeClass('disabled');// $('a#rearfilter-'+3+'').text(rimsizeRear);// $('#rim_sizerearvalue').val(rearrimsizeId);// $('a#rearfilter-'+3+'').removeAttr('disabled');// $('a#rearfilter-'+3+'').removeClass('disabled');// var loc = $.parseJSON($.mage.cookies.get('fme_customer_data'));// if(typeof loc['location'] !== 'undefined') {// var location = loc['location'];// }else{// var location = loc['location'];// }// if(location !=null){// $('#cityInput').css({'background-color':''});// $('#cityInput').val(location);// }// $('#find-1').removeAttr('disabled');// }// $('#rim_size').prop("disabled",true);// });$(document).on('click','a#rear_show',function(){ if($('.rear_tyres').is(":hidden")){ $('a#rear_show').addClass('active'); } if($('.rear_tyres').is(":visible")){ $('a#rear_show').removeClass('active'); } $('.rear_tyres').toggle('slow');});$(document).on('click','a#select_different_rear',function(){ if(sizeCookies['click'] == null || sizeCookies['click'] == 0){ sizeCookies['click'] = 1; } else{ sizeCookies['click'] = 0; } var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } if($('#searchbysize-popup').find('.reartyre').children('.rear_tyres_hidden').length !=0 ){ $('#searchbysize-popup').find('.reartyre').children('.rear_tyres_hidden').toggle(); $('#select_different_rear').toggleClass('active'); } if($('#searchbysize-popup').find(".rear_tyres_hidden").length == 0){ if($('#searchbysize-popup').find('.reartyre').children('.rear_tyres_hidden').length == 0){ $(".rear_tyres_hidden").clone(true,true).appendTo(".reartyre").css({'display':'block','overflow':'visible','opacity':1}); $('#select_different_rear').addClass('active'); } }});// $(document).on('change','#cityI',function(){ // var location = $('#cityI').val();// $('#cityInput').val(location);// if(location!=null){// var loc = $.parseJSON($.mage.cookies.get('fme_customer_data'));// if(typeof loc['location'] !== 'undefined') {// loc['location'] = $.trim(location);// }else{// loc['location'] = $.trim(location);// }// var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]);// var locCity = locCitys.split(',');// var tru = 0; // $.each(locCity, function(i,val) {// var newArray = val.split('=>');// var locf = $.trim(location).toLowerCase();// var locD = newArray[0].toLowerCase();// locD = locD.replace(/^"|"$/g, '');// if(locf.includes(locD) == true){// tru=1;// loc['locationCity'] = newArray[1];// }// }); // if(tru==0){// loc['locationCity'] = null;// } // setcookie("fme_customer_data", JSON.stringify(loc));// updateCartTotals();// }// }); //on click selected width $("#filter-1").on('click',function(){ if(cityI == ''){ cityI = $('#cityI').detach(); } if(cityRearInput == ''){ cityRearInput = $('#cityRearInput').detach(); } addWidthClass(); clearHeader(); showWidthPopUp(); $("#searchbysize-popup").modal("openModal"); $('div.search_by_size').removeClass('rearsizeactive'); }); //on click selected height $('#filter-2').on('click',function(){ if($(this).attr('disabled') == null){ if(cityI == ''){ cityI = $('#cityI').detach(); } if(cityRearInput == ''){ cityRearInput = $('#cityRearInput').detach(); } addHeightClass(); clearHeader(); $(".search_by").find('.search_by_size').empty(); heightPopUpImages(); var id = $(this).attr('id'); var size = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(typeof size['height'] !== 'undefined') { var heights= size['height']; }else{ var heights= size['height']; } $("

      ").insertAfter($('.search_by_size').find('.top_section')); $('.fmeproductfinder-select').append('

        '); if(temporaryHeight != null){ temporaryHeights = $.parseJSON(temporaryHeight); $.each(temporaryHeights, function(i,val) { $('.fmeproductfinder-select').find('ul.value_no').append("

      • "); }); }else{ var height = $.parseJSON(heights); if(height !=null){ $.each(height, function(i,val) { $('.fmeproductfinder-select').find('ul.value_no').append("

      • "); }); }else{ $(this).parent('.fmeproductfinder-filter-titles').next('.fmeproductfinder-filter-content').children('.fmeproductfinder-hidden').clone(true,true).appendTo('.fmeproductfinder-select').css({'display':'block'}); } } $("#searchbysize-popup").modal("openModal"); $(".search_by").find('.modal-header').prepend(''); $("

        Current Selection : "+sizeCookies['widthValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); $('').insertAfter($(".search_by").find('.current_selection')); $('div.search_by_size').removeClass('rearsizeactive'); } }); //on click selected rim_size $('#filter-3').on('click',function(){ if($(this).attr('disabled') == null){ if(cityI == ''){ cityI = $('#cityI').detach(); } if(cityRearInput == ''){ cityRearInput = $('#cityRearInput').detach(); } addRimSizeClass(); clearHeader(); var id = $(this).attr('id'); var size = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(typeof size['rim_size'] !== 'undefined') { var rimsize= size['rim_size']; }else{ var rimsize= size['rim_size']; } var rim_size = $.parseJSON(rimsize); $(".search_by").find('.search_by_size').empty(); rimsizePopUpImages(); frontPopupAppend(); if(temporaryRimSize != null){ temporaryRimSizes = $.parseJSON(temporaryRimSize); $.each(temporaryRimSizes, function(i,val) { $('.fmeproductfinder-select').find('ul.value_no').append("

      • "); }); }else{ if(rim_size !=null){ rimsizeArray(rim_size); }else{ $(this).parent('.fmeproductfinder-filter-titles').next('.fmeproductfinder-filter-content').children('.fmeproductfinder-hidden').clone(true,true).appendTo('.fmeproductfinder-select').css({'display':'block'}); } } $("#searchbysize-popup").modal("openModal"); backToHeight(); $("

        Current Selection :"+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); $('').insertAfter($(".search_by").find('.current_selection')); $('div.search_by_size').removeClass('rearsizeactive'); } }); //on click selected rear_width $("#rearfilter-1").on('click',function(){ if(cityI == ''){ cityI = $('#cityI').detach(); } if(cityRearInput == ''){ cityRearInput = $('#cityRearInput').detach(); } $('#searchbysize-popup').parents('.search_by').addClass('rearwidth_popup'); $('#searchbysize-popup').parents('.search_by').removeClass('rearheight_popup'); $('#searchbysize-popup').parents('.search_by').removeClass('rearrimsize_popup'); rearFilter1(); $(".search_by").find('.modal-header').find('.rearprevious').remove(); $('').insertAfter($(".search_by").find('.current_selection')); $('div.search_by_size').addClass('rearsizeactive'); }); $("#rearhiddenfilter-1").on('click',function(){ $('#searchbysize-popup').parents('.search_by').addClass('rearwidth_popup'); $('#searchbysize-popup').parents('.search_by').removeClass('rearheight_popup'); $('#searchbysize-popup').parents('.search_by').removeClass('rearrimsize_popup'); $(".search_by").find('.modal-header').find('.rearprevious').remove(); rearFilter1(); $('').insertAfter($(".search_by").find('.current_selection')); $('div.search_by_size').addClass('rearsizeactive'); }); //on click selected rear_height $('#rearfilter-2').on('click',function(){ if($(this).attr('disabled') == null){ if(cityI == ''){ cityI = $('#cityI').detach(); } if(cityRearInput == ''){ cityRearInput = $('#cityRearInput').detach(); } clearHeader(); addRearheightClass(); var id = $(this).attr('id'); var size = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(typeof size['rear_height'] !== 'undefined') { var rear_height= size['rear_height']; }else{ var rear_height= size['rear_height']; } var height = $.parseJSON(rear_height); $(".search_by").find('.search_by_size').empty(); rearheightPopUpImages(); rearPopupAppend(); if(temporaryRearHeight !=null){ var height = $.parseJSON(temporaryRearHeight); $.each(height, function(i,val) { $('.fmeproductfinder-selects').find('ul.value_no').append("

      • "); }); }else{ $.each(height, function(i,val) { $('.fmeproductfinder-selects').find('ul.value_no').append("

      • "); }); } $('#searchbysize-popup').modal("openModal"); backToRearWidth(); var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+" R"+frontrimsize+"

        ").insertAfter($(".search_by").find('.tyre_model')); rearWidthValue(); } else{ noFrontSize(); rearWidthValue(); } $('').insertAfter($(".search_by").find('.current_selection')); $('div.search_by_size').addClass('rearsizeactive');}}); //on click selected rear_rim_size $('#rearfilter-3').on('click',function(){ if($(this).attr('disabled') == null){ if(cityI == ''){ cityI = $('#cityI').detach(); } if(cityRearInput == ''){ cityRearInput = $('#cityRearInput').detach(); } addRearRimsizeClass(); clearHeader(); $(".search_by").find('.modal-header').find('.rearpreviouslocation').remove(); $(".search_by").find('.modal-header').find('.rearprevious').remove(); var id = $(this).attr('id'); var size = $.parseJSON($.mage.cookies.get('fme_sizes_data')); if(typeof size['rear_rim_size'] !== 'undefined') { var rear_rim_size= size['rear_rim_size']; }else{ var rear_rim_size= size['rear_rim_size']; } var rim_size = $.parseJSON(rear_rim_size); $(".search_by").find('.search_by_size').empty(); rearrimsizePopUpImages(); rearPopupAppend(); if(temporaryRearRimSize !=null){ var rim_size = $.parseJSON(temporaryRearRimSize); $.each(rim_size, function(i,val) { $('.fmeproductfinder-selects').find('ul.value_no').append("

      • "); }); } else{ $.each(rim_size, function(i,val) { $('.fmeproductfinder-selects').find('ul.value_no').append("

      • "); }); } $('#searchbysize-popup').modal("openModal"); backTorearHeight(); var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+ " R"+frontrimsize+"

        Rear Tyre Selection : "+sizeCookies['rearwidthValue']+" / "+sizeCookies['rearheightValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); } else{ $("

        Front Tyre Selection : Width / Height RRimsize
        Rear Tyre Selection : "+sizeCookies['rearwidthValue']+" / "+sizeCookies['rearheightValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); } $('').insertAfter($(".search_by").find('.current_selection')); $('div.search_by_size').addClass('rearsizeactive'); } }); $("#filter-1").change(function() { // for dynamic changes in filter var filter_id = {}; var chnagefilterid = $(this).attr('id'); var chnagefilterid = chnagefilterid.split("-"); var chnagefilterid = parseInt(chnagefilterid['1']); $("#form-1").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('id'); var loopid = loopid.split("-"); var loopid= parseInt(loopid['1']); if( (chnagefilterid > loopid) || (chnagefilterid == loopid) ) { filter_id[''+$(this).attr('id')+''] = $(this).val(); } }); $.ajax({ method: "POST", showLoader: true, url: "https://www.pitstoparabia.com/en/productpartsfinder/partsfinder/testindex/", data: { productpartsfinder_id:'1', filter_option_ids:filter_id, chnagefilterid:chnagefilterid }, success: function (data) { $("#form-"+data.productpartsfinder_id+"").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('id'); loopid = loopid.split("-"); loopid=loopid['1']; if(data.chnagefilterid

        Please Select"); $.each(data.optionvalues, function(i,val) { $('#filter-'+data.chnagefilterid+'').append(""); }); }, error: function (error) { } });}); count=''; $(document).on('click','input.sizeFront',function(evt){ evt.stopImmediatePropagation(); count = 0; var filter_id = {}; var chnagefilterid = $(this).attr('data-option-id'); var chnagefilterid = chnagefilterid.split("-"); var chnagefilterid = parseInt(chnagefilterid['1']); var optionValue = $(this).val(); var labelText = $(this).next('label').text(); var fieldName = $(this).attr('name'); var loopid = $(this).attr('data-option-id'); var loopid = loopid.split("-"); var loopid= parseInt(loopid['1']); if(fieldName != 'height'){ if( (chnagefilterid > loopid) || (chnagefilterid == loopid) ) { filter_id[''+$(this).attr('data-option-id')+''] = $(this).val(); } } if(fieldName == 'height'){ filter_id['filter-1'] = sizeCookies['widthId']; filter_id['filter-2'] = $(this).val(); } if(count == 0){ $.ajax({ method: "POST", showLoader: true, url: "https://www.pitstoparabia.com/en/productpartsfinder/partsfinder/testindex/", data: { productpartsfinder_id:'1', filter_option_ids:filter_id, chnagefilterid:chnagefilterid }, success: function (data) { $('#find-1').removeAttr('disabled'); if(count==0){ $('#search_size').addClass('no_value'); $('#searchbysize-popup').empty(); $("#form-"+data.productpartsfinder_id+"").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('data-option-id'); loopid = loopid.split("-"); loopid=loopid['1']; if(data.chnagefilteridHeight'); $('a#filter-'+2+'').addClass('disabled'); $('a#filter-'+2+'').find('button').attr('disabled',true); } if($('a#filter-'+3+'').children('button').length==0){ $('a#filter-'+3+'').text(''); $('a#filter-'+3+'').append(''); $('a#filter-'+3+'').addClass('disabled'); $('a#filter-'+3+'').addClass('toSelect'); $('a#filter-'+3+'').find('button').attr('disabled',true); } if($('a#filter-'+1+'').children('button').length!=0 && $('a#filter-'+2+'').children('button').length!=0 && $('a#filter-'+3+'').children('button').length!=0 ){ } $("

        Current Selection : "+optionText+"

        ").insertAfter($(".search_by").find('.tyre_model')); } if(fieldName == hei){ if(typeof sizeCookies['heightId'] !== 'undefined') { sizeCookies['heightId'] = $.trim(id); }else{ sizeCookies['heightId'] = $.trim(id); } $('select#filter-2').val(id); $('select#filter-2').attr('disabled',false); $('select#filter-3').attr('disabled',true); $('select#height').val(id); if($('a#filter-'+3+'').children('button').length==0){ $('a#filter-'+3+'').text(''); $('a#filter-'+3+'').append(''); } if(typeof sizeCookies['heightValue'] !== 'undefined') { sizeCookies['heightValue'] = $.trim(optionText); }else{ sizeCookies['heightValue'] = $.trim(optionText); } } if(cookieField == hei){ heightPopUpImages(); var height = data.optionvalues; temporaryHeight = JSON.stringify(height); $("

        Current Selection : "+sizeCookies['widthValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); $('').insertAfter($(".search_by").find('.current_selection')); } if(fieldName == rs){ if(typeof sizeCookies['rimsizeId'] !== 'undefined') { sizeCookies['rimsizeId'] = $.trim(id); }else{ sizeCookies['rimsizeId'] = $.trim(id); } $('select#filter-3').val(id); $('select#filter-3').attr('disabled',false); $('select#rim_size').val(id); if(typeof sizeCookies['rimsizeValue'] !== 'undefined') { sizeCookies['rimsizeValue'] = $.trim(optionText); }else{ sizeCookies['rimsizeValue'] = $.trim(optionText); } } if(cookieField== rs){ rimsizePopUpImages(); var rim_size = data.optionvalues; temporaryRimSize = JSON.stringify(rim_size); $("

        Current Selection : "+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); $('').insertAfter($(".search_by").find('.current_selection')); } var button=''; if(fieldName == wid){ button = 'Width'; } else if(fieldName ==hei){ button = 'Height'; } else if(fieldName == rs){ button = 'Rim Size'; } frontPopupAppend(); clearHeader(); $(".search_by").find('.modal-header').prepend(''); $.each(data.optionvalues, function(i,val) { if(data.chnagefilterid == 2){ addHeightClass(); $('.fmeproductfinder-select').find('ul.value_no').append("
      • "); } if(data.chnagefilterid == 3){ addRimSizeClass(); $('.fmeproductfinder-select').find('ul.value_no').append("
      • "); } }); if(data.optionvalues.length==0){ $('#search_size').removeClass('no_value'); addLocationClass(); locationPopUpImages(); if($('.rear_tyres').is(":hidden")){ var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } $('.search_by_size').find('.top_section').append(''); $('.search_by_size').find('.location_block').append('

        Add a different rear tyre size?

        '); if(sizeCookies['click']==0 || sizeCookies['click']==null ){ $(".rear_tyres_hidden").clone(true,true).appendTo(".reartyre").css({'display':'block','overflow':'visible','opacity':1}).toggle(); }else{ $(".rear_tyres_hidden").clone(true,true).appendTo(".reartyre").css({'display':'block','overflow':'visible','opacity':1}); } $('.reartyre').append('

        Enter Your Location(Required) span>

        Locate me

        ').append("

        "); $(cityI).appendTo('.loc').attr('type','text'); $('#searchbysize-popup').find("#cityI").prop('required',true); $('#cityI').prop('disabled',false); if(location != null || location !=''){ $('#searchbysize-popup').find('#cityI').val(location); } } if($('.fmeproductfinder-block').find('.rear_tyres').css('display') =='none'){ $("

        Current Selection : "+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+ " R"+optionText+"

        ").insertAfter($(".search_by").find('.tyre_model')); }else{ $('.rearprevious').remove(); $('.previous').remove(); $("

        Front Tyre Selection : "+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+ " R"+optionText+"

        Rear Tyre Selection :

        ").insertAfter($(".search_by").find('.tyre_model')); backTolocation(); toRearWidth(); } $('div.search_by_size').addClass('rearsizeactive'); } count =1; } }, error: function (error) { } });}});click ='';$(document).on('click','input.rearSize',function(evt){ evt.stopImmediatePropagation(); click = 0; var filter_id = {}; var chnagefilterid = $(this).attr('data-option-id'); var chnagefilterid = chnagefilterid.split("-"); var chnagefilterid = parseInt(chnagefilterid['1']); var labelText = $(this).next('label').text(); var optionValue = $(this).val(); var fieldName = $(this).attr('name'); fieldName = fieldName.replace('second',''); fieldName = fieldName.replace('sechide',''); var loopid = $(this).attr('data-option-id'); var loopid = loopid.split("-"); var loopid= parseInt(loopid['1']); if(fieldName != 'height'){ if( (chnagefilterid > loopid) || (chnagefilterid == loopid) ) { filter_id[''+$(this).attr('data-option-id')+''] = $(this).val(); } } if(fieldName == 'height'){ filter_id['filter-1'] = sizeCookies['rearwidthId']; filter_id['filter-2'] = $(this).val(); } if(click == 0){ $.ajax({ method: "POST", showLoader: true, url: "https://www.pitstoparabia.com/en/productpartsfinder/partsfinder/testindex/", data: { productpartsfinder_id:'1', filter_option_ids:filter_id, chnagefilterid:chnagefilterid }, success: function (data) { $('#find-1').removeAttr('disabled'); if(click == 0){ $(".search_by").find('.search_by_size').empty(); $("#form-"+data.productpartsfinder_id+"").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('data-option-id'); loopid = loopid.split("-"); loopid=loopid['1']; if(data.chnagefilterid

        Height'); $('a#rearfilter-'+2+'').addClass('disabled'); $('a#rearfilter-'+2+'').addClass('toSelect'); $('a#rearfilter-'+2+'').find('button').attr('disabled',true); } if($('a#rearfilter-'+3+'').children('button').length==0){ $('a#rearfilter-'+3+'').text(''); $('a#rearfilter-'+3+'').append(''); $('a#rearfilter-'+3+'').addClass('disabled'); $('a#rearfilter-'+3+'').addClass('toSelect'); $('a#rearfilter-'+3+'').find('button').attr('disabled',true); } } else if(fieldName == 'rear_'+hei){ if(typeof sizeCookies['rearheightValue'] !== 'undefined') { sizeCookies['rearheightValue'] = $.trim(optionText); }else{ sizeCookies['rearheightValue'] = $.trim(optionText); } if(typeof sizeCookies['searchedRearHeigthId'] !== 'undefined') { sizeCookies['searchedRearHeigthId'] = id; }else{ sizeCookies['searchedRearHeigthId'] = id; } if($('.rear').find('a#rearfilter'+3+'').children('button').length==0){ $('a#rearfilter-'+3+'').text(''); $('a#rearfilter-'+3+'').append(''); $('a#rearfilter-'+3+'').find('button').attr('disabled',true); } } else if(fieldName == 'rear_'+rs){ if(typeof sizeCookies['rearrimsizeValue'] !== 'undefined') { sizeCookies['rearrimsizeValue'] = $.trim(optionText); }else{ sizeCookies['rearrimsizeValue'] = $.trim(optionText); } } if(cookieFielName=='2'){ var cookieField = 'rear_'+hei; var height = data.optionvalues; temporaryRearHeight = JSON.stringify(height); rearheightPopUpImages(); rearPopupAppend(); var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+ " R"+frontrimsize+"

        Rear Tyre Selection : "+sizeCookies['rearwidthValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); } else{ noFrontSize(); $('.current_selection').append("

        Rear Tyre Selection : "+sizeCookies['rearwidthValue']+"

        "); } $('').insertAfter($(".search_by").find('.current_selection')); } if(cookieFielName=='3'){ var rim_size = data.optionvalues; temporaryRearRimSize = JSON.stringify(rim_size); rearrimsizePopUpImages(); rearPopupAppend(); var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; var rearwidth = sizeCookies['rearwidthValue']; var rearheight = sizeCookies['rearheightValue']; var rearrimsize = sizeCookies['rearrimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+" R"+frontrimsize+"

        Rear Tyre Selection :"+rearwidth+" / "+rearheight+"

        ").insertAfter($(".search_by").find('.tyre_model')); }else{ noFrontSize(); $('.current_selection').append("

        Rear Tyre Selection : "+rearwidth+" / "+rearheight+"

        "); } $('').insertAfter($(".search_by").find('.current_selection')); } clearHeader(); var button=''; if(fieldName == wid){ button = 'Width'; } else if(fieldName == 'rear_'+hei){ button = 'Height'; } else if(fieldName == 'rear_'+rs){ button = 'Rim Size'; } $(".search_by").find('.modal-header').prepend(''); $.each(data.optionvalues, function(i,val) { if(data.chnagefilterid == 2){ addRearheightClass(); $('.fmeproductfinder-selects').find('ul.value_no').append("
      • "); $('div.search_by_size').addClass('rearsizeactive'); } if(data.chnagefilterid == 3){ addRearRimsizeClass(); $('.fmeproductfinder-selects').find('ul.value_no').append("
      • "); $('div.search_by_size').addClass('rearsizeactive'); } }); if(data.optionvalues.length == 0){ addLocationClass(); locationPopUpImages(); if($('.rear_tyre').length == 0){ var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; var rearwidth = sizeCookies['rearwidthValue']; var rearheight = sizeCookies['rearheightValue']; var rearrimsize = sizeCookies['rearrimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+ " R"+frontrimsize+"

        Rear Tyre Selection :"+rearwidth+" / "+rearheight+" R"+rearrimsize+"

        ").insertAfter($(".search_by").find('.tyre_model')); } else{ noFrontSize(); $('.current_selection').append("

        Rear Tyre Selection : "+rearwidth+" / "+rearheight+" R"+rearrimsize+"

        "); } var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } $('.search_by_size').find('.top_section').append(''); $('.search_by_size').find('.location_block').append('').append('

        Enter Your Location(Required)

        Locate me

        ').append("

        "); $(cityRearInput).appendTo('.loc').attr('type','text'); $('#searchbysize-popup').find("#cityRearInput").prop('required',true); if(location !=null){ $('#searchbysize-popup').find('#cityRearInput').val(location); } $('#cityI').prop('disabled',false); } $('.rear_tyres').css({'display':'block'}); $('div.search_by_size').addClass('rearsizeactive'); } click =1; } }, error: function (error) { } });}}); $("#filter-2").change(function() { // for dynamic changes in filter var filter_id = {}; var chnagefilterid = $(this).attr('id'); var chnagefilterid = chnagefilterid.split("-"); var chnagefilterid = parseInt(chnagefilterid['1']); $("#form-1").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('id'); var loopid = loopid.split("-"); var loopid= parseInt(loopid['1']); if( (chnagefilterid > loopid) || (chnagefilterid == loopid) ) { filter_id[''+$(this).attr('id')+''] = $(this).val(); } }); $.ajax({ method: "POST", showLoader: true, url: "https://www.pitstoparabia.com/en/productpartsfinder/partsfinder/testindex/", data: { productpartsfinder_id:'1', filter_option_ids:filter_id, chnagefilterid:chnagefilterid }, success: function (data) { $("#form-"+data.productpartsfinder_id+"").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('id'); loopid = loopid.split("-"); loopid=loopid['1']; if(data.chnagefilterid

        Please Select"); $.each(data.optionvalues, function(i,val) { $('#filter-'+data.chnagefilterid+'').append(""); }); }, error: function (error) { } });}); count=''; $(document).on('click','input.sizeFront',function(evt){ evt.stopImmediatePropagation(); count = 0; var filter_id = {}; var chnagefilterid = $(this).attr('data-option-id'); var chnagefilterid = chnagefilterid.split("-"); var chnagefilterid = parseInt(chnagefilterid['1']); var optionValue = $(this).val(); var labelText = $(this).next('label').text(); var fieldName = $(this).attr('name'); var loopid = $(this).attr('data-option-id'); var loopid = loopid.split("-"); var loopid= parseInt(loopid['1']); if(fieldName != 'height'){ if( (chnagefilterid > loopid) || (chnagefilterid == loopid) ) { filter_id[''+$(this).attr('data-option-id')+''] = $(this).val(); } } if(fieldName == 'height'){ filter_id['filter-1'] = sizeCookies['widthId']; filter_id['filter-2'] = $(this).val(); } if(count == 0){ $.ajax({ method: "POST", showLoader: true, url: "https://www.pitstoparabia.com/en/productpartsfinder/partsfinder/testindex/", data: { productpartsfinder_id:'1', filter_option_ids:filter_id, chnagefilterid:chnagefilterid }, success: function (data) { $('#find-1').removeAttr('disabled'); if(count==0){ $('#search_size').addClass('no_value'); $('#searchbysize-popup').empty(); $("#form-"+data.productpartsfinder_id+"").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('data-option-id'); loopid = loopid.split("-"); loopid=loopid['1']; if(data.chnagefilteridHeight'); $('a#filter-'+2+'').addClass('disabled'); $('a#filter-'+2+'').find('button').attr('disabled',true); } if($('a#filter-'+3+'').children('button').length==0){ $('a#filter-'+3+'').text(''); $('a#filter-'+3+'').append(''); $('a#filter-'+3+'').addClass('disabled'); $('a#filter-'+3+'').addClass('toSelect'); $('a#filter-'+3+'').find('button').attr('disabled',true); } if($('a#filter-'+1+'').children('button').length!=0 && $('a#filter-'+2+'').children('button').length!=0 && $('a#filter-'+3+'').children('button').length!=0 ){ } $("

        Current Selection : "+optionText+"

        ").insertAfter($(".search_by").find('.tyre_model')); } if(fieldName == hei){ if(typeof sizeCookies['heightId'] !== 'undefined') { sizeCookies['heightId'] = $.trim(id); }else{ sizeCookies['heightId'] = $.trim(id); } $('select#filter-2').val(id); $('select#filter-2').attr('disabled',false); $('select#filter-3').attr('disabled',true); $('select#height').val(id); if($('a#filter-'+3+'').children('button').length==0){ $('a#filter-'+3+'').text(''); $('a#filter-'+3+'').append(''); } if(typeof sizeCookies['heightValue'] !== 'undefined') { sizeCookies['heightValue'] = $.trim(optionText); }else{ sizeCookies['heightValue'] = $.trim(optionText); } } if(cookieField == hei){ heightPopUpImages(); var height = data.optionvalues; temporaryHeight = JSON.stringify(height); $("

        Current Selection : "+sizeCookies['widthValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); $('').insertAfter($(".search_by").find('.current_selection')); } if(fieldName == rs){ if(typeof sizeCookies['rimsizeId'] !== 'undefined') { sizeCookies['rimsizeId'] = $.trim(id); }else{ sizeCookies['rimsizeId'] = $.trim(id); } $('select#filter-3').val(id); $('select#filter-3').attr('disabled',false); $('select#rim_size').val(id); if(typeof sizeCookies['rimsizeValue'] !== 'undefined') { sizeCookies['rimsizeValue'] = $.trim(optionText); }else{ sizeCookies['rimsizeValue'] = $.trim(optionText); } } if(cookieField== rs){ rimsizePopUpImages(); var rim_size = data.optionvalues; temporaryRimSize = JSON.stringify(rim_size); $("

        Current Selection : "+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); $('').insertAfter($(".search_by").find('.current_selection')); } var button=''; if(fieldName == wid){ button = 'Width'; } else if(fieldName ==hei){ button = 'Height'; } else if(fieldName == rs){ button = 'Rim Size'; } frontPopupAppend(); clearHeader(); $(".search_by").find('.modal-header').prepend(''); $.each(data.optionvalues, function(i,val) { if(data.chnagefilterid == 2){ addHeightClass(); $('.fmeproductfinder-select').find('ul.value_no').append("
      • "); } if(data.chnagefilterid == 3){ addRimSizeClass(); $('.fmeproductfinder-select').find('ul.value_no').append("
      • "); } }); if(data.optionvalues.length==0){ $('#search_size').removeClass('no_value'); addLocationClass(); locationPopUpImages(); if($('.rear_tyres').is(":hidden")){ var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } $('.search_by_size').find('.top_section').append(''); $('.search_by_size').find('.location_block').append('

        Add a different rear tyre size?

        '); if(sizeCookies['click']==0 || sizeCookies['click']==null ){ $(".rear_tyres_hidden").clone(true,true).appendTo(".reartyre").css({'display':'block','overflow':'visible','opacity':1}).toggle(); }else{ $(".rear_tyres_hidden").clone(true,true).appendTo(".reartyre").css({'display':'block','overflow':'visible','opacity':1}); } $('.reartyre').append('

        Enter Your Location(Required) span>

        Locate me

        ').append("

        "); $(cityI).appendTo('.loc').attr('type','text'); $('#searchbysize-popup').find("#cityI").prop('required',true); $('#cityI').prop('disabled',false); if(location != null || location !=''){ $('#searchbysize-popup').find('#cityI').val(location); } } if($('.fmeproductfinder-block').find('.rear_tyres').css('display') =='none'){ $("

        Current Selection : "+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+ " R"+optionText+"

        ").insertAfter($(".search_by").find('.tyre_model')); }else{ $('.rearprevious').remove(); $('.previous').remove(); $("

        Front Tyre Selection : "+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+ " R"+optionText+"

        Rear Tyre Selection :

        ").insertAfter($(".search_by").find('.tyre_model')); backTolocation(); toRearWidth(); } $('div.search_by_size').addClass('rearsizeactive'); } count =1; } }, error: function (error) { } });}});click ='';$(document).on('click','input.rearSize',function(evt){ evt.stopImmediatePropagation(); click = 0; var filter_id = {}; var chnagefilterid = $(this).attr('data-option-id'); var chnagefilterid = chnagefilterid.split("-"); var chnagefilterid = parseInt(chnagefilterid['1']); var labelText = $(this).next('label').text(); var optionValue = $(this).val(); var fieldName = $(this).attr('name'); fieldName = fieldName.replace('second',''); fieldName = fieldName.replace('sechide',''); var loopid = $(this).attr('data-option-id'); var loopid = loopid.split("-"); var loopid= parseInt(loopid['1']); if(fieldName != 'height'){ if( (chnagefilterid > loopid) || (chnagefilterid == loopid) ) { filter_id[''+$(this).attr('data-option-id')+''] = $(this).val(); } } if(fieldName == 'height'){ filter_id['filter-1'] = sizeCookies['rearwidthId']; filter_id['filter-2'] = $(this).val(); } if(click == 0){ $.ajax({ method: "POST", showLoader: true, url: "https://www.pitstoparabia.com/en/productpartsfinder/partsfinder/testindex/", data: { productpartsfinder_id:'1', filter_option_ids:filter_id, chnagefilterid:chnagefilterid }, success: function (data) { $('#find-1').removeAttr('disabled'); if(click == 0){ $(".search_by").find('.search_by_size').empty(); $("#form-"+data.productpartsfinder_id+"").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('data-option-id'); loopid = loopid.split("-"); loopid=loopid['1']; if(data.chnagefilterid

        Height'); $('a#rearfilter-'+2+'').addClass('disabled'); $('a#rearfilter-'+2+'').addClass('toSelect'); $('a#rearfilter-'+2+'').find('button').attr('disabled',true); } if($('a#rearfilter-'+3+'').children('button').length==0){ $('a#rearfilter-'+3+'').text(''); $('a#rearfilter-'+3+'').append(''); $('a#rearfilter-'+3+'').addClass('disabled'); $('a#rearfilter-'+3+'').addClass('toSelect'); $('a#rearfilter-'+3+'').find('button').attr('disabled',true); } } else if(fieldName == 'rear_'+hei){ if(typeof sizeCookies['rearheightValue'] !== 'undefined') { sizeCookies['rearheightValue'] = $.trim(optionText); }else{ sizeCookies['rearheightValue'] = $.trim(optionText); } if(typeof sizeCookies['searchedRearHeigthId'] !== 'undefined') { sizeCookies['searchedRearHeigthId'] = id; }else{ sizeCookies['searchedRearHeigthId'] = id; } if($('.rear').find('a#rearfilter'+3+'').children('button').length==0){ $('a#rearfilter-'+3+'').text(''); $('a#rearfilter-'+3+'').append(''); $('a#rearfilter-'+3+'').find('button').attr('disabled',true); } } else if(fieldName == 'rear_'+rs){ if(typeof sizeCookies['rearrimsizeValue'] !== 'undefined') { sizeCookies['rearrimsizeValue'] = $.trim(optionText); }else{ sizeCookies['rearrimsizeValue'] = $.trim(optionText); } } if(cookieFielName=='2'){ var cookieField = 'rear_'+hei; var height = data.optionvalues; temporaryRearHeight = JSON.stringify(height); rearheightPopUpImages(); rearPopupAppend(); var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+ " R"+frontrimsize+"

        Rear Tyre Selection : "+sizeCookies['rearwidthValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); } else{ noFrontSize(); $('.current_selection').append("

        Rear Tyre Selection : "+sizeCookies['rearwidthValue']+"

        "); } $('').insertAfter($(".search_by").find('.current_selection')); } if(cookieFielName=='3'){ var rim_size = data.optionvalues; temporaryRearRimSize = JSON.stringify(rim_size); rearrimsizePopUpImages(); rearPopupAppend(); var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; var rearwidth = sizeCookies['rearwidthValue']; var rearheight = sizeCookies['rearheightValue']; var rearrimsize = sizeCookies['rearrimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+" R"+frontrimsize+"

        Rear Tyre Selection :"+rearwidth+" / "+rearheight+"

        ").insertAfter($(".search_by").find('.tyre_model')); }else{ noFrontSize(); $('.current_selection').append("

        Rear Tyre Selection : "+rearwidth+" / "+rearheight+"

        "); } $('').insertAfter($(".search_by").find('.current_selection')); } clearHeader(); var button=''; if(fieldName == wid){ button = 'Width'; } else if(fieldName == 'rear_'+hei){ button = 'Height'; } else if(fieldName == 'rear_'+rs){ button = 'Rim Size'; } $(".search_by").find('.modal-header').prepend(''); $.each(data.optionvalues, function(i,val) { if(data.chnagefilterid == 2){ addRearheightClass(); $('.fmeproductfinder-selects').find('ul.value_no').append("
      • "); $('div.search_by_size').addClass('rearsizeactive'); } if(data.chnagefilterid == 3){ addRearRimsizeClass(); $('.fmeproductfinder-selects').find('ul.value_no').append("
      • "); $('div.search_by_size').addClass('rearsizeactive'); } }); if(data.optionvalues.length == 0){ addLocationClass(); locationPopUpImages(); if($('.rear_tyre').length == 0){ var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; var rearwidth = sizeCookies['rearwidthValue']; var rearheight = sizeCookies['rearheightValue']; var rearrimsize = sizeCookies['rearrimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+ " R"+frontrimsize+"

        Rear Tyre Selection :"+rearwidth+" / "+rearheight+" R"+rearrimsize+"

        ").insertAfter($(".search_by").find('.tyre_model')); } else{ noFrontSize(); $('.current_selection').append("

        Rear Tyre Selection : "+rearwidth+" / "+rearheight+" R"+rearrimsize+"

        "); } var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } $('.search_by_size').find('.top_section').append(''); $('.search_by_size').find('.location_block').append('').append('

        Enter Your Location(Required)

        Locate me

        ').append("

        "); $(cityRearInput).appendTo('.loc').attr('type','text'); $('#searchbysize-popup').find("#cityRearInput").prop('required',true); if(location !=null){ $('#searchbysize-popup').find('#cityRearInput').val(location); } $('#cityI').prop('disabled',false); } $('.rear_tyres').css({'display':'block'}); $('div.search_by_size').addClass('rearsizeactive'); } click =1; } }, error: function (error) { } });}}); $("#filter-3").change(function() { // for dynamic changes in filter var filter_id = {}; var chnagefilterid = $(this).attr('id'); var chnagefilterid = chnagefilterid.split("-"); var chnagefilterid = parseInt(chnagefilterid['1']); $("#form-1").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('id'); var loopid = loopid.split("-"); var loopid= parseInt(loopid['1']); if( (chnagefilterid > loopid) || (chnagefilterid == loopid) ) { filter_id[''+$(this).attr('id')+''] = $(this).val(); } }); $.ajax({ method: "POST", showLoader: true, url: "https://www.pitstoparabia.com/en/productpartsfinder/partsfinder/testindex/", data: { productpartsfinder_id:'1', filter_option_ids:filter_id, chnagefilterid:chnagefilterid }, success: function (data) { $("#form-"+data.productpartsfinder_id+"").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('id'); loopid = loopid.split("-"); loopid=loopid['1']; if(data.chnagefilterid

        Please Select"); $.each(data.optionvalues, function(i,val) { $('#filter-'+data.chnagefilterid+'').append(""); }); }, error: function (error) { } });}); count=''; $(document).on('click','input.sizeFront',function(evt){ evt.stopImmediatePropagation(); count = 0; var filter_id = {}; var chnagefilterid = $(this).attr('data-option-id'); var chnagefilterid = chnagefilterid.split("-"); var chnagefilterid = parseInt(chnagefilterid['1']); var optionValue = $(this).val(); var labelText = $(this).next('label').text(); var fieldName = $(this).attr('name'); var loopid = $(this).attr('data-option-id'); var loopid = loopid.split("-"); var loopid= parseInt(loopid['1']); if(fieldName != 'height'){ if( (chnagefilterid > loopid) || (chnagefilterid == loopid) ) { filter_id[''+$(this).attr('data-option-id')+''] = $(this).val(); } } if(fieldName == 'height'){ filter_id['filter-1'] = sizeCookies['widthId']; filter_id['filter-2'] = $(this).val(); } if(count == 0){ $.ajax({ method: "POST", showLoader: true, url: "https://www.pitstoparabia.com/en/productpartsfinder/partsfinder/testindex/", data: { productpartsfinder_id:'1', filter_option_ids:filter_id, chnagefilterid:chnagefilterid }, success: function (data) { $('#find-1').removeAttr('disabled'); if(count==0){ $('#search_size').addClass('no_value'); $('#searchbysize-popup').empty(); $("#form-"+data.productpartsfinder_id+"").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('data-option-id'); loopid = loopid.split("-"); loopid=loopid['1']; if(data.chnagefilteridHeight'); $('a#filter-'+2+'').addClass('disabled'); $('a#filter-'+2+'').find('button').attr('disabled',true); } if($('a#filter-'+3+'').children('button').length==0){ $('a#filter-'+3+'').text(''); $('a#filter-'+3+'').append(''); $('a#filter-'+3+'').addClass('disabled'); $('a#filter-'+3+'').addClass('toSelect'); $('a#filter-'+3+'').find('button').attr('disabled',true); } if($('a#filter-'+1+'').children('button').length!=0 && $('a#filter-'+2+'').children('button').length!=0 && $('a#filter-'+3+'').children('button').length!=0 ){ } $("

        Current Selection : "+optionText+"

        ").insertAfter($(".search_by").find('.tyre_model')); } if(fieldName == hei){ if(typeof sizeCookies['heightId'] !== 'undefined') { sizeCookies['heightId'] = $.trim(id); }else{ sizeCookies['heightId'] = $.trim(id); } $('select#filter-2').val(id); $('select#filter-2').attr('disabled',false); $('select#filter-3').attr('disabled',true); $('select#height').val(id); if($('a#filter-'+3+'').children('button').length==0){ $('a#filter-'+3+'').text(''); $('a#filter-'+3+'').append(''); } if(typeof sizeCookies['heightValue'] !== 'undefined') { sizeCookies['heightValue'] = $.trim(optionText); }else{ sizeCookies['heightValue'] = $.trim(optionText); } } if(cookieField == hei){ heightPopUpImages(); var height = data.optionvalues; temporaryHeight = JSON.stringify(height); $("

        Current Selection : "+sizeCookies['widthValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); $('').insertAfter($(".search_by").find('.current_selection')); } if(fieldName == rs){ if(typeof sizeCookies['rimsizeId'] !== 'undefined') { sizeCookies['rimsizeId'] = $.trim(id); }else{ sizeCookies['rimsizeId'] = $.trim(id); } $('select#filter-3').val(id); $('select#filter-3').attr('disabled',false); $('select#rim_size').val(id); if(typeof sizeCookies['rimsizeValue'] !== 'undefined') { sizeCookies['rimsizeValue'] = $.trim(optionText); }else{ sizeCookies['rimsizeValue'] = $.trim(optionText); } } if(cookieField== rs){ rimsizePopUpImages(); var rim_size = data.optionvalues; temporaryRimSize = JSON.stringify(rim_size); $("

        Current Selection : "+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); $('').insertAfter($(".search_by").find('.current_selection')); } var button=''; if(fieldName == wid){ button = 'Width'; } else if(fieldName ==hei){ button = 'Height'; } else if(fieldName == rs){ button = 'Rim Size'; } frontPopupAppend(); clearHeader(); $(".search_by").find('.modal-header').prepend(''); $.each(data.optionvalues, function(i,val) { if(data.chnagefilterid == 2){ addHeightClass(); $('.fmeproductfinder-select').find('ul.value_no').append("
      • "); } if(data.chnagefilterid == 3){ addRimSizeClass(); $('.fmeproductfinder-select').find('ul.value_no').append("
      • "); } }); if(data.optionvalues.length==0){ $('#search_size').removeClass('no_value'); addLocationClass(); locationPopUpImages(); if($('.rear_tyres').is(":hidden")){ var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } $('.search_by_size').find('.top_section').append(''); $('.search_by_size').find('.location_block').append('

        Add a different rear tyre size?

        '); if(sizeCookies['click']==0 || sizeCookies['click']==null ){ $(".rear_tyres_hidden").clone(true,true).appendTo(".reartyre").css({'display':'block','overflow':'visible','opacity':1}).toggle(); }else{ $(".rear_tyres_hidden").clone(true,true).appendTo(".reartyre").css({'display':'block','overflow':'visible','opacity':1}); } $('.reartyre').append('

        Enter Your Location(Required) span>

        Locate me

        ').append("

        "); $(cityI).appendTo('.loc').attr('type','text'); $('#searchbysize-popup').find("#cityI").prop('required',true); $('#cityI').prop('disabled',false); if(location != null || location !=''){ $('#searchbysize-popup').find('#cityI').val(location); } } if($('.fmeproductfinder-block').find('.rear_tyres').css('display') =='none'){ $("

        Current Selection : "+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+ " R"+optionText+"

        ").insertAfter($(".search_by").find('.tyre_model')); }else{ $('.rearprevious').remove(); $('.previous').remove(); $("

        Front Tyre Selection : "+sizeCookies['widthValue']+"/"+sizeCookies['heightValue']+ " R"+optionText+"

        Rear Tyre Selection :

        ").insertAfter($(".search_by").find('.tyre_model')); backTolocation(); toRearWidth(); } $('div.search_by_size').addClass('rearsizeactive'); } count =1; } }, error: function (error) { } });}});click ='';$(document).on('click','input.rearSize',function(evt){ evt.stopImmediatePropagation(); click = 0; var filter_id = {}; var chnagefilterid = $(this).attr('data-option-id'); var chnagefilterid = chnagefilterid.split("-"); var chnagefilterid = parseInt(chnagefilterid['1']); var labelText = $(this).next('label').text(); var optionValue = $(this).val(); var fieldName = $(this).attr('name'); fieldName = fieldName.replace('second',''); fieldName = fieldName.replace('sechide',''); var loopid = $(this).attr('data-option-id'); var loopid = loopid.split("-"); var loopid= parseInt(loopid['1']); if(fieldName != 'height'){ if( (chnagefilterid > loopid) || (chnagefilterid == loopid) ) { filter_id[''+$(this).attr('data-option-id')+''] = $(this).val(); } } if(fieldName == 'height'){ filter_id['filter-1'] = sizeCookies['rearwidthId']; filter_id['filter-2'] = $(this).val(); } if(click == 0){ $.ajax({ method: "POST", showLoader: true, url: "https://www.pitstoparabia.com/en/productpartsfinder/partsfinder/testindex/", data: { productpartsfinder_id:'1', filter_option_ids:filter_id, chnagefilterid:chnagefilterid }, success: function (data) { $('#find-1').removeAttr('disabled'); if(click == 0){ $(".search_by").find('.search_by_size').empty(); $("#form-"+data.productpartsfinder_id+"").children().find('.fmepf-select-filter-options').each(function(key,value) { var loopid = $(this).attr('data-option-id'); loopid = loopid.split("-"); loopid=loopid['1']; if(data.chnagefilterid

        Height'); $('a#rearfilter-'+2+'').addClass('disabled'); $('a#rearfilter-'+2+'').addClass('toSelect'); $('a#rearfilter-'+2+'').find('button').attr('disabled',true); } if($('a#rearfilter-'+3+'').children('button').length==0){ $('a#rearfilter-'+3+'').text(''); $('a#rearfilter-'+3+'').append(''); $('a#rearfilter-'+3+'').addClass('disabled'); $('a#rearfilter-'+3+'').addClass('toSelect'); $('a#rearfilter-'+3+'').find('button').attr('disabled',true); } } else if(fieldName == 'rear_'+hei){ if(typeof sizeCookies['rearheightValue'] !== 'undefined') { sizeCookies['rearheightValue'] = $.trim(optionText); }else{ sizeCookies['rearheightValue'] = $.trim(optionText); } if(typeof sizeCookies['searchedRearHeigthId'] !== 'undefined') { sizeCookies['searchedRearHeigthId'] = id; }else{ sizeCookies['searchedRearHeigthId'] = id; } if($('.rear').find('a#rearfilter'+3+'').children('button').length==0){ $('a#rearfilter-'+3+'').text(''); $('a#rearfilter-'+3+'').append(''); $('a#rearfilter-'+3+'').find('button').attr('disabled',true); } } else if(fieldName == 'rear_'+rs){ if(typeof sizeCookies['rearrimsizeValue'] !== 'undefined') { sizeCookies['rearrimsizeValue'] = $.trim(optionText); }else{ sizeCookies['rearrimsizeValue'] = $.trim(optionText); } } if(cookieFielName=='2'){ var cookieField = 'rear_'+hei; var height = data.optionvalues; temporaryRearHeight = JSON.stringify(height); rearheightPopUpImages(); rearPopupAppend(); var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+ " R"+frontrimsize+"

        Rear Tyre Selection : "+sizeCookies['rearwidthValue']+"

        ").insertAfter($(".search_by").find('.tyre_model')); } else{ noFrontSize(); $('.current_selection').append("

        Rear Tyre Selection : "+sizeCookies['rearwidthValue']+"

        "); } $('').insertAfter($(".search_by").find('.current_selection')); } if(cookieFielName=='3'){ var rim_size = data.optionvalues; temporaryRearRimSize = JSON.stringify(rim_size); rearrimsizePopUpImages(); rearPopupAppend(); var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; var rearwidth = sizeCookies['rearwidthValue']; var rearheight = sizeCookies['rearheightValue']; var rearrimsize = sizeCookies['rearrimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+" R"+frontrimsize+"

        Rear Tyre Selection :"+rearwidth+" / "+rearheight+"

        ").insertAfter($(".search_by").find('.tyre_model')); }else{ noFrontSize(); $('.current_selection').append("

        Rear Tyre Selection : "+rearwidth+" / "+rearheight+"

        "); } $('').insertAfter($(".search_by").find('.current_selection')); } clearHeader(); var button=''; if(fieldName == wid){ button = 'Width'; } else if(fieldName == 'rear_'+hei){ button = 'Height'; } else if(fieldName == 'rear_'+rs){ button = 'Rim Size'; } $(".search_by").find('.modal-header').prepend(''); $.each(data.optionvalues, function(i,val) { if(data.chnagefilterid == 2){ addRearheightClass(); $('.fmeproductfinder-selects').find('ul.value_no').append("
      • "); $('div.search_by_size').addClass('rearsizeactive'); } if(data.chnagefilterid == 3){ addRearRimsizeClass(); $('.fmeproductfinder-selects').find('ul.value_no').append("
      • "); $('div.search_by_size').addClass('rearsizeactive'); } }); if(data.optionvalues.length == 0){ addLocationClass(); locationPopUpImages(); if($('.rear_tyre').length == 0){ var frontwidth = sizeCookies['widthValue']; var frontheight = sizeCookies['heightValue']; var frontrimsize = sizeCookies['rimsizeValue']; var rearwidth = sizeCookies['rearwidthValue']; var rearheight = sizeCookies['rearheightValue']; var rearrimsize = sizeCookies['rearrimsizeValue']; if(frontwidth !=null && frontheight !=null && frontrimsize !=null){ $("

        Front Tyre Selection : "+frontwidth+" / "+frontheight+ " R"+frontrimsize+"

        Rear Tyre Selection :"+rearwidth+" / "+rearheight+" R"+rearrimsize+"

        ").insertAfter($(".search_by").find('.tyre_model')); } else{ noFrontSize(); $('.current_selection').append("

        Rear Tyre Selection : "+rearwidth+" / "+rearheight+" R"+rearrimsize+"

        "); } var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); if(typeof loc['location'] !== 'undefined') { var location = loc['location']; }else{ var location = loc['location']; } $('.search_by_size').find('.top_section').append(''); $('.search_by_size').find('.location_block').append('').append('

        Enter Your Location(Required)

        Locate me

        ').append("

        "); $(cityRearInput).appendTo('.loc').attr('type','text'); $('#searchbysize-popup').find("#cityRearInput").prop('required',true); if(location !=null){ $('#searchbysize-popup').find('#cityRearInput').val(location); } $('#cityI').prop('disabled',false); } $('.rear_tyres').css({'display':'block'}); $('div.search_by_size').addClass('rearsizeactive'); } click =1; } }, error: function (error) { } });}});});function initit_locationFF() { var options = { componentRestrictions: { country: "ae" } }; var input_location = document.getElementById('cityI'); var autocomplete = new google.maps.places.Autocomplete(input_location, options); google.maps.event.addListener(autocomplete,'place_changed', function () { require(['jquery', 'jquery/ui','mage/cookies','jquery/jquery.cookie'], function($) { function setcookie(cookie_name,cookie_value) { var expire11 = new Date(); expire11.setTime(expire11.getTime() + (6 * 60 * 60 * 1000)); $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); if($.mage.cookies.get(cookie_name)!=cookie_value) { $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); } return; } function updateCartTotals(){ var url = "https://www.pitstoparabia.com/en/fmegeneric/index/updatetotals/"; $.ajax({ url: url, type: "POST", showLoader: false, cache: false, success: function(response){ var sections = ['cart']; require('Magento_Customer/js/customer-data').invalidate(sections); require('Magento_Customer/js/customer-data').reload(sections, true); } }); } var place = autocomplete.getPlace(); $('#cityI').val(place.formatted_address); document.getElementById("cityI").value = place.formatted_address; document.getElementById("cityInput").value = place.formatted_address; document.getElementById("latitude").value = place.geometry['location'].lat(); document.getElementById("longitude").value = place.geometry['location'].lng(); var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =0; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(place.formatted_address).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru =1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = place.geometry['location'].lng() ; }else{ loc['longitude']= place.geometry['location'].lng() ; } if(typeof loc['location'] !== 'undefined') { loc['location'] = place.formatted_address ; }else{ loc['location']= place.formatted_address ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = place.geometry['location'].lat() ; }else{ loc['latitude']= place.geometry['location'].lat() ; } var locations = JSON.stringify(loc); setcookie('fme_customer_data',locations); updateCartTotals(); }); });}require(['jquery', 'jquery/ui'], function($) { $(document).ready(function() { window.addEventListener('load', initit_locationFF); window.addEventListener('load', initit_locationRF); }); });function codeLatLng_batteryFF(lat, lng) { var latlng = new google.maps.LatLng(lat, lng); geocoder_battery = new google.maps.Geocoder(); geocoder_battery.geocode({ 'latLng': latlng }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { current_address = results[0].formatted_address; require(['jquery', 'jquery/ui','mage/cookies','jquery/jquery.cookie'], function($) { function setcookie(cookie_name,cookie_value) { var expire11 = new Date(); expire11.setTime(expire11.getTime() + (6 * 60 * 60 * 1000)); $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); if($.mage.cookies.get(cookie_name)!=cookie_value) { $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); } return; } function updateCartTotals(){ var url = "https://www.pitstoparabia.com/en/fmegeneric/index/updatetotals/"; $.ajax({ url: url, type: "POST", showLoader: false, cache: false, success: function(response){ var sections = ['cart']; require('Magento_Customer/js/customer-data').invalidate(sections); require('Magento_Customer/js/customer-data').reload(sections, true); } }); } var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); $("#cityI").val(current_address); $("#cityInput").val(current_address); $("#cityRearInput").val(current_address); var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =0; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(current_address).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru =1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = lng ; }else{ loc['longitude']= lng ; } if(typeof loc['location'] !== 'undefined') { loc['location'] = current_address ; }else{ loc['location']= current_address ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = lat ; }else{ loc['latitude']= lat ; } var locations = JSON.stringify(loc); setcookie('fme_customer_data',locations); updateCartTotals(); }); } else { } } else { } }); } function successFunction_locationFF(position) { var lat = position.coords.latitude; document.getElementById('latitude').value = lat; var lng = position.coords.longitude; document.getElementById('longitude').value = lng; codeLatLng_batteryFF(lat, lng); } function errorFunction() { }function initializelocationFF() { var geocoder_battery; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(successFunction_locationFF, errorFunction); } } function initit_locationRF() { var options = { componentRestrictions: { country: "ae" } }; var input_location = document.getElementById('cityRearInput'); var autocomplete = new google.maps.places.Autocomplete(input_location, options); google.maps.event.addListener(autocomplete,'place_changed', function () { require(['jquery', 'jquery/ui','mage/cookies','jquery/jquery.cookie'], function($) { function setcookie(cookie_name,cookie_value) { var expire11 = new Date(); expire11.setTime(expire11.getTime() + (6 * 60 * 60 * 1000)); $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); if($.mage.cookies.get(cookie_name)!=cookie_value) { $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); } return; } function updateCartTotals(){ var url = "https://www.pitstoparabia.com/en/fmegeneric/index/updatetotals/"; $.ajax({ url: url, type: "POST", showLoader: false, cache: false, success: function(response){ var sections = ['cart']; require('Magento_Customer/js/customer-data').invalidate(sections); require('Magento_Customer/js/customer-data').reload(sections, true); } }); } var place = autocomplete.getPlace(); document.getElementById("cityInput").value = place.formatted_address; document.getElementById("cityRearInput").value = place.formatted_address; // place variable will have all the information you are looking for. document.getElementById("latitude").value = place.geometry['location'].lat(); document.getElementById("longitude").value = place.geometry['location'].lng(); var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =0; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(place.formatted_address).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru =1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = place.geometry['location'].lng() ; }else{ loc['longitude']= place.geometry['location'].lng() ; } if(typeof loc['location'] !== 'undefined') { loc['location'] = place.formatted_address ; }else{ loc['location']= place.formatted_address ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = place.geometry['location'].lat() ; }else{ loc['latitude']= place.geometry['location'].lat() ; } var locations = JSON.stringify(loc); setcookie('fme_customer_data',locations); updateCartTotals(); }); });} function initializelocationRF() { var geocoder_battery; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(successFunction_locationRF, errorFunction); } } //Get the latitude and the longitude; function successFunction_locationRF(position) { var lat = position.coords.latitude; document.getElementById('latitude').value = lat; var lng = position.coords.longitude; document.getElementById('longitude').value = lng; codeLatLng_batteryRF(lat, lng); } function errorFunction() { } function codeLatLng_batteryRF(lat, lng) { var latlng = new google.maps.LatLng(lat, lng); geocoder_battery = new google.maps.Geocoder(); geocoder_battery.geocode({ 'latLng': latlng }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { current_address = results[0].formatted_address; require(['jquery', 'jquery/ui','mage/cookies','jquery/jquery.cookie'], function($) { function setcookie(cookie_name,cookie_value) { var expire11 = new Date(); expire11.setTime(expire11.getTime() + (6 * 60 * 60 * 1000)); $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); if($.mage.cookies.get(cookie_name)!=cookie_value) { $.mage.cookies.set(cookie_name,cookie_value, {expires: expire11,path:'/', domain: null}); } return; } function updateCartTotals(){ var url = "https://www.pitstoparabia.com/en/fmegeneric/index/updatetotals/"; $.ajax({ url: url, type: "POST", showLoader: false, cache: false, success: function(response){ var sections = ['cart']; require('Magento_Customer/js/customer-data').invalidate(sections); require('Magento_Customer/js/customer-data').reload(sections, true); } }); } var loc = $.parseJSON($.mage.cookies.get('fme_customer_data')); $("#cityRearInput").val(current_address); $("#cityInput").val(current_address); $("#cityI").val(current_address); var locCitys = $.parseJSON(["\"Abu Dhabi=>abu_dhabi","Ajman=>ajman","Al ain=>alain","Dubai=>dubai","Fujairah=>fujairah","Sharjah=>sharjah","Ras Al Khaimah=>ras_al_khaimah","Umm Al Quiwan=>umm_al_quawain","Umm Al Quwain=>umm_al_quawain","Umm Al Quawain=>umm_al_quawain","\u0623\u0628\u0648 \u0638\u0628\u064a=>abu_dhabi","\u0639\u062c\u0645\u0627\u0646=>ajman","Alain=>alain","\u062f\u0628\u064a=>dubai","\u0627\u0644\u0641\u062c\u064a\u0631\u0629=>fujairah","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651=>sharjah","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062e\u064a\u0645\u0629=>ras_al_khaimah","\u0627\u0645 \u0627\u0644\u0642\u064a\u0648\u064a\u0646=>um_al_quiwan\""]); var locCity = locCitys.split(','); var tru =0; $.each(locCity, function(i,val) { var newArray = val.split('=>'); var locf = $.trim(current_address).toLowerCase(); var locD = newArray[0].toLowerCase(); locD = locD.replace(/^"|"$/g, ''); if(locf.includes(locD) == true){ tru =1; loc['locationCity'] = newArray[1]; } }); if(tru==0){ loc['locationCity'] = null; } var long = $('#longitude').val(); var lat = $('#latitude').val(); if(typeof loc['longitude'] !== 'undefined') { loc['longitude'] = lng ; }else{ loc['longitude']= lng ; } if(typeof loc['location'] !== 'undefined') { loc['location'] = current_address ; }else{ loc['location']= current_address ; } if(typeof loc['latitude'] !== 'undefined') { loc['latitude'] = lat ; }else{ loc['latitude']= lat ; } var locations = JSON.stringify(loc); setcookie('fme_customer_data',locations); updateCartTotals(); }); } else { } } else { } }); }

        Firestone vs Bridgestone: Which Reigns Supreme on UAE Roads? (2024)

        References

        Top Articles
        Latest Posts
        Article information

        Author: Otha Schamberger

        Last Updated:

        Views: 6020

        Rating: 4.4 / 5 (75 voted)

        Reviews: 82% of readers found this page helpful

        Author information

        Name: Otha Schamberger

        Birthday: 1999-08-15

        Address: Suite 490 606 Hammes Ferry, Carterhaven, IL 62290

        Phone: +8557035444877

        Job: Forward IT Agent

        Hobby: Fishing, Flying, Jewelry making, Digital arts, Sand art, Parkour, tabletop games

        Introduction: My name is Otha Schamberger, I am a vast, good, healthy, cheerful, energetic, gorgeous, magnificent person who loves writing and wants to share my knowledge and understanding with you.