Overground

B2B Distributor-Dealer Locator and Interactive Map Plugin for CRAFT CMS

Buy Now with PayPal License Support

B2B Locator Plugin for CAFT 2.0

Buy and easily implement this B2B locator plugin to allow B2B web users to find the closest dealer or distributor to their location.  Our development team invested over $7K in meticulous development and testing to save you time and money. We even include the front-end code to easily customize the user experience for your instance.

For a limited time we are offering this awesome plugin for $199. (which is $100 off.) 

B2B Locator for Dealers & Distributor Locations features:

  • Detailed Control Panel for Location Management
  • Searchable Google Maps integration with Directions
  • Region and City or Postal Code Search
  • And more...

Note: Plugin is developed to support CRAFT 2.0 instances.  Plugin development support can be purchased based on need.

Once we have confirmed your purchase on PayPal, you will be sent a Zip file containing the plugin and you can following the steps below to install and configure for your website.

Buy Now! 
(Securely with PayPal)

locator-plugin-map.jpg#asset:2330

Installation

  1. Download and extract the contents of the zip file.
  2. Copy the /locations folder to your site’s /craft/plugins folder.
  3. From the Craft CP go to Settings > Plugins and enable the Locations plugin.
  4. On the plugin settings page, click the gear icon for the Locations plugin.

Front-End Configuration

  1. In the extracted zip file’s /templates folder, copy the /locations folder and all of its contents to your Craft site’s templates folder.
  2. Copy the locator.php file to your Craft site’s /public folder.
  3. Open locator.php and modify the $db_host, $db_username, $db_password, and $db_name to match your database’s configuration settings.
  4. Open /craft/templates/locations/index.html and scroll to the bottom. Verify that the path PHPPath variable is set to the appropriate path of where you put locator.php. If you put it in the /public folder, then no changes need to be made.
switch($_SERVER['SERVER_NAME'])
{   
    case "localhost":
        $db_server = 'localhost';
        $db_user = 'dbusername';
        $db_password = 'dbpassword';
        $db_database = 'dbname';
        break;
}
<script>
    if (typeof(LocationPlugin) === "undefined")
    {
        // Use this code block if your script executes before the plugin is loaded
        LocationPlugin = {
            APIKey: '{{ craft.locations.apiKey }}',
            PHPPath: 'public/locator.php'
        };
    }
</script>

Usage

Front-end templates are provided in the folder /templates/locations to be used as a starter template.

Retrieve all locations

 {% for location in craft.locations.locations %}
    <div>{{ location.name }}</div>
{% endfor %}

Accessible location properties

  • id
  • name
  • slug
  • contact
  • address
  • phone
  • email
  • website
  • storeurl
  • latitude
  • longitude

Retrieve location by slug and linking to detail pages

Detail pages are automatically generated for each location, using the slug for the page’s url. You can also retrieve a location programmatically by slug.

{% for location in craft.locations.locations %}
    <a href="locations/{{ location.slug }}">{{ location.name }}</a>
{% endfor %}

Retrieve all regions

{% for region in craft.locations.regions %}
    <div>{{ region.name }}</div>
{% endfor %}

Retrieve all searchable regions

Includes only regions with the “Is Searchable” lightswitch toggled on in the CP.

locator-plugin-edit-region.jpg#asset:2329

{% for region in craft.locations.searchableRegions %}
    <div>{{ region.name }}</div>
{% endfor %}

Accessible region properties

  • id
  • name

Retrieve Google Maps API Key

{% craft.locations.apiKey %}

Initializing the embedded Google Map

And example of displaying searchable results on an embedded Google Map is provided at /templates/locations/index.html. 

<div id="location-map-wrapper">
    <div id="location-map-canvas" style="height:400px;"></div>
</div>
<div id="location-map-results"></div>
<script>
    if (typeof(LocationPlugin) === "undefined")
    {
        // Use this code block if your script executes before the plugin is loaded
        LocationPlugin = { APIKey: '{{ craft.locations.apiKey }}',
            PHPPath: 'public/locator.php'
        };
    }
    else
    {
        // Use this code block if your script executes after the plugin is loaded
        LocationPlugin.APIKey = '{{ craft.locations.apiKey }}';
        LocationPlugin.PHPPath = 'public/locator.php';
        LocationPlugin.Initialize();
    }
</script>

Overriding the Google Map marker HTML

The marker html is generated automatically by the plugin. However you can override this if desired.

<script>
    function markerTemplateOverride(data)
    {
        return "<div>" + data.name + "</div>";
    }
    if (typeof(LocationPlugin) === "undefined")
    {
        // Use this code block if your script executes before the plugin is loaded
        LocationPlugin = { APIKey: '{{ craft.locations.apiKey }}',
            PHPPath: 'public/locator.php',
            MarkerTemplateOverride: markerTemplateOverride
        };
    }
    else
    {
        // Use this code block if your script executes after the plugin is loaded
        LocationPlugin.APIKey = '{{ craft.locations.apiKey }}';
        LocationPlugin.PHPPath = 'public/locator.php';
        MarkerTemplateOverride = markerTemplateOverride;
        LocationPlugin.Initialize();
    }
</script>

Overriding the Location Results HTML

The search results are also generated automatically by the plugin, and can be overridden if desired.

<script>
    function resultsTemplateOverride(data, map, marker)
    {
         // example using jQuery
         var html = $("<div>" + data.name + "</div>");
          // zoom in on location when name is clicked
         html.click(function()
         {
             map.setZoom(15);
             map.panTo(marker.position);
         });
          // append location to results
         $("#location-map-results").append(html);
    }
    if (typeof(LocationPlugin) === "undefined")
    {
        // Use this code block if your script executes before the plugin is loaded
        LocationPlugin = { APIKey: '{{ craft.locations.apiKey }}',
            PHPPath: 'public/locator.php',
            ResultsTemplateOverride: resultsTemplateOverride
        };
    }
    else
    {
        // Use this code block if your script executes after the plugin is loaded
        LocationPlugin.APIKey = '{{ craft.locations.apiKey }}';
        LocationPlugin.PHPPath = 'public/locator.php';
        ResultsTemplateOverride = resultsTemplateOverride;
        LocationPlugin.Initialize();
    }
</script>