Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › search results link like filters
This topic contains 21 replies, has 2 voices, and was last updated by dilsecreativo 3 years, 9 months ago.
- AuthorPosts
- February 22, 2020 at 1:40 pm #25933
Hi,
when I make a search and I click on the result the browser load the home page and filter the results there. But I want to have the results in the same page.what I get now is:
Search for ‘actividades-educativas’ in the page http://localhost/oviedoincluye/directorio/
click on the results
go to http://localhost/oviedoincluye/?specialisms=actividades-educativas
where http://localhost/oviedoincluye/ is the home page.What I want is:
Search for ‘actividades-educativas’ in the page http://localhost/oviedoincluye/directorio/
click on the results
show in the same page http://localhost/oviedoincluye/directorio/?specialisms=actividades-educativas
where http://localhost/oviedoincluye/directorio/ is the page where there are all resultsnote that specialisms is a taxonomy with not public url.
how I can do this?
thankyou
February 23, 2020 at 9:10 am #25937Hi,
You can try thad via a custom hook filter. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
Best,add_filter( 'asp_results', 'asp_change_result_uri', 10, 1 ); function asp_change_result_uri($results) { foreach ( $results as $k => &$r ) { $r->link = 'https://localhost/link/?s=' . $_GET['aspp']; } return $results; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 23, 2020 at 2:28 pm #25938I did this:
add_filter( 'asp_results', 'asp_change_result_uri', 10, 1 ); function asp_change_result_uri($results) { foreach ( $results as $k => &$r ) { $r->link = 'http://localhost/oviedoincluye/directorio/?specialisms=' . $_GET['aspp']; } return $results; }
and now the url is http://localhost/oviedoincluye/directorio/?specialisms= but the $_GET[‘aspp’] does not work.
Should I replace the $_GET[‘aspp’] with something else? The short code of that search form is [wd_asp id=6].
thankyou
-
This reply was modified 3 years, 9 months ago by
dilsecreativo.
February 23, 2020 at 3:44 pm #25940Try
Best,$_POST['aspp']
that should be it.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 23, 2020 at 3:57 pm #25941add_filter( 'asp_results', 'asp_change_result_uri', 10, 1 ); function asp_change_result_uri($results) { foreach ( $results as $k => &$r ) { $r->link = 'http://localhost/oviedoincluye/directorio/?specialisms=' . $_POST['aspp']; } return $results; }
still doesn’t work.
Please help me
thankyou
February 23, 2020 at 4:01 pm #25942If you like I can give you access to TeamViewer
February 24, 2020 at 9:22 am #25947Hi,
I just tried that code on a local server, and it works correctly on my end. The live results all point to that URL.
Best,
Is the URL fully incorrect? Or only the search phrase is missing?
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 24, 2020 at 12:56 pm #25952only the search phrase is missing.
When I click on the live result it thake me to
http://localhost/oviedoincluye/directorio/?specialisms=
wich is fine but is missed the last part of the url
for exampleactividades-educativas
.this is an example of what I really get inspecting that section:
<div class="resdrg"><div class="item asp_r_term asp_r_term_103 asp_r_specialisms asp_an_fadeInDown"> <div class="asp_content"> <h3><a class="asp_res_url" href="http://localhost/oviedoincluye/directorio/?specialisms="> Actividades educativas (0) <span class="overlap"></span> </a></h3> <div class="etc"> </div> <div class="asp_res_text"> </div> </div> <div class="clear"></div> </div><div class="item asp_r_term asp_r_term_104 asp_r_specialisms asp_an_fadeInDown"> <div class="asp_content"> <h3><a class="asp_res_url" href="http://localhost/oviedoincluye/directorio/?specialisms="> Actividades educativas y de sensibilización medioambiental (0) <span class="overlap"></span> </a></h3> <div class="etc"> </div> <div class="asp_res_text"> </div> </div> <div class="clear"></div> </div><div class="item asp_r_term asp_r_term_54 asp_r_specialisms asp_an_fadeInDown"> <div class="asp_content"> <h3><a class="asp_res_url" href="http://localhost/oviedoincluye/directorio/?specialisms="> Albañilería y revestimientos (0) <span class="overlap"></span> </a></h3> <div class="etc"> </div> <div class="asp_res_text"> </div> </div> <div class="clear"></div> </div><div class="item asp_r_term asp_r_term_61 asp_r_specialisms asp_an_fadeInDown"> <div class="asp_content"> <h3><a class="asp_res_url" href="http://localhost/oviedoincluye/directorio/?specialisms="> Aparatos sanitarios (0) <span class="overlap"></span> </a></h3> <div class="etc"> </div> <div class="asp_res_text"> </div> </div>
How I can fix this
-
This reply was modified 3 years, 9 months ago by
dilsecreativo.
-
This reply was modified 3 years, 9 months ago by
dilsecreativo.
February 24, 2020 at 2:23 pm #25959Hi,
Try this variation then:
add_filter( 'asp_results', 'asp_change_result_uri', 10, 4 ); function asp_change_result_uri($results, $search_id, $is_ajax, $args) { foreach ( $results as $k => &$r ) { $r->link = 'http://localhost/oviedoincluye/directorio/?specialisms=' . $args['s']; } return $results; }
The phrase must be there this time, as these are the actual arguments passed.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 24, 2020 at 2:30 pm #25960No, still not working. I get the same problem of before. the link is ok but the phrase is not there.
What we can do to fix this?
Thankyou
February 24, 2020 at 2:41 pm #25962Okay, I have no idea what is happening here. I tested these codes on multiple environments and it is working as it should. I think I am missunderstanding something here.
Let me know if you have an online test environment where I could check this on.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 24, 2020 at 2:43 pm #25963is on localhost
Can I please give you access to TeamViewer, please please ?
-
This reply was modified 3 years, 9 months ago by
dilsecreativo.
February 24, 2020 at 3:58 pm #25969Hi,
Unfortunately I cannot do that, I am sorry. Let me know if it is available online somewhere, I am more than happy to take a look.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 24, 2020 at 4:08 pm #25970ok, just realised that if i start typing the link get updated with what I am typing.
but I don’t want this. I want that if I click on a dropdown result it goes to that result slugFebruary 24, 2020 at 4:37 pm #25976You cannot access this content. -
This reply was modified 3 years, 9 months ago by
- AuthorPosts
You must be logged in to reply to this topic.