For more details see the Store Locator for Magento 2 extension page.
Let customers know about location of the nearest offline stores where your products are available. Display stores on a Google map and provide extra information for each location to enhance shopping process.
To configure the extension settings please go to Stores → Configuration → Amasty Extensions → Store Locator.
Frontend Locator URL — specify the frontend URL for a store locator page. This value will influence frontend URL of the store locator page. If you leave this field blank then default URL should be amlocator and look like:
http://example.com/index.php/amlocator
Meta Description — fill in the meta description for the store locator page;
Meta Title — fill in the meta title for the store locator page.
Use Geo IP — allows using Geo IP data which is very useful for the cases when a customer’s browser doesn’t provide location data; Use Browser Location — set this option to ‘Yes’ to use customers’ browser location data.
Distance Units — set default distance units (kilometers/miles) or enable users to specify the units on the frontend;
Google Mark Template — define the template for the Google mark that will be displayed for each store location on the map. See details.
Store List Template — specify the stores' info you want to display in the store list. Add the necessary variables and remove the ones you don't need;
**{{ifemail}}Email: {{email}}{{/ifemail}}**
In this case, emails will be displayed in the store list only for those stores which have their emails specified.
Attribute Template — choose the template for the tags-attributes that will be displayed for each store location on the map;
Frontend product URL text — specify the text for URLs that will be displayed on product pages. The links will redirect customers to the map with offline stores which sell corresponding products;
Open frontend URL on a new page — enable to open frontend URL on a new page;
Google API key — insert Google API Key. Please use this page to get a key;
Map Zoom — define the resolution at which the Google Map will be displayed;
Show additional attributes — display phone number, URL, and e-mail on the store list in the sidebar;
Text for shops which don't work in particular day — specify the text to display when a shop doesn't work in a particular day;
Search Radius — define the available search radius values;
Convert time format to 12 Hours AM/PM format on frontend — enable this option to utilize the AM/PM format for time on the frontend.
Enable clustering - switch to Yes to enable clustering of locations on the Store Locator's map.
Enable distance counting - Set to Yes to display the distance between the stores and the current location that is set by the customers.
Countries where addresses are allowed to be shown - Please use the field if you need to show only specific countries in the list of offered addresses for the 'Current Location' field on the Store locator's page. Please mind that Google Service allows to choose no more than 5 countries (you can find more information here). Or leave the field blank to show all possible countries in the list of offered addresses.
You can specify the main settings for different store views. When the store view is chosen, you can configure settings for it.
To edit settings for a certain store view unflag the corresponding checkboxes.
With the extension, you can display additional information in a popup (e.g. phone, website, email).
To configure the popup you will need to add the following information about a marker with a text description to the modules' configuration Google Mark template. For example:
Phone number: {{phone}} </br> Email: {{email}} </br> Website: {{website}} </br>
The whole list of the available fields to display in the popup:
In some cases you may have locations with and without a phone number. To display the number only when it exists, please, use this construction:
**{{ifphone}}{{phone}}{{/ifphone}}**
To adjust the store locator display, you can additionally configure the following options:
Map Width — specify the width of the map block;
Map Height — specify the height of the map block;
Store List Width — define the store list width;
Store List Height — define the store list height.
Hit the Download and Import button to get databases from Amasty.
To import files from your own source, use the Import option. Choose the database files and click the Import button.
Each store locator location consists of five tabs that should be configured to add data on a map. Let's do this step by step.
Specify the following data to provide information about certain location. Required fields are marked with *.
Location Name | Description | Status | ||
Store View | Zip | Position | ||
Country | Address | Phone Number | ||
State/Province | Email Address | Image | ||
City | Website URL |
You can use the Status option to quickly enable or disable certain store locations.
Then, switch to the Location on the Map tab to proceed.
The exact location coordinates will be defined automatically when you specify the location address and hit the Auto Fill button. It’s also possible to set them manually. Fill in the required Latitude and Longitude values.
Also, you can choose the desired location marker under the Custom marker option.
If everything is set up correctly you will see the location on a Google map.
You can skip this tab if you need all products to be available. Alternatively, in case some products are available only in specific offline stores, you can assign them to the necessary store location with the help of conditions.
Here you can specify additional store location details. E.g. parking availability, payment methods, brands, etc.
On top of that, with the extension, you can configure extra attributes to display them on a map. Go to Content → Amasty Strore Locator → Store Locator Attributes to edit already existing store attributes or create a new one.
The process of attribute configuration is quite simple. You need to:
Hit the Save button to finish configuring the attribute. Now, you can use it in the Store Attributes tab of your locations.
With the extension, you can add the store locator section to any page of your site as a widget. Please, go to Content → Widgets to create a new one. Hit the Add Widget button.
First, set the Widget Type to Amasty Store Locator and choose your current theme in the Design Package/Theme dropdown.
Then, please, specify the Widget Title, choose stores in the Assign to Store Views menu, and define the Sort Order if needed.
When done, hit the Add Layout Update button. Next, select required place to add widget to in the Display on dropdown menu and specify the rest details.
Next, please, proceed to the Widget Options tab. Here you can adjust the store locator widget functionality and look with the following options:
When done, please, click the Save button.
Please, go to Content → Pages or Content → Blocks in order to add the store locator widget to pages or blocks respectively.
Select the required page or block (or create the new one if needed), than proceed to the Content section.
Use the Insert Widget button in the Show Editor mode to add a new widget and adjust the same settings as for the new widget.
To import data you will need the correct .CSV file.
Set Entity Type as Amasty Store Locator. Use the Download Sample File link to get the example of the correct .CSV file that can be imported to the Store Locator module.
Generally, you can utilize the following IDs as new columns in the .CSV file and specify their values to add store locations and modify their details:
id | address | lng | marker_img |
name | state | lat | |
country | description | stores | |
city | phone | status | |
zip | store_img |
Then, you can specify Import Behaviour:
Also, you need to specify whether the import process should stop in case of an error or skip error entities. Moreover, you can define the number of errors to halt the import process.
Then, you need to select files to import using the Choose File button and hit the Check Data button.
The Store Locator extension for Magento 2 allows you to import store attributes. Follow this step by step guide for details:
You can customize the map appearance to fit your store pages design.
Usually, Google Map styles look like that:
[{"stylers":[{"saturation":-100},{"gamma":0.8},{"lightness":4},{"visibility":"on"}]},{"featureType":"landscape.natural","stylers":[{"visibility":"on"},{"color":"#5dff00"},{"gamma":4.97},{"lightness":-5},{"saturation":100}]}]
You can find custom styles on the web or create yourself but it requires special knowledge.
When you get the required styles, please, go to your server and find the main.js file in the extension folder. The full address depends on where you've installed the extension: /app/code/Amasty/Storelocator/view/frontend/web/js/main.js /vendor/amasty/storelocator/view/frontend/web/js/main.js
Then, find the myOptions variable in the initializeMap method. Here, you need to paste your custom style. The massive key is = styles.
Save changes and check the result on the frontend.
The extension affects product pages and provides customers with additional information related to offline stores inventory and their details.
Customers can filter stores using certain predefined attributes.
Locate Nearby button uses customer's current geolocation data based on IP address to locate the nearest stores from the list. However, the list will include all stores sorted by distance. Please note that this feature requires the Geo IP database to be installed. See this section for more information.
Sometimes, it is unable to complete the database import due to execution time limit of PHP scripts. You can avoid this error by increasing the maximum execution time for your PHP scripts.
You need to set the max_execution_time to the number of seconds that all your scripts are allowed to run in your PHP's configuration file. The file location may differ from system to system but in general you need to find the PHP.INI file and modify it.
We need to set the value to 18000.
For example:
; Maximum execution time of each script, in seconds ; http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI max_execution_time = 18000
Setting the value to 0 means there's no time limit.
You'll have to restart your web server for this solution to work.
Find out how to install the Store Locator extension via Composer.