Forums Forums Search & Filter Pro Broken "next page" links (sometimes)

Viewing 10 posts - 1 through 10 (of 16 total)
  • Anonymous
    #13549

    Hi Ross,

    We’ve recently run across an issue that stumped me. Our website that uses SF is here:

    http://www.calvaryem.org/media/sermons-archive/

    It seems that SOMETIMES (but not all the time!) when we use SF to filter by category, the nagivation links (1, 2, Next Page) will become invalid. It seems to happen about half the time.

    The steps to reproduce are:
    1. filter by series with enough entries to require next page, and
    2. hover over one of the navigation links. About 50% of the time, the link will be invalid (and will be fixed on refresh). If not, try filtering by another category and try again. It WILL trigger after a few tries.

    Here’s an example of a bad link that sometimes is created:

    http://www.calvaryem.org/wp-admin/admin-ajax.php?action=get_results&sfid=2171&_sft_ctc_sermon_book=ephesians#038;sfid=2171&_sft_ctc_sermon_book=ephesians&paged=2

    Note the “wp-admin/admin-ajax.php?” string, which clearly should not belong …

    …and here’s an example of what a working link SHOULD look like:

    http://www.calvaryem.org/media/sermons-archive/results/page/2/?_sft_ctc_sermon_book=ephesians

    I notice that the “?_sft_ctc_sermon_book=ephesians” portion is the same, but the rest is different.

    Any idea what might be going on?

    Thank you,
    Greg

    Ross Moderator
    #13595

    Hi Greg

    This is completely normal if you are using ajax – does it ever interfere with your actual results – or does it seem to we working fine?

    Basically, when using ajax, your results are loaded via

    wp-admin/admin-ajax.php

    When running any pagination function from admin-ajax.php, it will use this http://www.calvaryem.org/wp-admin/admin-ajax.php as your url, and add on the relevant paging info to the links (ie http://www.calvaryem.org/wp-admin/admin-ajax.php?paged=2)

    To the plugin this does not matter – when you click your pagination, the plugin reads everything after http://www.calvaryem.org/wp-admin/admin-ajax.php – and performs the next page load correctly.

    When you are not using ajax, pagination functions are called from within the regular part of your site, so you will get your “correct” pagination links.

    You will also observe, that when you first load a search results screen (after a page refresh) the pagination is correct, but after subsequent ajax requests, the pagination links will contain admin-ajax.php

    If its not producing incorrect results then its nothing to worry about, and for now, intended behaviour.

    Thanks

    Anonymous
    #13603

    Thanks so much for the reply, Ross! Yep, you’ve described the correct behavior ๐Ÿ™‚ What a relief that its normal!

    The problem is that the search results page loads without using the custom template. See the following, for example:

    link

    I compared the output with the expected output, and it seems the problem is that SF is not using the custom results URL that I am feeding it (in Edit Search Form->Display Results -> Results URL) when ajax is being used.

    Any reason you can think of that this might be the case?

    Ross Moderator
    #13606

    Not sure, the link you just provided certainly is using a customised version of the template…? It just won’t have any styling applied to it until it is placed within a page on your site.

    Could duplicate the form, give it a new URL and new page, enable ajax and show me what is different between the ajax / non ajax versions?

    Thanks

    Anonymous
    #13610

    Okay, thanks, I’ll do as you ask tonight .. I’ll have to do this on the dev site.

    BTW, you mentioned it won’t have any styling until it is placed on a page in my site. I’m wondering if I just did something stupid and forgot to put it in. Is it simply putting the shortcode into a results page on the site, or am I missing a step?

    Ross Moderator
    #13611

    Its fine, you just need to place the results shortcode in a regular WP page – and then update the Results URL to reflect the url of this page..

    To keep things simple, place both the regular shortcode for the search form, and the results shortcode in the same page as per the instructions here:

    http://www.designsandcode.com/wordpress-plugins/search-filter-pro/docs/display-your-search-form/with-a-shortcode/

    Thanks

    Anonymous
    #13623

    Hi Ross,

    Thanks! I took a look at the tutorial, and indeed my setup does follow these steps.

    I did as you asked and set up a non-ajax link here:

    http://www3.calvaryem.org/media/sermons-archive/results/page/2/?_sfm_is_this_a_sunday_school=0

    The filter seems to work fine without ajax…but comparing the source code of both, it seems like the header is all missing, which says to me that the custom results.php is indeed being used, but the custom results URL is not.

    I checked both the URL in the SF menu, as well as the shortcode in my results page, and both are correct (used copy/paste to set both, so can’t be any errors).

    Any ideas? Maybe the shortcode for some reason isn’t working?

    Ross Moderator
    #13831

    Hey Gregory

    I’m not sure what you mean about header being missing, can you be specific? When I use that search it seems fine – the page reloads, you keep the header & footer of your site – everything looks normal (to me).

    Thanks

    Anonymous
    #13948

    Hi Ross,

    Sorry, I think the thread got too confusing ๐Ÿ™‚

    Here’s a quick recap:

    We’re having problems with the code when using AJAX. It doesn’t seem to use the right custom URL. It DOES generate the correct resutls, but does not embed them in the custom URL. Here’s an original (broken) result:

    You then asked me to turn off ajax so that you could see what the “correct” template looks like. Turning off Ajax, there seems to be no problems, and that was what you saw in the last link.

    So, the situation is this: we could turn off ajax and have it work I suppose, but I guess I was trying to see if you had any idea why it wasn’t working with ajax for some reason…because Ajax is really nice ๐Ÿ™‚

    Does this make sense?

    Thanks,
    greg

    Anonymous
    #14225

    Hey ross,

    Just wondering if this issue is still on your radar?

    If you can’t think of any solutions, I’ll just have to turn off Ajax I guess.

    Thanks,
    Greg

Viewing 10 posts - 1 through 10 (of 16 total)