Google Maps Implementation

This topic applies to

Applies to

Aconcagua | Elbrus | Kilimanjaro | SuiteCommerce Web Stores | Vinson

SuiteCommerce Advanced uses Google Maps as the default map engine for Store Locator.

SCA uses a façade design pattern to implement Google Maps. This façade can be used as a guideline to integrate a new façade for a different maps engine.

SCA uses a JavaScript façade design pattern to implement Google Maps. This exists as the following modules and files:

  • StoreLocatorReferenceMapsImplementation.js: contains the reference map façade to be used for any map implementation. It defines the properties to be configured and the methods used to implement the maps engine. The StoreLocator module’s Router and Views rely on this code, so do not make any customizations to this module.

    • ReferenceMap.js: contains signatures of operations that will override the logic specific to the maps implementation.

    • ReferenceMap.Configuration.js: serves as the façade for the Google Maps configuration. It declares the methods used to communicate with configuration options as defined in your NetSuite account.

  • GoogleMapsImplementation: contains all the logic necessary to implement Google Maps as the base map for the Store Locator feature. 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, you must create a new module to replace this one. Any new module must reference the StoreLocatorReferenceMapsImplementation façade.

    • GoogleMap.js: contains all the required implementation code to override the ReferenceMap.js file of the reference façade and allows the application to communicate with the Google Maps engine.

    • Google.Configuration.js: serves as the façade to implement Google Maps as the base map when using the Store Locator feature. This file overrides the methods within the ReferenceMap.Configuration.js of the reference implementation.

Google Maps API Terms of Use and Usage Limits

To use the Google Maps API, you must agree to Google’s license terms, obtain a Google Maps API key, and provide your API key to NetSuite.

Note

The standard Store Locator configuration results in a site that complies with Google licensing terms. Ensure that your site policies and any customizations you make to this feature do not violate Google Maps API terms.


Key points in the Google Maps API terms 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 Google Maps APIs Terms of Service and state that Store Locator customers are bound by these Google 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 APIs Terms of Service for the complete list of Google terms of service.

Important

Google Maps APIs are free for a wide variety of use cases; however, if you have a high-traffic website, be aware of Google Maps API usage limits. You can purchase a premium license from Google, or you can enable Google billing for high-traffic sites. See Google Map APIs Pricing and Plans for current Google pricing and plan details. To monitor daily map usage, use the Google API Console.


Implementing Alternate Maps Engines

Suite Commerce Advanced provides a way to implement alternative map engines.

To integrate a different maps engine:

Note

The following procedure uses XyzMap as an example. You can use the existing GoogleMap.js and Google.Configuration.js as a template for creating a new implementation.


  1. Create a new module to replace the StoreLocatorGoogleMapsImplementation module. This new module must define the specific map engine implementation. Such a module might be titled StoreLocatorXyzMapImplementation.

  2. Within this new module, create a new implementation file titled XyzMap.js, where Xyz is the name of the map engine you are implementing. This file will contain all the required implementation logic for making the specific maps engine function with SCA. This file must define ReferenceMap as a dependency and also implement all the functions defined as required for the map engine.

  3. In the same manner, create a new Xyz.Configuration.js file. This file serves as the façade for the map engine configuration options. Make sure this module defines ReferenceMap.Configuration as a dependency and implements all the functions defined as required for the map engine.

  4. Edit the distro.json file to reference your new module. Store Locator supports only one map engine, so you must delete the following line, or otherwise disable it behind comment tags. For example: Your edited distro.json code might look like this:

    "suitecommerce/StoreLocatorXyzMapImplementation": "1.0.1",
    //"suitecommerce/StoreLocatorGoogleMapsImplementation": "1.0.1",
  5. Deploy your code.