Map Engine Implementation
Google Maps is the default map engine for Store Locator.
The following JavaScript facade pattern is used to implement Google Maps. You can also use this facade as a guide to integrate other map engines.
The facade features the following modules and files:
-
StoreLocatorReferenceMapsImplementation: Contains the reference map facade used for map engine implementation. It defines the properties and methods for implementing the map engine. The Store Locator module relies on this, so avoid customizing it.
This module includes the following files:
-
ReferenceMap.js: Contains operation signatures that override the logic specific to map engine implementation.
-
ReferenceMap.Configuration.js: A facade for Google Maps configuration. It declares the methods used to communicate with the configuration options defined in your NetSuite account.
-
-
GoogleMapsImplementation: Contains the logic needed to implement Google Maps as the Store Locator base map. Its files override the corresponding files in StoreLocatorReferenceMapsImplementation. If you want to implement a different map engine, create a new module to replace this one. See Implementing Different Map Engines for more information. New modules must reference StoreLocatorReferenceMapsImplementation.
This module includes the following files:
-
GoogleMap.js: Contains all the code required to override the
ReferenceMap.js
file. It enables communication between Store Locator and Google Maps. -
Google.Configuration.js: A facade for implementing Google Maps as the Store Locator base map. It overrides the methods called by
ReferenceMap.Configuration.js
.
-
Google Maps Platform Terms of Service
To use Google Maps API, agree to Google's license terms, get a Google Maps API key, and give it to NetSuite.
A standard Store Locator configuration means that your website complies with Google’s licensing terms. However, ensure your website policies and any customizations you make to the Store Locator feature don't violate Google Maps Platform terms.
Note the following key points in the Google Maps Platform Terms of Service:
-
Offer Store Locator for free and make sure it's not behind a firewall.
-
Link to Google Maps Platform Terms of Service on your terms and conditions page and state that customers are bound by these terms.
-
Include a link to Google Privacy Policy in your privacy policy.
-
Don't remove or hide Google branding on your site.
Refer to the Google Maps Platform Terms of Service for the full list of terms.
Google Maps Platform is free for many use cases. If you have a high-traffic site, be aware of Google Maps Platform usage limits. For high-traffic sites, you can buy a premium license or enable Google billing. Check Google Maps Platform pricing for current prices and plans. To track daily map usage, use the Google API Dashboard.
Implementing Different Map Engines
Suite Commerce Advanced (SCA) allows you 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.
To implement a different map engine:
-
Create a new module to replace StoreLocatorGoogleMapsImplementation. This module will define the new map engine's implementation. The new module could be called StoreLocatorXyzMapImplementation. For example, this new module could be named 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 the logic to make the specific map engine work 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",
For information about the distribution file and its location, see The distro.json and ns.package.json Files.
-
Save and redeploy the
distro.json
file to NetSuite. For more information, see Deploy SCA Customizations to NetSuite.