Skip Navigation

[Resuelto] Force a specific search result via URL parameters

This support ticket is created hace 6 años, 10 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 9 respuestas, has 2 mensajes.

Last updated by Craig hace 6 años, 10 meses.

Assisted by: Minesh.

Autor
Mensajes
#534393

I am trying to force a specific search result by using a specific URL which is generated programmatically, it seems to be working to a fashion, however the results are not showing on the resulting page, even though the URL seems to be triggering the correct result (based on the chosen item in the Select menu).

This is the URL with paramaters I am using – hidden link

I expected to see: What you get when you select 'Melrose' from the Select menu on this page –
hidden link

Instead, I got: I see a flash of the correct results, but they are then hidden again, so cannot see them on the front end, although they are there in the code.

Hope that makes sense.

Kind regards,
Craig

#534590

Minesh
Supporter

Languages: Inglés (English )

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

Hello. Thank you for contacting the Toolset support.

Could you please share full page screenshot of your edit view? I would like to review your view's settings first.

#534600
View - Search Car Parking results.jpg

Hi Minesh,

as requested, here is the View screengrab. Please let me know if you require further info.

Kind regards,
Craig

#534603
View-Search-Officers.jpg

Hi Minesh,

Here is a screen grab of the View used to display the Officer results.

Kind regards,
Craig

#534617

Minesh
Supporter

Languages: Inglés (English )

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

I think I have a way to fix it but I need to check on your install first.

*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

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

#534635

Minesh
Supporter

Languages: Inglés (English )

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

I've added following code to your view's Filter sections JS box:

jQuery(document).ready(function($){
  $.urlParam = function(name){
    var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
    if (results==null){
       return null;
    }
    else{
       return decodeURI(results[1]) || 0;
    }
}
 param =  $.urlParam('wpv-town-or-village'); 
  $('.js-wpv-filter-trigger').val(param).trigger('change');
});

I can see that now it's displaying the correct results.

#534642

Hi Minesh,

That is awesome, thank you very much.

Note to self: I really must learn jQuery!

Awesome support, thank you ????

#534656

Hi Minesh,

Sorry, there is still a slight problem with the hidden link page.

If you go to that page directly, it shows all of the Housing Officers by default, whereas it should show none until a choice is made from the select menu (which is how it worked before).

Kind regards,
Craig

#534659

Minesh
Supporter

Languages: Inglés (English )

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

Ok - I modified the code a bit as given under and now I can see its not displaying the results.

param =  $.urlParam('wpv-town-or-village'); 
  if(!!param){
  		$('.js-wpv-filter-trigger').val(param).trigger('change');
  }
#534660

Hi Minesh,

That is indeed awesome sir, thank you for fixing that.

Kind regards,
Craig

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.