User Tools

Site Tools


Sidebar

magento_2:store_locator

For more details see the Store Locator for Magento 2 extension page.

Store Locator for Magento 2

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.

  • Utilize Geo IP data
  • Provide extra store information
  • Assign products and categories to certain store locations
  • Attach images to store locations
  • Highlight stores on a map with different colors

General Settings

To configure general extension settings please go to

Stores → Configuration → Store Locator

General

Specify 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

The store locator page is available from all product pages around your store under the Available in stores link.

Geolocation

  • 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.

Main settings

  • 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.
  • Attribute Template — choose the template for the tags-attributes that will be displayed for each store location on the map;
  • Page Title — fill in the title that will be displayed on a Store Locator page;
  • 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 guide to get a key;
  • Show additional attributes — display phone number and e-mail on the store list in the sidebar.
You can specify 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.

Setting Google Mark Template

With the extension, you can display additional information in a popup (e.g. phone, website, email).

To configure the popup you will need to do the following:

1. Add information about a marker with a text description to the modules' configuration Google Mark template;

Phone number: {{phone}} </br>
Email: {{email}} </br>
Website: {{url}} </br>

2. Add the following code to your js. file inside the processLocation method (storelocator/view/frontend/web/js/main.js).

if (locations.items[i].phone != "") {
curtemplate = curtemplate.replace("{{phone}}",locations.items[i].phone);
}
if (locations.items[i].email != "") {
curtemplate = curtemplate.replace("{{email}}",locations.items[i].email);
}
if (locations.items[i].url != "") {
curtemplate = curtemplate.replace("{{url}}",locations.items[i].url);
}

That should look like this:

Importing Geo IP Data

Databases are needed for the correct work of the Store Locator module. Please download the necessary files from Amasty or from your own source. To add the files, please go to Stores → Configuration → Geo IP Data

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.

Creating New Locations

To create a new store location please go to Content → Store Locator and hit the Add New button or click the necessary location to start editing it.

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.

General Information

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.

Location on a Map

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.

Available Products

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.

Store Schedule

The Store Schedule tab allows you to specify working schedule for each store location.

Store Attributes

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:

  • Fill in the Default Label
  • Define the Catalog Input Type (supports Text Field, Text Area, Date, Yes/No, Multiple Select, Dropdown)
  • Enable or disable a condition to require values
  • Configure the desired options

Hit the Save button to finish configuring the attribute. Now, you can use it in the Store Attributes tab of your locations.

Import

You can import various Store Locator data from other Magento 2 installations. Go to System → Data Tranfer → Import.

Supported .CSV IDs

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.

Download the correct .CSV file: amasty_storelocator.zip

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:

description country longtitude
phone city latitude
email region state
status postalCode metroCode
store_img address areaCode

Then, you can specify Import Behaviour:

  • Add/Update — this option is used to add new or update existing files;
  • Replace — this option is used to replace the original file with the new one;
  • Delete — this option is used to delete certain files of the same name.

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.

Frontend View

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.

Troubleshooting

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.

Rate the user guide
 stars  from 1 votes (Details)
magento_2/store_locator.txt · Last modified: 2017/11/21 10:18 by milosh