Configure the Woosmap Store Locator Widget

Basics, settings and first steps to personalize the Store Locator Widget

  1. How to Set Custom Configuration
  2. Define Languages, Unit Systems and Labels
  3. Customize the Markers Style
  4. Set Initial View
  5. Refine the Search Feature
  6. Change Map Provider
  7. Change Distance and Route Provider
  8. Filter by Specific Types, Tags or using a Custom Query
  9. Driving Directions to Store

To match your preferences and website’s graphic style, all the properties of your Store Locator Widget can be customised client side. Here is an overview of the properties you’ll be able to set in your integration code (see Store Locator Widget Reference for more details).

How to Set Custom Configuration

To match your preferences and website’s graphic style, all the properties of your Store Locator Widget can be customised client side using setConf(). Call this method before render() your Store Locator.

HTML
        <div id="HTMLElementID"></div>
<script type="text/javascript" src="//webapp.woosmap.com/webapp.js"></script>
<script type="text/javascript">
 const loadWebApp = function () {
   const storeLocator = new WebApp('HTMLElementID', 'woosmap-public-key');
   const storeLocatorConfig = {"theme": {primaryColor: "#FF66CC"}}; // set your config. here we modified the primary color.
   storeLocator.setConf(storeLocatorConfig);
   storeLocator.render();
 }
 loadWebApp();
</script>

    

Define Languages, Unit Systems and Labels

The Store Locator Widget is currently available for the following languages : French, English, Spanish, German, Italian, Portuguese, Dutch, Catalan, Brazilian Portuguese, Russian, Chinese, Japanese, Ukrainian, Hebrew, Polish and Romanian. That means all default labels such as the localization button “Around you” or the text input placeholder “Search…”, will be translated into the chosen language.

JavaScript
        const storeLocatorConfig = {
    "internationalization": {
        "lang": "en", //values available are [fr, en, es, de, it, pt, nl, ca, pt-br, ru, zh, ja, uk, he, pl, ro]
        "period": "en-US", //Hour system to display openning hours [‘fr’ (for 24h), ‘en-US’ (for 12h)].
        "unitSystem": 1 //The unit system to display distances [0 (Metric), 1 (Imperial)].
    }
};

    

In addition to these default labels, you can specify custom translations for “More details” link and “Set as favorite” button that are displayed when a store is selected.

JavaScript
        const storeLocatorConfig = {
  "internationalization": {
    "customTranslations": { //Provides custom internationalization for given languages.
      "en": {
        "storeview": {
          "visitStorePage": "Visit the Store Page"
        },
        "favoritebuttonview": {
          "setAsFavorite": "Define as my Store"
        }
      }
    }
  }
};

    

Customize the Markers Style

To keep up with your brand identity and ensure the best possible readability and navigation, the map offers two types of display for stores, Simplified view with Dots Markers and Markers view with Image Markers.

Dots Markers

Stores are displayed as colored dots on the map. Useful for the top zoom levels and to render large amount of stores keeping the map display clean and fast. The size (in pixel) of the dots depends on the zoom level and vary based on size and minsize attributes. The higher the zoom level is, the thinner the dots are. Dots colors can be set for different types of service you may have on your network (eg. drive, click and collect, etc).

JavaScript
        const storeLocatorConfig = {
  "woosmapview": {
    "tileStyle": {
      "color": "#ef8900", //default color
      "size": 11,
      "minSize": 5,
      "typeRules": [
        {
          "type": "drive",
          "color": "#bbb300", //color for drive store type
          "zIndex": 2 // adjust zIndex to prioritize marker display when they overlap 
        },
        {
          "type": "click & collect", //color for click & collect store type
          "color": "#733f00",
          "zIndex": 1
        }
      ]
    }
  }
}

    

Images Markers

Stores are also displayed on the map as images. They are useful to render detailed markers (branding, logos, etc.) after a specific specific zoom level (breakpoint attribute).

You can specify custom icon markers for the default view (icon), for when a store is selected (selectedIcon), or when a store is displayed after a search (numberedIcon). You can find a live example of this behavior right here in the sample store locator widget.

