Skip Navigation

[Gelöst] Toolset maps distance Unit should only be Kilometers

This support ticket is created vor 5 Jahren, 8 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 5 Antworten, hat 3 Stimmen.

Zuletzt aktualisiert von rubenB vor 5 Jahren, 8 Monaten.

Assistiert von: Minesh.

Author
Artikel
#1222238

I am trying to: set default_unit to "KM" (default_unit="KM") to have no dropdown with "MI" miles, because in Germany we do not use miles.

Link to a page where the issue can be seen: versteckter Link

I expected to see: Only "km" without dropdown (with "mi").

Instead, I got: Dropdown with "km" and "mi"

#1222304

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - the thing is that the distance radius and radius unit (km,mi) is displayed using the placeholder %%DISTANCE%% as you can see with the following shortcode:

[wpv-control-distance default_unit="mi" compare_field="stud-city" distance_center_url_param="toolset_maps_distance_center" distance_radius_url_param="toolset_maps_distance_radius" distance_unit_url_param="toolset_maps_distance_unit" inputs_placeholder="Show results within %%DISTANCE%% of %%CENTER%% here you go"]

The only way I would suggest is using jQuery to remove unwanted distance unit option from the radius unit (km,mi) dropdown - sounds good?

You should try to add the following code to "Search and Pagination" sections Js box of your view to remove the km option.

jQuery(document).ready(function($){
$('select[name="toolset_maps_distance_unit"] option[value="km"]').remove();
});
#1222776

Thanks. It works. But it was MILES, we do not need in Germany.

But it is still a select. Could me remove this? Do we use this UNIT or is it possible to remove this select and the search will know it is kilometers to show and calculate?

#1222846

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

well - when you add your distance filter - you need to make sure within the "Query Filter" section of your view that the filter is set to filter by km rather than mi.

You can use the following simple Js to hide the dropdown:

jQuery(document).ready(function ($) {

 jQuery('#toolset-maps-distance').hide();

});
#1282417
Screen Shot 2019-07-03 at 12.01.10 pm.png

Thanks Minesh and Martin! I think this is most common not to require more confusing dropdowns.

This script then needs to add 'km after the #toolset-maps-distance input, for it to make sense to users.

Sorry I don't know how to do this myself, I tried:

jQuery('#toolset-maps-distance').hide().after("km");

But thats outputting 'km' twice!

Any tips? sorry don't get js

#1282495

Oh just putting this function in the footer solves the issue, rather than inside the 'search and pagination' editor. All sorted!