Search Results Page

This topic contains 8 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years, 11 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #19638
    kwilson
    kwilson
    Participant

    I want to replace the default search results with ASP. The search form works fine and delivers page suggestions. When you click on the More Results button, it takes you to the results page but shows results from the WP internal search engine.

    I read the documentation for customizing the results, and it says the page will have access to $r and $s_options in PHP. But the GET call only adds the following data to the URL (“outcome” is the entered search term): s=outcome&asp_active=1&p_asid=1&p_asp_data=Y3VycmVudF9wYWdlX2lkPTkmcXRyYW5zbGF0ZV9sYW5nPTAmYXNwX2dlbiU1QiU1RD10aXRsZSZhc3BfZ2VuJTVCJTVEPWNvbnRlbnQmYXNwX2dlbiU1QiU1RD1leGNlcnB0JmN1c3RvbXNldCU1QiU1RD1yZXNvdXJjZSZjdXN0b21zZXQlNUIlNUQ9cG9zdCZjdXN0b21zZXQlNUIlNUQ9bGVhZGVyc2hpcCZjdXN0b21zZXQlNUIlNUQ9bmV3c3JlbGVhc2UmY3VzdG9tc2V0JTVCJTVEPWJsb2dwb3N0.

    Our current search page has been modified from the basic WP search template. I have attached the search.php file we are using.

    How are the $r and $s_options being passed to the results page? In other words, how do I access these variables to use them in my template?

    #19639
    kwilson
    kwilson
    Participant

    Here is the search.php in zip format.

    Attachments:
    You must be logged in to view attached files.
    #19686
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I’m very sorry about the delay, I missed your ticket by accident.

    The results page usually does not contain those variables, as the results page handler opens a new output buffer, where these get reset/unset. However it is possible to obtain the options via the$_GET[‘p_asp_data’] variable, that is passed through the request, with this custom code:

    After this the $s_options should contain the options from the form.

    The $r variable is basically each result passed to the results page, in this case it’s equivalent is the $post within the results loop.
    If you want to access which results the plugin passed to the reqults page, you can do it by accessing the query on the beginning of the file (before any query changes), like so:

    Then the $results variable should contain the results passed to this page.

    Please note, that this sort-of qualifies as a modification request, so I cannot guarantee that my suggestions will work in all cases. I still try my best to help you out though.

    Best,
    Ernest Marcinko

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


    #19687
    kwilson
    kwilson
    Participant

    Thanks. I’ll give this a try and let you know how it works out.

    #19696
    kwilson
    kwilson
    Participant

    This worked beautifully. The query results didn’t contain the description because we are using Advanced Custom Fields, but I was able to retrieve that information using the asp_id from the object the query returned.

    #19697
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


    #19698
    kwilson
    kwilson
    Participant

    Give me time to send one more reply in a few hours. I have something I want to send as a thank-you.

    #19699
    kwilson
    kwilson
    Participant
    You cannot access this content.
    #19701
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.