• Hello, I have a problem with pagination. The parameter in the URL changes, but the search results stay the same.
    The site uses filters from FacetWP, and judging by the parameter in the URL, it is FacetWP that affects pagination.
    I also noticed that the settings “maximum number of products” and “number of products per page” do not work correctly.
    Max quantity = 48, products per page = 12, and displays 48 products and 4 pagination pages.
    ===
    Добрый день, у меня проблема с пагинацией. Параметр в URL меняется, но результаты поиска остаются такими же.
    На сайте используются фильтры от FacetWP, и судя по параметру в URL именно FacetWP влияет на пагинацию.
    Также заметил, что настройка “максимального количество товаров” и “количество товаров на страницу” работают некорректно.
    Максимальное количество = 48, товаров на страницу = 12, а выводит 48 товаров и 4 страницы пагинации.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    Looks like I found the reason for this issue. I will fix it in the next plugin version.

    If you don’t want to wait – you can fix it right now by making some changes in the plugins source code. Please open file advanced-woo-search/includes/modules/class-aws-facetwp.php, find lines

    $search_res = AWS_Search_Page::factory()->search( $obj->query, $obj->query_args['posts_per_page'], $obj->query_args['paged'] );
    

    and replace it with

    global $wp_query;
    $posts_per_page = $obj && $obj->query_args && isset( $obj->query_args['posts_per_page'] ) ? $obj->query_args['posts_per_page'] : $wp_query->query_vars['posts_per_page'];
                    $paged = $obj && $obj->query_args && isset( $obj->query_args['paged'] ) ? $obj->query_args['paged'] : $wp_query->query_vars['paged'];
                    $search_res = AWS_Search_Page::factory()->search( $obj->query, $posts_per_page, $paged );
    

    Regards

    Thread Starter dipokemon

    (@dipokemon)

    @mihail-barinov, The number of displayed items is now working correctly, thank you very much. But the problem with pagination, unfortunately remained.

    • This reply was modified 1 year, 7 months ago by dipokemon.
    • This reply was modified 1 year, 7 months ago by dipokemon.

    @mihail-barinov I ran into this same problem but found that all pages were returning page 1’s results. With FacetWP’s AJAX filtering you need to account for $_GET['_paged'] .

    I changed the third line of your solution to this:

    if( isset( $_GET['_paged'] ) ){
                        $paged = intval( $_GET['_paged'] );
                    } else {
                        $paged = $obj && $obj->query_args && isset( $obj->query_args['paged'] ) ? $obj->query_args['paged'] : $wp_query->query_vars['paged'];
                    }

    This means the full code becomes the following:

    global $wp_query;
                    $posts_per_page = $obj && $obj->query_args && isset( $obj->query_args['posts_per_page'] ) ? $obj->query_args['posts_per_page'] : $wp_query->query_vars['posts_per_page'];
                    if( isset( $_GET['_paged'] ) ){
                        $paged = intval( $_GET['_paged'] );
                    } else {
                        $paged = $obj && $obj->query_args && isset( $obj->query_args['paged'] ) ? $obj->query_args['paged'] : $wp_query->query_vars['paged'];
                    }
                    $search_res = AWS_Search_Page::factory()->search( $obj->query, $posts_per_page, $paged );
    Thread Starter dipokemon

    (@dipokemon)

    @d2roth, Unfortunately it didn’t help. But I noticed that my FacetWP filters and pagination don’t work when using Query = Latest Products, I haven’t been able to find a solution to this problem yet, can you advise something.
    The question is a little off topic.

    @dipokemon Are you using Elementor Pro?

    Thread Starter dipokemon

    (@dipokemon)

    @d2roth Yes, I am using elementor pro

    For reference I am testing with the following plugin versions:

    • Elementor: 3.12.2
    • Elementor Pro: 3.12.2
    • FacetWP: 4.1.8
    • FacetWP – Elementor: 1.7
    • Advanced Woo Search PRO: 2.77

    @dipokemon I found the previous solution didn’t fix the full issue. It seems like the pagination parameters are stored in $obj->ajax_params. Inside /wp-content/plugins/advanced-woo-search-pro/includes/modules/class-aws-facetwp.php about line 66 I have:

    $paged = $obj && $obj->query_args && isset( $obj->query_args['paged'] ) ? $obj->query_args['paged'] : $wp_query->query_vars['paged'];

    Changing that to the following (query_args to ajax_params) is fixing prev/next pagination since $obj->query_args is null in my tests:

    $paged = $obj && $obj->ajax_params && isset( $obj->ajax_params['paged'] ) ? $obj->ajax_params['paged'] : $wp_query->query_vars['paged'];

    Does that change anything for you?

    Also, Facet’s filters don’t change the resulting page items when using AWS. It seems to spit out the full product information without the filtering being applied. Are you seeing similar results?

    Thread Starter dipokemon

    (@dipokemon)

    @d2roth Sorry for the long answer. Instead of the usual pagination that is used in the elementor, I began to use the pagination from FacetWP and everything works as it should.

    Plugin Author ILLID

    (@mihail-barinov)

    Should be fixed starting from plugin version 2.79.

    @dipokemon what versions are you using? FacetWP’s pagination doesn’t change pages when we have done a search and filter even using Advanced Woo Search 2.79.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Pagination not work’ is closed to new replies.