Powering your home, your business, your world. (2024)

Breadcrumbs

Home > Dealer Locator
Please select a location:
Please answer a few questions so that we can help you find out where to buy your Generac product.
  1. What Product or Service are you looking for?
      • or
    • Country

Powering your home, your business, your world. (1)

Please select your location and the product/service you are looking for to view retailers, service center & dealers in your area.

"; content += "

"; content += "

"; google.maps.event.addListener(marker, 'click', function () { map.setCenter(point); var oZoom = map.getZoom(); if (oZoom != ZoomScale) { map.setZoom(ZoomScale); } if (eventMapInfoWindow != null) { eventMapInfoWindow.close(); } eventMapInfoWindow = new google.maps.InfoWindow({ 'content': content }); eventMapInfoWindow.open(map, marker); }); if (clickMarker) new google.maps.event.trigger(marker, 'click'); } //User story: 17551: Redundant Geocoding Backend :: Changes done as per new implementation. //Instead of calling addGeoCodeMarker() we are directly calling createMarker() because we have data for Latitude and Longitute. async function displayMap() { eventMapMarkers = []; eventMapInfoWindow = null; setCenterMap = true; var mapDiv = document.getElementById('p_lt_WebPartZone7_Content_PagePlaceholder_p_lt_ctl01_CustomBasicGoogleMaps_plcBasicGoogleMaps'.replace("plcBasicGoogleMaps", 'map')); //Changes by Mohit: Make it as a global variable. So that only this map will be used to set dynamic markers. map = new google.maps.Map(mapDiv, { zoom: Scale, mapTypeId: google.maps.MapTypeId.ROADMAP }); var count = (firstMarkerSet <= dealerLocations.length) ? firstMarkerSet : dealerLocations.length; for (i = 0; i < count; i++) { var doMapCenter = setCenterMap; setCenterMap = false; //console.log(dealerLocations[i]); createMarker(map, dealerLocations[i], doMapCenter, false); } } function searchLocations() { var webMethod = "/GeneracCorporate/Webservices/DealerLocatorWebService.asmx/SearchDealerLocator"; var city = document.getElementById('p_lt_WebPartZone7_Content_PagePlaceholder_p_lt_ctl01_CustomBasicGoogleMaps_CityTextBox').value; var postalCode = document.getElementById('p_lt_WebPartZone7_Content_PagePlaceholder_p_lt_ctl01_CustomBasicGoogleMaps_PostalCodeTextBox').value; var countryCodeUSA = document.getElementById('p_lt_WebPartZone7_Content_PagePlaceholder_p_lt_ctl01_CustomBasicGoogleMaps_locationUSRadioButton').checked; var countryCodeCAN = document.getElementById('p_lt_WebPartZone7_Content_PagePlaceholder_p_lt_ctl01_CustomBasicGoogleMaps_locationCARadioButton').checked; var countryCodeINT = document.getElementById('p_lt_WebPartZone7_Content_PagePlaceholder_p_lt_ctl01_CustomBasicGoogleMaps_locationINTRadioButton').checked; var stateddl = document.getElementById('p_lt_WebPartZone7_Content_PagePlaceholder_p_lt_ctl01_CustomBasicGoogleMaps_StateDropDown' + '_uniSelectorState_drpSingleSelect'); var state = stateddl.options[stateddl.selectedIndex].value; var radiusddl = document.getElementById('p_lt_WebPartZone7_Content_PagePlaceholder_p_lt_ctl01_CustomBasicGoogleMaps_RadiusDropDown'); var radius = radiusddl.options[radiusddl.selectedIndex].value; var category = $j("#categoryDropDown :selected").val(); var country = ""; if (countryCodeINT) { country = $j("#countryDropDown :selected").val(); } var options = { State: state, City: city, PostalCode: postalCode, Category: category, CountryCode: country, Radius: radius, IsUSASelected: countryCodeUSA, IsCANSelected: countryCodeCAN, IsINTSelected: countryCodeINT }; dealerLocations = []; // Get the field values $j.ajax({ type: "POST", url: webMethod, data: JSON.stringify({ searchOptions: options }), contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { var jsonResponse = $j.parseJSON(msg.d); $j("#pnlDealers").html(jsonResponse.DealerListLayout); //map the first item in list dealerLocations = jsonResponse.DealerObjectList; //User story: 17551: Redundant Geocoding Backend :: Implementation for saving Latitude and Longitude in Custom table. if (dealerLocations.length > 0 && (dealerLocations != null || dealerLocations != '')) { $j("#pnlMapsLoadingGif").removeClass("hide"); GetAllDealersGeoLoction(dealerLocations, function (response) { const jsonRes = JSON.parse(response); if (jsonRes != null) { let dealersDataLatLng = jsonRes; MapArrayDealerLatLng(dealersDataLatLng); displayMap().then( function (value) { $j("#pnlMapsLoadingGif").addClass("hide"); } ); } }); } firstMarkerSet = 10; //displayMap(); showPanel("pnlMaps", jsonResponse.IsPanelMapsVisible); showPanel("pnlRetailers", jsonResponse.IsPanelRetailersVisible); showPanel("pnlNoDealers", jsonResponse.IsPanelNoDealersVisible); showPanel("pnlDealers", jsonResponse.IsPanelDealersVisible); showPanel("pnlDealerInstruction", jsonResponse.IsPanelDealersInstructionVisible); if (jsonResponse.ErrorMessage === "" || jsonResponse.ErrorMessage === null) { $j("#lblErrors").text(""); } else { $j("#lblErrors").text(jsonResponse.ErrorMessage); } if (jsonResponse.NoResultsMessage != null) { $j("#lblNoResults").text(jsonResponse.NoResultsMessage); showPanel("pnlNoDealers", true); } else { showPanel("pnlNoDealers", false); $j("#lblNoResults").text(""); } $j("#lblRadius2").text(jsonResponse.Radius2Text); }, complete: function (data, status) { $j('.btnSearchLoading').addClass('hide'); $j('.btnSearch').show(); }, error: function (err) { $j("#pnlMapsLoadingGif").addClass("hide"); $j("#lblNoResults").text(serverErrorMessage); showPanel("pnlNoDealers", true); showError(); console.log("err >> " + err); } }); } //User story: 17551: Redundant Geocoding Backend :: Map Latitude and Longitude with the Dealer's data which is get from Webservice. function MapArrayDealerLatLng(dealersData) { for (let i = 0; i < dealersData.length; i++) { dealerLocations.map(function (dealer) { if (parseInt(dealer.DealerLocatorLeadID) == parseInt(dealersData[i].DealerLocatorLeadID)) { dealer.Latitude = dealersData[i].Latitude; dealer.Longitude = dealersData[i].Longitude; } }) } } function showError() { showPanel("pnlMaps", false); showPanel("pnlRetailers", false); showPanel("pnlNoDealers", true); showPanel("pnlDealers", false); showPanel("pnlDealerInstruction", false); $j("#lblErrors").text("Please try after sometime."); $j("#pnlMapsLoadingGif").addClass("hide"); } //User story: 17551: Redundant Geocoding Backend :: Get Dealers data from Custom Table by passing dealerid's. //As we are passing multiple id's have to use Post for Getting data instead of Get. async function GetAllDealersGeoLoction(dealerLocations, callBack_func) { const dealersData = dealerLocations.map((item) => { //return parseInt(item.DealerID); //return { "DealerID": parseInt(item.DealerID), "PostalCode": item.DealerZip, "Address": item.Address }; return { "DealerLocatorLeadID": parseInt(item.DealerLocatorLeadID), "PostalCode": item.DealerZip, "Address": item.Address }; }) return await $j.ajax({ type: "Post", url: "/customapi/DealerGeoLocation/DealersGeoLocation", data: JSON.stringify(dealersData), dataType: "json", contentType: "application/json", async: true, success: callBack_func, error: function (err) { $j("#pnlMapsLoadingGif").addClass("hide"); $j("#lblNoResults").text(serverErrorMessage); showPanel("pnlNoDealers", true); showError(); console.log("err >> " + err); } }); } function displayPanel(thePanel) { var panel = document.getElementById(thePanel); if (panel.style.visibility == 'hidden') { panel.style.visibility = 'visible'; } else { panel.style.visibility = 'hidden'; } } function GetQueryStringParams(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } }; //Changes by Mohit: dealerID is also passed to this method from Webservice.cs file. function resetMap(itemId, dealerID) { setCenterMap = true; if (itemId != undefined && itemId.length > 0 && $j('.map-pop-up-' + itemId) != undefined) { if (eventMapMarkers != undefined) { var marker; $j.each(eventMapMarkers, function (index, value) { if (parseInt(dealerID) == parseInt(value.dealerID)) marker = value; }); if (marker == undefined && (itemId + 1) > firstMarkerSet) { createMarker(map, dealerLocations[itemId], setCenterMap, true); firstMarkerSet = -1; } new google.maps.event.trigger(marker, 'click'); } } } function resetIconDescriptions() { $j('.dealer-services li').off('click').on('click', function () { var message = '' + this.className + '

