Skip Navigation

[Resuelto] Toolset maps distance Unit should only be Kilometers

This support ticket is created hace 5 años, 8 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 5 respuestas, tiene 3 mensajes.

Última actualización por rubenB hace 5 años, 8 meses.

Asistido por: Minesh.

Autor
Mensajes
#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: enlace oculto

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

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

#1222304

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: 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

Idiomas: Inglés (English )

Zona horaria: 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!