unexpected search results behaviors/display

Home Forums Product Support Forums Ajax Search Pro for WordPress Support unexpected search results behaviors/display

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

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #24908
    brentpruitt71
    brentpruitt71
    Participant

    Hello!

    I am currently setting up the ASP plugin on the Harsch website. I need a resolution to complete this for the issues outlined below. We are using the Avada theme on WP v5.2.4. Login will be required to view the site.

    The home page has a form named Home Settings Search [ id=11 ]

    Currently, the settings hide the keyword field and live results, and open in the same tab to the WP search results page to a custom url [ /search/{phrase} ] instead of [ ?s={phrase} ].

    Issues
    There are several problems that I’ve run into with this setup:

    1. results do not open the custom url on submission
    2. results do not appear on the search results page
    3. if navigating to the search page, with a variable in the url [ /search/any/ ], no results appear.

    Ideally, we would like to keep the form [ id=11 ] on the home page and on the results page use the form that appears on the properties page [ id=3 ].

    However, when I add the form [ id=3 ] to the search results page:

    1. the form [ id=3 ] is not pre-populated with the variables submitted by the home page form [ id=11 ]
    2. form [ id=3 ] does not filter the selected items from the home page form submission [ all items are shown, which is the default behavior for the properties form [ id=3 ]

    Additionally, submitting the Search Bar form [ id=4 ] from the header shows no results when using the home page form [ id=11 ] on the results page.

    If I use the properties form [ id=3 ] on the results page, the search bar performs as configured for the properties page and not the configuration for the Search Bar [ id=4 ]. The Search Bar [ id=4 ] form is configured with additional sources that are not included on the results page.

    Resolutions
    I’d like to know what needs to be done to achieve the ideal setup — pre-populating the form with the submission variables and showing the filtered results.

    Or have the results appear using the home page form [ id= 11 ]. I do see results within the code, however I don’t know how to trigger those to view to verify that the results are filtered correctly.

    The properties page form works wonderfully, btw.

    I’m attaching screenshots of the settings for the home page form [ id=11 ].

    I look forward to hearing back. Thanks in advance!

    Brent

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

    Hi!

    Thank you very much for all the details, it helps a lot.

    Looking at the search page changes via the theme editor, I think you are trying to make the plugin print the results in it’s own container – which won’t work unfortunately, because that is only for the live results.

    However, there is a way to trigger the search via a custom URL, that might work in this case. Basically, if you were to programatically set these variables, the search will trigger an auto populate with the given phrase. 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_action('init', 'asp_add_query_vars_for_auto_trigger');
    function asp_add_query_vars_for_auto_trigger() {
    	if ( isset($_GET['s']) ) {
    		$_GET['asp_s'] = $_GET['s'];
    		$_GET['asp_id'] = 11;
    	}
    }

    However there is an issue I see, that the search “s” query variable is not set correclty. I tried to do a var_dump() via the editor, but it was always empty. Have you added a correct mod_rewrite rule to the .htaccess file when you changed the search URL?
    Because without that, wordpress will only redirect, but never set the $_GET variables properly, and the code above will never work.

    Also, changing the filter values from one search instances to another is not possible unfortunately. The reason being, that there is a possibility of conflict when one search instances uses completely different filter types from the other – causing completely incorrect values printed.

    Best,
    Ernest Marcinko

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


    #24998
    brentpruitt71
    brentpruitt71
    Participant
    You cannot access this content.
    #25113
    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 :)


    #25122
    brentpruitt71
    brentpruitt71
    Participant
    You cannot access this content.
    #25125
    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 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.