Forums Forums Search & Filter Pro conditional search results

Viewing 6 posts - 1 through 6 (of 6 total)
  • Trevor
    #101424

    Yes. But the code may be complex. As long as you have access to the php page template for the results page, you can use the sf_query array to find the value and use that to conditionally show what you want by echoing HTML to the page.

    This thread discusses the technique for accessing the data:

    https://support.searchandfilter.com/forums/topic/results-displayed-results-count-searched-tag-associated-categories/

    Anonymous
    #101540

    Hi Trevor, thanks for your reply, I am a little confused though – I’m finding hard to decypher the code from your link and apply it to my case…

    website.co.uk/?sfid=132396&_sfm_department=14

    Would be my search string, this searches a particular ‘department’, I would like to show div based on this department.

    so my code would be somthing like:

    if url = ?sfid=132396&_sfm_department=14

    echo : “<div>welcome to department 14</div>”

    I have found a way to do this with jQuery, the only issue I have with this method though is it looks for a particular url so if I wanted to show for: ?sfid=132396&_sfm_department=1 dpartment 1’s div, it would also show for ?sfid=132396&_sfm_department=11, ?sfid=132396&_sfm_department=12 etc etc as it contains ?sfid=132396&_sfm_department=1

    Trevor
    #101543

    You could simply make 3 if statements in a row?

    Anonymous
    #101545

    Hi, I found a better code for triggering the jquery to kick in on the url so its working for 1, 11, 12 differently which is great.

    My only issue now is that I can’t execute php code within the jQuery which is why I wanted to do it on the search results page rather than through javascript. What I actually want to hide/show is featured posts dependant on the department searched for. It would be great if I can do this on the search reults template instead of achieving it through jQuery.

    : )

    Dann

    Trevor
    #101558
    This reply has been marked as private.
    Anonymous
    #101611

    Thanks for the Skype support Trevor! All sorted and running exactly the way I need it to.

Viewing 6 posts - 1 through 6 (of 6 total)