Skip Navigation

[Resolved] Update of Maps changes the Search View

This thread is resolved. Here is a description of the problem and solution.

Problem:
Update of Maps changes the Search View - Hide or remove "Show results within" text of location/address/map search filter
Solution:
To remove/hide "Show results within" text of location search filter when using the blocks, you will have to add the custom JS code.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/update-of-maps-changes-the-search-view/#post-2257267

Relevant Documentation:
- https://toolset.com/documentation/programmer-reference/adding-custom-javascript-code-to-views-that-use-ajax/

This support ticket is created 3 years ago. 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.

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)

This topic contains 5 replies, has 2 voices.

Last updated by hacerY 3 years ago.

Assisted by: Minesh.

Author
Posts
#2255305
change-search-bar.jpg

Tell us what you are trying to do?
I am updating the Toolset Maps plugin from version 2.0.8 to 2.0.11, and when I do so the Search by Radius part in the search bar changes. It looks like it looses the Settings and some custom CSS that I've applied.
I tried to redo the settings, however when I want to edit the View, it seems I lose the Search bar I've created and I have to recreate it. Also the search results show up in there, I can't seem to select to show only the search bar.
I want to avoid to have to create the View from scratch again. I hope you can help me.

Is there any documentation that you are following?
No

Is there a similar example that we can see?
No, however I've made a screenshot of what happens when I update the Maps plugin. Please find it in the uploads section.

What is the link to your site?
hidden link
However, I have created a staging site where we can troubleshoot in case it is needed. I can send the login data in a private reply.

#2255323

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

As I understand, you want to only display the "Enter the location" field for the location search and hide the other fields - correct?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2255453

Minesh
Supporter

Languages: English (English )

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

I've added the following custom JS code to "Search Result" page within the view's JS box:
=> hidden link

Screenshot: hidden link

Can you please try to add the following code to your view's JS Box:

jQuery(document).ready(function($){
 
$("div.form-group:contains('Show results within')").html(function() {
     return $(this).html().replace("Show results within", "").replace("of",'');
     
  });
   var places = new google.maps.places.Autocomplete(document.getElementById('toolset-maps-distance-center'));
  
});

Can you please confirm it works as expected.

#2257245

Hello Minesh,
Happy New Year to you!
I tried your custom JS solution, and it looks good until you start using the search functionality. Then it jumps back to the old state. I cleared all browser and server cache before trying.
Here is a screencast link that I made to show you what I mean. hidden link?
Could you have a look at it again, please?
Thank you.
Hacer

#2257267

Minesh
Supporter

Languages: English (English )

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

Can you please check now: hidden link

I've adjusted the code as given under to "Custom JS" section.

jQuery(document).ready(function($){
 
 $("div.form-group:contains('Show results within')").html(function() {
     return $(this).html().replace("Show results within", "").replace("of",'');
     
  });
   var places = new google.maps.places.Autocomplete(document.getElementById('toolset-maps-distance-center'));
});

jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) {
	/**
	* data.view_unique_id (string) The View unique ID hash
	* data.view_changed_form (object) The jQuery object for the View form after being updated
	* data.view_changed_form_additional_forms_only (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-form-view] shortcode
	* data.view_changed_form_additional_forms_full (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-view] shortcode
	*/
  jQuery("div.form-group:contains('Show results within')").html(function() {
     return jQuery(this).html().replace("Show results within", "").replace("of",'');
     
  });
   var places = new google.maps.places.Autocomplete(document.getElementById('toolset-maps-distance-center'));

});
#2257387

Hi Minesh. My issue is resolved with this adjusted custom JS code. Thank you!