Jump to content

Pagination and filter pages with pages->find doesnt work properly


Juergen
 Share

Recommended Posts

Hello @ all,

I have created a product page where customers can filter products depending on various attributes.

post-2257-0-54080400-1457286273_thumb.jp

I dont want to show all product matches on one page so I use a pagination to split it.

post-2257-0-11110100-1457286334_thumb.jp

So far so good - everything works as expected.

The problem starts when I press the pagination button to see the next page (fe page 2). Then all products will be shown instead of the selected ones.

post-2257-0-85142800-1457286448_thumb.jp

As you can see: The pagination shows all pages

Here are some code examples:

        // Get all products matching the filter criteria
        $p             = $pages->find("template=products$productkindselect$offerkindselect, limit=$itemnumber");
        
        $resultcounter = count($p);
        if ($resultcounter > 0) {
            //loop through each item
            foreach ($p as $child) {
                //Output the children fe $child->title;
            }
        } 

The code for the pagination

    $results = $p;
    echo $results->renderPager(array(
        'currentItemClass' => "active",
        'nextItemLabel' => "<span class='fa fa-angle-double-right'></span>",
        'previousItemLabel' => "<span class='fa fa-angle-double-left'></span>",
        'listMarkup' => "<nav><ul class='pagination'>{out}</ul></nav>",
        'itemMarkup' => "<li class='{class}'>{out}</li>",
        'linkMarkup' => "<a href='{url}'><span>{out}</span></a>"
    ));
    $pagination = $results->renderPager();

Has anyone tried to use a pagination with a filter an has a working solution?

best regards

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...