• Has any one had experience with using multiple api’s on viadat’s store locator.

    The plugin works great on the principal domain but we now have a parked domain which is calling for a new api key.

    I have the javascript to make the api’s available to put on the site but can’t find where to put it as the store locator automatically inserts the key when it figures that a page needs it.

    any ideas / help most welcome.

    thanks in advance.

    peter

Viewing 1 replies (of 1 total)
  • I had the same problem and got it working. My solution isn’t the most elegant, but it works. BTW, using v1.2.42.1 of the Store Locator (SL) plugin.

    First, the API is stored in the WordPress DB using the following name “store_locator_api_key”. So the trick is to search the SL source files for where this key is obtained so that we can override it. It’s used in three places:

    1. public_html/wp-content/plugins/store-locator/api-key.php
    2. public_html/wp-content/plugins/store-locator/functions.sl.php
    3. public_html/wp-content/plugins/store-locator/view-locations.php

    The first place is the GUI interface to load the WP DB with the “store_locator_api_key” value. My quick-n-dirty solution is to hardcode the API, so I’m never using the DB value. This means I don’t have to touch this file.

    The second place has four entries of the “store_locator_api_key”, and the third, one entry. All five of these entries needs to be changed.

    Here’s an example of one of the entries:
    $api_key=get_option('store_locator_api_key');

    I changed it to this:

    $lookup["mywebsite.com"]="put_mywebsite_GoogleApiKeyHere";
    $lookup["www.mywebsite.com"]="put_mywebsite_GoogleApiKeyHere";
    $lookup["myotherwebsite.com"]="put_myotherwebsite_GoogleApiKeyHere";
    $lookup["www.myotherwebsite.com"]="put_myotherwebsite_GoogleApiKeyHere";
    $api_key=$lookup[$_SERVER['HTTP_HOST']];

    The idea is that I’m building an array of key/value pairs, where each key is one of the domain names, and its value is the corresponding API key. The $_SERVER[‘HTTP_HOST’] in the last line gets the domain the end-user is currently at, thereby providing the key for the array. Whammo, the corresponding API is returned.

    I copied this code five times, once for each of the “store_locator_api_key” entries. I simply changed the variable name to match the entry I replaced. So I used $api_key twice, $api twice, and $slak once.

    Hope this quick-n-dirty hardcode method helps. One caveat is that any upgrade to this plug-in will smash our hard coding. Caveat emptor!

Viewing 1 replies (of 1 total)
  • The topic ‘multiple api’s with store locator’ is closed to new replies.