Forums › Forums › Search & Filter Pro › Pagination – not advancing to appropriate page (Beaver Builder)
Tagged: Beaver Builder, pagination, V3
- This topic has 18 replies, 3 voices, and was last updated 4 years, 4 months ago by Ross.
-
Ross Moderator(Private) July 9, 2020 at 10:14 am #252122
Hi Nathan
I’m having a look at the site, and I think the best thing would be to set it back up to a position which we know should work.
I will add, we’ve not tested “Load More” functionality, so we’re not sure if that would work at all..
So, can you setup the page again like at the beginning of this thread, with regular pagination, not working?
Once I solve that, then we can move on to improving this, but I have a feeling that this issue is underlying to all of this.
Thanks
Ross Moderator(Private) July 9, 2020 at 12:48 pm #252188Hi Nathan
Ok I think I can see the issue.
I disabled our BB Extension, and I can see your paged links are coming out like:
http://[redacted-url]/category/graphic-design/paged-2/2/
Usually this would be
paged/2/
I think this
paged-2
is coming from Beaver Builder, and the fact that there are multiple modules on the page, that can be paged? Is there a hidden post list or other BB module on the page, that can have pagination attached to it?Thanks
Anonymous(Private) July 9, 2020 at 2:24 pm #252216Hi Ross,
Yep, looks like you’ve hit the nail on the head! We removed the slider module from above the post grid and now the S&F filters + Load More works well together. We’ve seen an improvement in page performance too.
Many thanks for taking the time to check through this and shed light on the issue.
Anonymous(Private) July 9, 2020 at 3:50 pm #252246Hi Trevor/Ross,
So if I understand it BB is assigning dynamic paged variables based on the number of modules that have paginated content in the themer layout – hence the slider probably used /paged/ and the posts grid module was assigned /paged-2/. We placed the slider below the post grid module and S&F+Load More still worked. So am I right in thinking that S&F is expecting /paged/ and that’s why it won’t work if there’s another paginated module higher up on the page?
Excuse me if this sounds ignorant but is it possible to write a patch or something similar for S&F where we could assign the paging variable name that the module we’re connecting to S&F is likely to have so that S&F can work regardless of hierarchy of paginated modules on a page? In this very example then we would assign /paged-2/ to that S&F form so that the Load More pagination works and retain the original design layout of the page?
Ross Moderator(Private) July 10, 2020 at 12:51 pm #252375Hi Nathan
That would be nice but we don’t have a hook for that.
I would add it in, but we’re working on v3 which will rewrite a lot of underlying code, and properly implements hooks for modifications, so its not something I’m willing to add the current version.
If you wanted to hack it in yourself (there will only be a few minor releases before v3), then you add a check for your paged var in the following file:
search-filter-pro/public/includes/class-search-filter-query.php
Find the function
get_page_no_from_url
, and at the end of the control block you can add an elsif:else if(isset($url_args['paged-2'])) {// $sf_page_no = (int)($url_args['paged-2']); }
So the function would become:
public function get_page_no_from_url($url) { $url = str_replace("&", "&", $url); $url = str_replace("#038;", "&", $url); $url_query = parse_url($url, PHP_URL_QUERY); $url_args = array(); parse_str($url_query, $url_args); $sf_page_no = 0; if(isset($url_args['paged'])) { $sf_page_no = (int)$url_args['paged']; } else if($this->has_url_var($url, "page")) //check to see if this is different for different langs {//try to get page number from permalink url $sf_page_no = (int)$this->get_url_var($url, "page"); } else if($this->last_url_param_is_page_no($url)) //check to see if this is different for different langs {//try to get page number from permalink url $sf_page_no = (int)$this->last_url_param($url); } else if(isset($url_args['product-page'])) {//then its woocommerce product shortcode pagination $sf_page_no = (int)($url_args['product-page']); } else if(isset($url_args['paged-2'])) {// $sf_page_no = (int)($url_args['paged-2']); } else if(isset($url_args['sf_paged'])) { /* sf_paged check needs to be last, because we will always add it on anyway */ $current_page = 1; if(isset($_GET['sf_paged'])) { $current_page = (int)$_GET['sf_paged']; } // little hack to stop appending <code>sf_paged</code> to urls pointing to page 1, where <code>?sf_paged</code> is appended to the current URL (and therefor automatically adding it to all pagination links) // so if the sf_paged value equals the current pages sf_paged value, don't add it to the URL - who wants pagination linking to the current page anyway if($current_page!=(int)$url_args['sf_paged']) { $sf_page_no = (int)$url_args['sf_paged']; } } return $sf_page_no; }
I will put a note to add a filter in for this in v3.
Thanks
Ross Moderator(Private) July 13, 2020 at 10:17 am #252540I’ve been saying a couple of months now for what seems like forever, but the rewrite of S&F free is 90% complete, after that we will finish off the Pro upgrade.
Best
-
AuthorPosts