Skip to content

Configure MSI SSA

Ievgen Shakhsuvarov edited this page Jul 16, 2019 · 9 revisions

DEVELOP User Guide - This guide provides MSI Develop Branch/Active Development merchant information on Magento Multi Source Inventory (MSI) features and project.


You have two out-of-the-box Source Selection Algorithms available for recommending the best shipping and inventory quantity deductions for your stores:

  • Source Priority
  • Distance Priority

If you use the Distance Priority algorithm, we recommend also configuring the Source Priority. If distance cannot be determined using the configurations and addresses in the Distance Priority, the SSA falls back to Source Priority for shipment recommendations.

Source Priority Algorithm

Custom stocks include an assigned list of sources to sell and ship available product inventory through your storefront. This algorithm uses the order of assigned sources in your stock to make recommendations.

When run, the algorithm:

  • Works through the configured order of sources at the stock level starting at the top
  • Recommends a quantity to ship and source per product based on the order in the list, available quantity, and quantity ordered
  • Continues down the list until the order shipment is filled
  • Skips disabled sources if found in the list

To configure, assign and order sources to a custom stock. See Assigned Sources and Priorities.

Distance Priority Algorithm

This algorithm compares the location of the shipping destination address with source locations to determine the closest source to fulfill shipments. The distance may be determined by physical distance or time spent traveling from one location to another, using imported database location data or Google directions (driving, walking, or bicycling).

We recommend entering full street address and GPS coordinate information in your sources if using the Distance Priority algorithm. Google MAP uses your GPS coordinates and your street address. Offline Calculation uses the city, state, country, and zip codes.

You have two options for calculating distance:

  • Google MAP: Uses Google Maps Platform services to calculate the distance and time between the shipping destination address and source locations. This option uses the source's Latitude and Longitude (GPS coordinates) and may use the street address depending on the computation mode. You must provide a Google API key with Geocoding API and Distance Matrix API enabled. This option requires a Google billing plan and may incur charges through Google.
  • Offline Calculation: Calculates the distance using downloaded and imported geocode data using zip/post codes and GPS coordinates to determine the closest source to the shipping destination address. To configure this option, you may require developer assistance to initially download and import geocodes using a command line.

Configure Google Maps

You do not need a Google account to get started. The process includes Google account and project creation if needed. This option requires a billing account and payment method to complete configurations and use the algorithm.

Step 1: Create the Google API Key

  1. Visit Google Maps Platform and click Get Started.

  2. To enable the platform, select Maps, Routes, and Places and click Continue.

  3. Sign in with a Google account or create a new account.

  4. Set up the project:

    1. Select a project or enter a new project name.
    2. Select Yes to accept the terms.
    3. Click Next.
  5. Enter a billing account or create one. You can skip and add a billing account later.

  6. Click Console to open and configure your Google Cloud Platform options.

    1. Open your project.
    2. Expand the menu and click APIS & Services > Library.
    Google API Services
    1. Search for Geocoding API and Distance Matrix API. Select and enable each service.
    Google API Key Copy

Step 2: Configure the Google MAP Provider

  1. On the Admin sidebar, tap Stores. Then under Settings, choose Configuration.

  2. In the panel on the left under Catalog, choose Inventory.

  3. Expand the Distance Provider for Distance Based SSA section, and set Provider to "Google MAP".

    Google MAP Provider
  4. Expand the Google Distance Provider, and configure the settings:

    Google MAP Configurations
    1. Enter the Google API Key, copied from your Google Cloud Platform project.

    2. For Computation mode, select a configuration. If distance cannot be determined based on the computation mode, the Source Priority is used.

      • Driving: Default setting, requests standard driving directions using the road network
      • Walking: Requests walking directions using pedestrian paths and sidewalks (where available)
      • Bicycling: Requests bicycling directions using bicycle paths and preferred streets (where available). The Distance Matrix Service is currently only available in the US and some Canadian cities.
    3. For Value, select a value type:

      • Distance: Default setting, returns the distance between points in metrics (kilometers and meters) or imperial (miles and feet)
      • Time to Destination: Returns the time required to travel from the source locations to the shipping address in hours and minutes
  5. When complete, tap Save Config.

Important: If routes and data does not return for the selected Computation mode (driving, bicycling, or walking) for a shipment, the SSA defaults to using the Source Priority.

Configure Offline Calculation

Offline calculations use country codes to determine the distance between the shipping destination and source addresses. This option may require developer assistance to configure. You will issue an Inventory Management CLI command to download and import data from geonames.org.

Step 1: Download and Import Geocodes

  1. Open a command line.

  2. Enter the following command with a space separated list of country codes (using ISO-3166 alpha2 on geonames.org):

     php bin/magento inventory-geonames:import <country code>
    

    The system downloads and imports the geocodes data to your database. A message displays "Importing country code: OK" when complete.

For example, if you want to import geocodes for the United States, United Kingdom, Italy, and France, you would use the command:

php bin/magento inventory-geonames:import us gb fr it

Run this command anytime you need to add more geocodes.

Step 2: Configure Offline Calculation

  1. On the Admin sidebar, tap Stores. Then under Settings, choose Configuration.
  2. In the panel on the left under Catalog, choose Inventory.
  3. Expand the Distance Provider for Distance Based SSA section, and set Provider to "Offline Calculation".
  4. When complete, tap Save Config.

MSI Documentation:

  1. Technical Vision. Catalog Inventory
  2. Installation Guide
  3. List of Inventory APIs and their legacy analogs
  4. MSI Roadmap
  5. Known Issues in Order Lifecycle
  6. MSI User Guide
  7. DevDocs Documentation
  8. User Stories
  9. User Scenarios:
  10. Technical Designs:
  11. Admin UI
  12. MFTF Extension Tests
  13. Weekly MSI Demos
  14. Tutorials
Clone this wiki locally