search results link like filters

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 dilsecreativo 4 years, 1 month ago.

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #25933
    dilsecreativo
    dilsecreativo
    Participant

    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 results

    note that specialisms is a taxonomy with not public url.

    how I can do this?

    thankyou

    #25937
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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!

    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;
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #25938
    dilsecreativo
    dilsecreativo
    Participant

    I 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 4 years, 1 month ago by dilsecreativo dilsecreativo.
    #25940
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Try $_POST['aspp'] that should be it.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #25941
    dilsecreativo
    dilsecreativo
    Participant
    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=' . $_POST['aspp'];
    	}
    
        return $results;
      
    } 

    still doesn’t work.

    Please help me

    thankyou

    #25942
    dilsecreativo
    dilsecreativo
    Participant

    If you like I can give you access to TeamViewer

    #25947
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I just tried that code on a local server, and it works correctly on my end. The live results all point to that URL.
    Is the URL fully incorrect? Or only the search phrase is missing?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #25952
    dilsecreativo
    dilsecreativo
    Participant

    only 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 example actividades-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 4 years, 1 month ago by dilsecreativo dilsecreativo.
    • This reply was modified 4 years, 1 month ago by dilsecreativo dilsecreativo.
    #25959
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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 :)


    #25960
    dilsecreativo
    dilsecreativo
    Participant

    No, 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

    #25962
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay, 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 :)


    #25963
    dilsecreativo
    dilsecreativo
    Participant

    is on localhost

    Can I please give you access to TeamViewer, please please ?

    • This reply was modified 4 years, 1 month ago by dilsecreativo dilsecreativo.
    #25969
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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 :)


    #25970
    dilsecreativo
    dilsecreativo
    Participant

    ok, 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 slug

    #25976
    dilsecreativo
    dilsecreativo
    Participant
    You cannot access this content.
Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic.