How to get all items after Zend Paginator ends

692 Views Asked by At

I have built a Zend Paginator in my indexController. On the frontend there are listed the categories 20 per page but I also have a dropdown that has to list all main categories. Is there a way to use the same query? This is what I have tried so far:

$query = $categories->select()
        ->where($status)
        ->where($sq)
        ->order($this->view->sortoptions->by . ' ' . $this->view->sortoptions->order);


    $this->view->categories = $categories->paginate($query->where($cat), $this->view->LayoutSettings->pagination->itemsperpage , $page);
    $this->view->categoriesall = $categories->fetchAll($query->where("parent = 0")); // we get this for the categories listing in the dropdown

** $status and $sq are filtering parameter (eg. parent = 0)

1

There are 1 best solutions below

0
Borislav Sabev On

You will have to execute the query since zend paginator will not fetch all records - it will rather fetch $itemsperpage number of records at a time!