JavaScript
        const storeLocatorConfig = {
  "woosmapview": {
    "breakPoint": 10,
    "style": {
      "default": {
        "icon": {
          "url": "https://images.woosmap.com/mapin/default.svg"
        },
        "selectedIcon": {
          "url": "https://images.woosmap.com/mapin/selected.svg"
        },
        "numberedIcon": {
          "url": "https://images.woosmap.com/mapin/searched_result.svg"
        },
      },
      "rules": [
        {
          "type": "drive",
          "icon": {
            "url": "https://images.woosmap.com/mapin/drive_default.svg"
          },
          "selectedIcon": {
            "url": "https://images.woosmap.com/mapin/drive_selected.svg"
          },
          "numberedIcon": {
            "url": "https://images.woosmap.com/mapin/drive_default.svg"
          },
        }
      ]
    }
  }
};

    

An alternative display option allows you to display the image of a number (from 1 to n) of the closest stores from the searched location. To do, just put markers images in a dedicated path with a number filename (e.g. “/1.svg”, “/2.svg”) and specify the numberedIcon like below.

JavaScript
        const storeLocatorConfig = {
  "woosmapview": {
    "breakPoint": 10,
    "style": {
      "default": {
        "icon": {
          "url": "https://images.woosmap.com/mapin/default.svg"
        },
        "selectedIcon": {
          "url": "https://images.woosmap.com/mapin/selected.svg"
        },
        "numberedIcon": {
          "url": "https://images.woosmap.com/mapin/{number}.svg"
        },
      },
    }
  }
};

    

Set Initial View

You can configure the initial zoom (initialZoom) and initial center (initialCenter) of the map. You could also let us automatically adjust the viewport of the map and to fit your stores distribution by using the fitBounds parameter.

JavaScript
        const storeLocatorConfig = {
    "woosmapview": {
        "initialCenter": { // Configure the initial center of the map.
            "lat": 48.967529,
            "lng": 2.368438
        },
        "initialZoom": 5, // Configure the initial zoom on the map. Value is between 0 and 22.
     /* "fitBounds": true */ // If true, the widget will set the viewport of the map to fit all the displayed assets.
    }
};

    

If you wish to automatically center the maps to display an initial view you can set an initial search. It will be automatically geocoded to display stores around this location (the Google Geocode API has to be allowed for your Google Maps API Key).

JavaScript
        const storeLocatorConfig = {
    "initialSearch": {
        "text": "London"
    }
};

    

Refine the Search Feature

When a user search for a location and select a prediction in the dropdown pick list, stores nearby this place are returned. They are displayed ordered by estimated distance from this search. By default, Google DistanceMatrix API is used to compute the distance but you can disable this feature and order stores by distance as the crow flies.
Number of stores fetched from a user search or geolocation can be set between 1 to 20.

JavaScript
        const storeLocatorConfig = {
    "datasource": {
        "maxResponses": 10,
        "maxDistance": 10000, // in meters
        "useDistanceMatrix": false
    }
};

    

The standard search configuration rely on Woosmap Localities. This service is not targeted to search for street addresses. It only returns common localities such as city names, suburbs and postcodes.

JavaScript
        const storeLocatorConfig = {
    "maps": {
        "localities": {
            "types": ["locality", "postal_code", "metro_station", "train_station", "shopping"],
            "componentRestrictions": {"country": "gb"}
        }
    }
};

    

If you want to get predictions containing addresses you can configure Woosmap Address.

JavaScript
        const storeLocatorConfig = {
    "maps": {
        "address": {
            "componentRestrictions": {"country": "gb"}
        }
    }
};

    

In addition to the location predictions, you can have autocompletion on your stores names. Stores predictions will be added above the location predictions. You can set the max number of stores returned (default is 3).

JavaScript
        const storeLocatorConfig = {
    "maps": {
        "autocompleteStores": {
            "maxStores": 3,
        }
    }
};

    

If you have a Google Maps Licence, you can configure Google Places to get predictions. (NB: Stores autocomplete cannot be used alongside Google Places because it’s against its Terms Of Services) You’ll need to specify a Google API Key and enabled in your Google console the Places API. Take a look at this blog post to see how.

You can define through the property places the Google Places AutocompletionRequest (restrict the search for a specific country for example) and set a minLength parameter to only trigger the Autocomplete when the text input reaches at least X characters. The search can also be bounded to a given extent to take into account your store density.

JavaScript
        const storeLocatorConfig = {
    "maps": {
        "apiKey": "AKqsdlj19898s_qsdk",
        "places": {
            "types": ["geocode"],
            "componentRestrictions": {"country": "gb"}
        },
        "minLength": 2
    }
};

    

