Forums › Forums › Search & Filter Pro › Broken "next page" links (sometimes)
- This topic has 15 replies, 3 voices, and was last updated 9 years, 5 months ago by Ross.
-
Anonymous(Private) March 17, 2015 at 5:52 am #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:
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,
GregRoss Moderator(Private) March 17, 2015 at 4:52 pm #13595Hi 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 thishttp://www.calvaryem.org/wp-admin/admin-ajax.php
as your url, and add on the relevant paging info to the links (iehttp://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(Private) March 17, 2015 at 8:49 pm #13603Thanks 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:
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(Private) March 17, 2015 at 10:02 pm #13606Not 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(Private) March 17, 2015 at 11:08 pm #13610Okay, 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(Private) March 18, 2015 at 12:18 am #13611Its 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:
Thanks
Anonymous(Private) March 18, 2015 at 8:21 am #13623Hi 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(Private) March 23, 2015 at 8:23 am #13831Hey 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(Private) March 24, 2015 at 7:24 pm #13948Hi 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 -
AuthorPosts