Overview

A Paginate object represents a paginated collection of objects of a particular type. Pixfizz Liquid objects often return a Paginate object when requesting a collection, for example user.orders returns a Paginate object representing a paginated collection of Orders, while cart.orderlines returns a paginated collection of Orderline objects.

Most paginations in Pixfizz use a default page size of 20.

The items of the current page can be looped through with a for loop.

Several standard liquid list filters have been extended to work transparently with Pixfizz Paginate objects: first, last, size, map, sort, where.

Use the page and page_size filters to be able to iterate through additional pages or modify the page size.

Properties

paginate.current_page

Returns the number of the current page. This equals 1 (first page) by default.

paginate.current_offset

Returns the offset of the first item on the current page. The is always 0 on the first page. If the page size is 25, the offset on the second page will be 25, on the third page 50, on fourth page 75, etc.

paginate.total_items

Returns the total number of items in the entire collection. Same as paginate.size.

paginate.total_pages

Returns the total number of available pages.

paginate.page_size

Returns the pagination's page size (the number of items on one page).

paginate.first

Returns the first item on the current page.

paginate.last