Store Locator Configuration
The SAP Commerce Cloud Store Locator helps consumers to find stores in the proximity of a postal code, city name, or by using Global Positioning System (GPS) information. The Store Locator can also provide directions to the selected store. From a more technical point of view, the Store Locator functionality provides services that can work with standard online interfaces, as well as with mobile solutions.
Adding Points of Sale (POS) to a Base Store
Each base store object that represents a store in the system contains a collection of the points of sale. A point of sale is a single location, with a geographical representation of the store. The point of sale contains several pieces of information, including descriptions, images, a geographical position, and an address. A point of sale can be added to the base store using the Backoffice Administration Cockpit, which is a quick method to add or edit a small amount of data. For larger amounts of data, using an ImpEx file is a better choice because it is more efficient.
For information on how to use ImpEx, see Using ImpEx with Backoffice or SAP Commerce Cloud Administration Console.
Adding a POS Using Backoffice
To add a point of sale using Backoffice:
- Log into Backoffice (https://localhost:9002/backoffice).
- Navigate to .
- Click + Point of Service in the toolbar. The Create New Point of Service form appears.
- Enter the POS Name and select Store for the Type so that the POS appears in the Store Locator.
- Click Done.
- To add additional information, click the newly created POS to open its details.
- In the Location tab, enter any required information, such as the Address, Opening hours, and Warehouses.
- To add the POS to a storefront, select the Base Store in the Administration tab.
- Click Save.
Adding a POS Using ImpEx
It is possible to add new points of sale by using an ImpEx script that contains all of the required information for creating a point of sale in the system. The following is an example script that imports two sample points of sale, populates them with the addresses, and then assigns them to a specific store with the basestore label:
INSERT_UPDATE PointOfService;name[unique=true];type(code);address(&addrID);latitude;longitude;geocodeTimestamp[dateformat=dd-MM-yyyy] ;Hybris Electronics - Nakano;STORE;addr1;35,7091;139,6732;29-04-2011 ;Hybris Electronics - Shinbashi;STORE;addr2;35,66730;139,75429;29-04-2011 ; INSERT_UPDATE Address;&addrID;streetname;streetnumber;postalcode[unique=true];town[unique=true];country(isocode);owner(PointOfService.name)[unique=true] ;addr1;Waseda Dori;13;;Tokio;jp;Hybris Electronics - Nakano ;addr2;Hibiya Dori;20;;Tokio;jp;Hybris Electronics - Shinbashi ; INSERT_UPDATE PointOfService;name[unique=true];basestore(uid) ;Hybris Electronics - Nakano;electronics ;Hybris Electronics - Shinbashi;electronics
If you do not provide geographic coordinates, make sure they are calculated manually, or with a geolocation cron job. Based on the information stored in the system, the locations of the points of service and their distances are calculated, and then displayed on the front end pages. Distance units can also be localized. For example, kilometers can be configured as miles instead.
For more information, see ImpEx Syntax.
Store Content
There are some attributes for each point of sale that are visible on the front end and that can be configured. This section contains a description of these attributes.
Picture
Each point of sale can contain two types of graphics. The first image is represented by the mapIcon attribute and is displayed on the Store Locator map of the found results. The second image is a storeImage graphic, which is a media container that contains the store images in different formats, and which are displayed on the Search Result List page or on the Store Details page. If no store image is provided, the default Coming Soon image is displayed.
Opening Times
A point of sale object also contains the openingSchedule attribute. This attribute provides information about the store's specific hours of operation, including special days, such as weekends or holidays. This information is displayed on both the Search Result List page and on the Store Details page.
For more information, see Store Locator Implementation.
The following is a sample ImpEx script that creates weekday openings for Monday and Tuesday:
$standardHours=standard-hours INSERT_UPDATE OpeningSchedule;code[unique=true]; ;$standardHours; INSERT_UPDATE WeekdayOpeningDay;closingTime[dateformat=hh:mm];dayOfWeek(code,itemtype(code))[unique=true];openingTime[dateformat=hh:mm];openingSchedule(code)[unique=true]; ;20:00;MONDAY:WeekDay;08:00;$standardHours; ;20:00;TUESDAY:WeekDay;08:00;$standardHours;
The following is a sample ImpEx script that creates a special opening day on 01.01.2011:
INSERT_UPDATE SpecialOpeningDay;date[unique=true,dateformat=dd.MM.yyyy];message[lang=en];closed;openingSchedule(code)[unique=true];closingTime[dateformat=hh:mm];openingTime[dateformat=hh:mm]; ;01.01.2011;;true;$standardHours;;;
The following is a sample ImpEx script that assigns a schedule to a PointOfService:
INSERT_UPDATE PointOfService;name[unique=true];basestore(uid);openingSchedule(code); ;Hybris Electronics - Nakano;electronics;$standardHours;
Features
Another visible attribute is features, which holds a collection of store features. A store feature is a dynamic enumeration value, and you can add a new feature to the system. A feature holds store-specific information that you can reuse for other stores as well. An example would be a store that is open on Sundays, or a store that has wheelchair access. This information is displayed only on the Store Details page.
Store-Specific Content
The storeContent attribute also holds descriptive content about a specific store. This attribute is localized, and its value is displayed only on the Store Details page.
Address
An important attribute for each point of sale is the store address. An address should be formatted in a way that enables the geolocation service to determine the geographical coordinates. It is possible to put latitude and longitude directly in the point of sale using an ImpEx script. In all other cases, these values cannot be edited, and are determined automatically basing on the information that is placed in the point of sale address.
Extended Data Model
The following is a data model diagram for the Store Locator:
Storefront API Key Configuration
The SAP Commerce Cloud Accelerator project is ready to maintain multiple stores, and each store can operate at a different address. This requires the Google Maps API key to be configurable because each key is valid for only one URL. The project contains a GoogleAPIKeyInterceptor function that is able to hold many references to different API keys, and that matches the proper API key for each URL. However, to work properly, it must be configured using the platform's project.properties file. This file can contain multiple entries for different registered URL addresses. The data is represented as key to value pairs. The Google API key in the properties file should start with googleApiKey., followed by the URL that this particular key matches. The following are examples of entries in the project.properties file for generating Google API keys:
googleApiKey.apparel.uk.local=ABQIAAAAv(...)4LmJ7bMEeRQ googleApiKey.apparel.de.local=ABQIAAAAv(...)Ma6XGgaJvyQ
You can customize the Google Maps API URL by providing a custom API version: googleApiVersion. By default, the value is set up for each storefront as follows:
googleApiVersion=3.7
For more information, see http://code.google.com/apis/maps/signup.html
: Google API keys.
Setting Site Distance Unit
The Store Locator distance unit is held in the BaseStore instance as an additional attribute, so no additional property keys are needed.
In the Store Locator Search Results and Store Details pages, the distance between the point of service and the searched location is displayed. Depending on the actual address of the point of sale, the distance can be displayed in different units. Currently, two different unit systems are supported: metric and imperial. You can assign each country ISO code to be displayed in a specific unit system using the project.properties file. The following are example entries for setting the site distance unit in the project.properties file:
acceleratorstorefront.imperial.isocodes=us,gb acceleratorstorefront.metric.isocodes=de,ja
The distances of countries with the ISO codes listed for acceleratorstorefront.imperial.isocodes properties are displayed with imperial units, and countries with the ISO codes listed for acceleratorstorefront.metric.isocodes properties are displayed with metric units. Distances in the system are always calculated using the metric system, and the actual ratio for an imperial system is hardcoded in the DistanceHelper helper class.
CMS Store Locator Pages
The information in the Store Locator Search Results and Store Details pages is placed into the Content Management System (CMS) page context. Aside from the Store Locator-related dynamic content, the displayed page also contain several other elements that need to be configured in the CMS. For both Store Locator-related pages, the CMS page with the storefinderPage UID is used. To display Store Locator pages correctly, there must be a page with this UID present in the content catalog version that is used for the current website. The template for this page is called StoreFinderPageTemplate, and it contains all the content slots that can be filled with the required data using the cmscockpit extension. Most of the content slots are filled by default with data such as SiteLogo, HeaderLinks, MiniCart, NavigationBar, and Footer, but are easily edited and adapted to your required specifications. Also, the top and side content containing commercial banners can be updated to display the desired content.
For more information, see Setting Up a Basic Web Site in the Backoffice.
Geolocation Cron Job
During system initialization, or the updating of a page, you can select a check box that creates a geocoding cron job. When this cron job is created, it periodically traverses all points of service and tries to determine the actual geographical coordinates for the entered addresses. When the coordinates are determined, they are then used for determining distances between searched locations and points of sale.
For more information, see the Adjusting Geocoding Cron Job section of Using Store Locator Service.