If you do not want to provide autocomplete capabilities to your store locator (For cost or UX reasons) you can choose to not configure Localities, Address nor Places services. If so, depending on the Map Provider (defined bellow), the Geocoding API of your Map Provider will be used (either Woosmap Address API or Google Maps Geocoding API). The user will not be offered a prediction pick list and will need to press enter to geocode his input text.

JavaScript
        const storeLocatorConfig = {
    "maps": {
        "geocoder": {
            "componentRestrictions": {"country": "gb"}
        }
    }
};

    

Change Map Provider

The default map provider is Google Maps so the widget loads the Google Maps JS Library and display the Google basemap. You can choose from three map providers: Google Maps, Baidu and Woosmap Map. Set the desired maps.provider value from available MapType.

JavaScript
        const storeLocatorConfig = {
    "maps": {
        "provider": "woosmap" // for Woosmap Map or "google" or "baidu"
    }
};

    

Change Distance and Route Provider

By default, the distance of nearby stores from a search position are computed using Google Distance Matrix API. Alternatively, you may want to return the radial distance or use our built-in Woosmap Distance API.

JavaScript
        const storeLocatorConfig = {
    "datasource": {
        "distanceMatrixProvider": "woosmap"
    }
};

    

By the same token, the driving direction feature can use the route endpoint of the Woosmap Distance API instead of Google Maps Directions API.

JavaScript
        const storeLocatorConfig = {
    "datasource": {
        "routeProvider": "woosmap"
    }
};

    

Filter by Specific Types, Tags or using a Custom Query

You could configure your store locator widget to let your users filter the stores according to predefined criteria. Depending on the propertyType, you are able to add filters based on type, tag or custom queries. You can add multiple filter groups of the same type.

You can control the order in which filters are rendered by enabling the customOrder configuration option. When this configuration is added, the filter groups will be rendered in the order defined in the filters array.

If customOrder configuration option is not specified or disabled, the filters will be rendered in their default order i.e. type followed by tag and lastly custom.

The example below illustrates how to specify the order on filters and enable the setting of multiple filter groups of the same type.

JavaScript
        const storeLocatorConfig = {
    "filters": {
        "customOrder": true,
        "filters": [
            {
              'propertyType': 'custom', //based on any data associated to your stores
              'title': {
                  'en': 'Drive in Paris'
              },
              'choices': [
                  {
                      'key': '(type:"Drive" AND city:"Paris")', //build your query here
                      'en': 'Drive in Paris',
                      'fr': 'Drive à Paris'
                  }
              ],
              'innerOperator': 'or'
          },
          {
            "propertyType": "type", //based on Types
            "title": {
                "en": "Types"
            },
            "choices": [{
                "key": "click_and_collect",
                "en": "Click & Collect"
            }, {
                "key": "drive",
                "en": "Drive"
            }],
            "innerOperator": "and"
        }, {
            "propertyType": "tag", //based on Tags
            "title": {
                "en": "Services"
            },
            "choices": [{
                "key": "park",
                "en": "Parking"
            }, {
                "key": "fuel",
                "en": "Fuel Station"
            }],
            "innerOperator": "and"
        },
        {
        "propertyType": "custom", //based on any data associated to your stores
        "title": {
          "en": "Region"
        },
        "choices": [
          {
            "key": 'user.region:="western europe"',
            "en": "Western Europe",
          },
          {
            "key": 'user.region:="northern europe"',
            "en": "Northern Europe",
          }
        ],
        "innerOperator": "or"
      },],
        "outerOperator": "and"
    }
};

    

Beside you have also the possibility to initiate the store locator with a predefined filter. But this will disallow the filtering interface capability.

JavaScript
        const storeLocatorConfig = {
    "datasource": {
        "baseFilter": '(type:"Drive" OR type:"Click & Collect") AND tag:"Fuel Station"',
    }
};

    

Driving Directions to Store

If your visitor wants to pick up a product or visit your store, the store locator provides driving directions capability from his current position (or current search) to the desired destination. It uses the Google Maps Direction API. Instead, you could set the direction button ( ) to redirect the user to Google Maps (maps.google.com) by setting the disableDirections parameter to true.

JavaScript
        const storeLocatorConfig = {
    "maps": {
        "disableDirections": "true"
    }
};

    
Was this article helpful?
Have more questions? Submit a request