Map Engine Implementation
The default map engine for the Store Locator feature is Google Maps.
The following JavaScript facade pattern is used to implement Google Maps. This facade can also be used as a guideline to integrate a different map engine.
The facade features the following modules and files:
-
StoreLocatorReferenceMapsImplementation: contains the reference map facade used for map engine implementation. This module defines the configurable properties and methods used to implement the map engine. The StoreLocator module relies on this module, so do not make any customizations to it.
The StoreLocatorReferenceMapsImplementation module contains the following files:
-
ReferenceMap.js: contains operation signatures that override the logic specific to map engine implementation.
-
ReferenceMap.Configuration.js: serves as the facade for Google Maps configuration. This file declares the methods used to communicate with the configuration options defined in your NetSuite account.
-
-
GoogleMapsImplementation: contains all the logic needed to implement Google Maps as the Store Locator base map. The files within this module override each corresponding file in the StoreLocatorReferenceMapsImplementation module. If you want to implement a map engine other than Google Maps, create a new module to replace this module. See Implementing Different Map Engines for more information. Any new module must reference the StoreLocatorReferenceMapsImplementation module.
The GoogleMapsImplementation module contains the following files:
-
GoogleMap.js: contains all the code required to override the
ReferenceMap.js
file. This file lets the Store Locator application to communicate with the Google Maps engine. -
Google.Configuration.js: serves as the facade to implement Google Maps as the Store Locator base map. This file overrides the methods called by
ReferenceMap.Configuration.js
.
-
Google Maps Platform Terms of Service
To use the Google Maps API, you must agree to Google’s license terms, obtain a Google Maps API key, and provide this key to NetSuite.
A standard Store Locator configuration means that your website complies with Google’s licensing terms. However, you must ensure that your website policies and any customizations you make to the Store Locator feature do not break the Google Maps Platform terms.
Key points in the Google Maps Platform Terms of Service include:
-
Your site must provide Store Locator as a free service and must not be behind a firewall.
-
Your company’s terms and conditions page must contain a link to the Google Maps Platform Terms of Service and state that Store Locator customers are bound by these terms.
-
Your company’s privacy policy must contain a link to the Google Privacy Policy.
-
Your site must not remove or obscure Google branding.
Refer to the Google Maps Platform Terms of Service for the complete list of the Google Maps Platform terms.
The Google Maps Platform is free for a wide variety of use cases. However, if you have a high-traffic website, be aware of Google Maps Platform usage limits. You can purchase a premium license from Google or you can enable Google billing for high-traffic websites. See Google Maps Platform pricing for current Google Maps pricing and plan details. To monitor daily maps usage, use the Google API Dashboard.
Implementing Different Map Engines
Suite Commerce Advanced (SCA) provides a way to implement different map engines.
The following procedure uses XyzMap as an example. You can use the existing GoogleMap.js
and Google.Configuration.js
files as a template to create a new map engine implementation.
To integrate a different map engine:
-
Create a new module to replace the StoreLocatorGoogleMapsImplementation module. This new module must define the specific map engine implementation. The new module could be called StoreLocatorXyzMapImplementation.
-
Within this new module, create a new implementation file called
XyzMap.js
, where Xyz is the name of the map engine you are implementing. This file will contain all the implementation logic required to make the specific map engine function with SCA. This file must define ReferenceMap as a dependency and implement all the functions defined as required for the map engine. -
Create a new
Xyz.Configuration.js
file. This file will serve as the facade for the map engine configuration options. This file must define ReferenceMap.Configuration as a dependency and implement all the functions defined that are required for the map engine. -
Edit the
distro.json
file to reference your new module. Store Locator supports only one map engine, so you must delete code that references StoreLocatorGoogleMapsImplementation or disable it behind comment tags. For example, your editeddistro.json
code might look like this:"suitecommerce/StoreLocatorXyzMapImplementation": "1.0.1", //"suitecommerce/StoreLocatorGoogleMapsImplementation": "1.0.1",
See The distro.json and ns.package.json Files for information about the distribution file and its location.
-
Save and redeploy the
distro.json
file to NetSuite. For more information, see Deploy SCA Customizations to NetSuite.