Version 1.4.5 and 1.4.6 Release Notes

Cardinal Store Locator version 1.4.5 was released a little over a week ago and version 1.4.6 was released last night as a follow-up to address a couple of minor issues that popped up after the previous release. Version 1.4.5 is a larger update that adds new features, makes improvements, and fixes several issues. One important note for the 1.4.5 release is the addition of a Geocoding API key setting that is covered in a separate post. If you are using the default locations custom post type or an alternative custom post type for your location data please take the time to create a secondary Geocoding API key and add the value under the Primary Settings of the plugin. Highlights of the release combination include the following:

New custom sorting

Under the Structure Settings tab a new “Custom sorting” setting can be found and if enabled, several additional sorting options will appear including settings to set the initial sorting method. Exactly as it sounds, these new settings offer additional sorting options on the front-end. When enabled visitors will be able to sort the locations by any of the location address components (name, address, city, state, postal code, etc.) in addition to distance and date. A custom sorting JavaScript callback is also available alongside these settings.

 

 

Front-end length unit swapping between miles and kilometers

Previously, the “Length unit” setting under the Primary Settings tab set the length unit for the plugin globally and that is the distance unit that would display after searching for a location. Version 1.4.5 of the plugin now has a Length unit swap setting under the Structure Setting tab that allows visitors to switch between miles and kilometers, giving them the control of the distance unit output.

Component filtering support

The Geocoding API occasionally returns unexpected results and it can especially be a pain point for international locations. Taking advantage of region biasing has been the standard answer for support requests but on rare occasions that still doesn’t address the issue, especially with locators that have multinational locations. Component filtering is a newer feature that was added to the Google Maps API and support for this has been added in Cardinal version 1.4.5 with both the back-end and front-end geocoding requests. Component filtering offers improved restriction specificity and requests can be restricted by postal code and/or country. Requests can also be influenced by route, locality, and administrative_area. Please review the Google documentation on component filtering for more information on how this works.

On the back-end when a new location is added or edited when using the default locations custom post type or an alternative post type as the location data source, the country field value is automatically used for component filtering when it’s filled in. On the front-end component filtering is used automatically when using Regions (under Structure Settings) and the selected country value will be used with the geocoding request. The front-end geocoding component filtering object can be overridden completely using the geocode restrictions callback.

Address shortcode

To improve the development with single location posts a new address shortcode has been added, which will output the full address of the location being viewed with the appropriate address markup. The address components can be filtered with the new address components filter and the HTML markup output can be filtered with the address markup filter.

Changelog

Version 1.4.6

  • Fixed missing CSS property .loc-alt-dist needed for front-end distance swap – both KM and miles show in templates without.
  • Removed Geocoding API key value from being sent to the JS file (no longer publicly viewable in page source).
  • Updated Handlebars templates so that location names are output with triple stash to avoid special character issues.
  • Updated remote data caching functionality so that it’s skipped completely if a relative URL is used for the Data file path setting.

 

Version 1.4.5

  • Added cardinal-storelocator-address shortcode to display single location address.
  • Added bh_sl_locations_query_args filter to allow location WP_Query arguments to be updated/overridden.
  • Added bh_sl_tax_cpts filter to allow the default “Location Categories” taxonomy to be applied to other post types.
  • Added cslAjaxData callback to allow custom data to be sent with the AJAX request.
  • Added cslAutoGeoSuccess callback that fires after the geolocation API returns a successful result.
  • Added cslFormVals callback that fires after the form values have been processed from the form.
  • Added cslGeocodeRestrictions callback that allows the componentRestrictions object to be overridden.
  • Added cslNearestLoc callback that fires when the nearest location is triggered with the open nearest setting.
  • Added cslSorting callback that fires when when a new sorting method is selected.
  • Added component filtering for geocoding to better restrict by area – especially helpful with international geocoding.
  • Added custom sorting settings under Structure Settings to allow visitors to control the location sort order from the front-end.
  • Added drag and drop order functionality to filters set up under Filter Settings.
  • Added functionality to specify filter types using the cardinal-storelocator-filters shortcode with the filter-types attribute.
  • Added functionality to fill in search input with determined address when using Auto geocode or Geocode button settings.
  • Added length unit (distance miles/kilometers) front-end swap functionality and settings.
  • Added geocoding back-end API key field setting when Data source is set to Register Locations Post Type or Other Custom Post Type.
  • Added Google Map object as parameter to cslBeforeSend, cslListClick, cslModalReady, and cslFilters callbacks.
  • Added location data object as parameter of cslDirectionsRequest callback.
  • Added mappingObject, originPoint, data, and page parameters to cslSuccess callback.
  • Added “No results alternative” setting to display the no results message instead of all locations when the closest location is further than the “Distance alert” setting.
  • Added open nearest location setting to automatically highlight the closest location from the origin.
  • Changed parseJSON to native JSON.parse due to deprecation in rawData processing function.
  • Fixed full path disclosure security issue with data passed to JavaScript.
  • Fixed issue where HTML5 Geolocation was skipped when using the fullMapStartBlank setting.
  • Fixed issue with featuredLocations setting where featured locations at far distances would trigger distance alert.
  • Fixed issue with filtering values containing ampersands, which would not display any results – updated filtering regex.
  • Fixed issue with mapReload (triggered with optional reset button) where store limit wasn’t reset.
  • Fixed issue with pagination page numbers displaying after no results.
  • Fixed issue with taxonomy filtering and Auto geocode setting where HTML Geocoding API would run on every filter change.
  • Fixed missing Google Maps API key parameter from post geocoding call.
  • Fixed variable casting warning in PHP v7.1+ in shortcode file with wp_localize_script.
  • Fixed typo in admin meta box container ID “locations_meta_box”.
  • Removed check for safe mode in plugin Support settings tab since it is deprecated as of PHP 5.4.0.
  • Renamed EDD updater class to avoid conflicts with other themes and plugins.
  • Removed locations transient (bh_sl_locations) expiration to default to none.
  • Updated taxonomy filtering so pagination is reset to first page after selecting a filter.