' + iconDescriptions[this.className] + '

'; $j.fancybox({ content: message }); }); $j('.dealer-class').off('click').on('click', function () { var className = this.className.replace("dealer-class", "").replace(" ", ""); var message = '

' + iconDescriptions[className] + '

'; $j.fancybox({ content: message }); }); } function adjustGrid(selector) { var $retailers = $j('.dealer-locator-results-retailer'); $retailers.find('.retailer-item').removeClass('first'); $retailers.children('div:nth-child(' + selector + ')').addClass('first'); } function defineMq() { //media queries mediaCheck({ media: '(min-width: 1024px)', entry: function () { adjustGrid('4n+1'); } }); mediaCheck({ media: '(min-width: 768px) and (max-width: 1023px)', entry: function () { adjustGrid('3n+1'); } }); mediaCheck({ media: '(max-width: 767px)', entry: function () { adjustGrid('2n+1'); } }); } function addMq() { defineMq(); } //https://stackoverflow.com/questions/7844061/running-javascript-after-update-panel-refresh function panelUpdate() { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler); } function endRequestHandler(sender, args) { defineMq(); if (isMobile) { convertDealerLinktoGoogleMaps(); } }

Powering your home, your business, your world. (2024)
Top Articles
Latest Posts
Article information

Author: Jeremiah Abshire

Last Updated:

Views: 6351

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Jeremiah Abshire

Birthday: 1993-09-14

Address: Apt. 425 92748 Jannie Centers, Port Nikitaville, VT 82110

Phone: +8096210939894

Job: Lead Healthcare Manager

Hobby: Watching movies, Watching movies, Knapping, LARPing, Coffee roasting, Lacemaking, Gaming

Introduction: My name is Jeremiah Abshire, I am a outstanding, kind, clever, hilarious, curious, hilarious, outstanding person who loves writing and wants to share my knowledge and understanding with you.