Omacro
Help Center omacro.com

Advanced Dealer Locator

Add custom rules to dealer results

How to define custom rules that influence which dealers appear and how Omacro result lists behave for advanced implementations.

At times, you may want to customize certain results. For example, if you would like to only display rental providers and/or service centers or only display retail locations (or a combination). To do so, you can implement this optional parameter in a couple different ways.

Option 1: Add Rules Globally from the Buy Now Script Path

If you wish to add rules globally throughout the site (where ever Buy Now is used), you can do so with the following additional parameter to the Buy Now script path.

  1. <script id="omacro-widget-buynow" src="https://buynow.omacro.com/embedded/bn.loader.js?company=[OMACRO ID]&country=US& local=rental,retail,service "></script>

In the above example, we added the additional URL parameter " local " with a value of " rental,retail,service ". The value must be comma separated (if more than one value is used), no spaces and all lower case. The above affect will only permit local results to show that have one of those attributes listed. Removing "retail" from the list will then only show rental providers and service centers. Current valid values are:

  1. rental
  2. retail
  3. service

Option 2: Add JavaScript to the Embedded Dealer Locator Script on Page

If you wish to add rules and are utilizing the embedded dealer locator script feature, you may add the following additional line to your embedded script. For more details about how to use an embedded locator, please visit: Embedding Dealer Locator Within Website Page

Please note the addition of the omacro.buynow.widget.allow method, which accepts two parameters. A key and a list of values. In the below example, we use "local" as our key, and ['rental', 'service', 'retail'] as our values (but any combination will work).

  1. <script>
  2. document.body.addEventListener("loaded.omacro.buynow", function (e) {
  3. e.preventDefault();
  4. omacro.buynow.widget.allow('local', ['rental', 'service', 'retail']);
  5. omacro.buynow.widget.show('123456789', 'online', 'us');
  6. }, false)
  7. </script>

The value must be comma separated (if more than one value is used), encapsulated in quotes and all lower case. The above affect will only permit local results to show that have one of those attributes listed. Removing "retail" from the list will then only show rental providers and service centers. Current valid values are:

  1. rental
  2. retail
  3. service