Prints pagination buttons for product lists.

Kuvaus

Pagination buttons contain the following:

  • Next/previous buttons
  • Page buttons that enable direct access to the selected page

The number of visible page buttons can be defined by using the items attribute.

Pagination tools can be implemented with the <form> element with the action="{CurrentURL}" and method="GET" attributes.

Syntaksi

{PaginationPages(
    items: int
)}

Näkyvyys

This tag is always used in connection with product list tags (e.g. {Products}).

Implementing pagination tools for product lists

In the example below, we discuss the implementation of pagination tools in MyCashflow's default theme.

{Products(
    pagination: true,
    classes: 'first||',
    limit: '30|15|60|90',
    sort: 'manual|name_asc|released_desc|price_asc',
    before: '
        <form action="{CurrentUrl}" method="get" id="PaginationSortForm">
            {PaginationStatus}
            <div class="FormItem GroupItem">
                {PaginationFormParameters(
                    name: 'keyword'
                )}
                <div>
                    {PaginationSort}
                </div>
                <div>
                    {PaginationLimit}
                </div>
                <div>
                    <button type="submit">{%Send}</button
                </div>
            </div>
        </form>
    ',
    after: '{PaginationPages(items: 7)}',
    helper: 'helpers/listproduct'
)}

Pagination tools are implemented as a form with the relevant page's address as its action attribute.

First, the pagination status is printed (which page the user is currently visiting) by using the {PaginationStatus} tag.

Next, pagination parameters, i.e. ... , are printed by using the {PaginationFormParameters} tag.

The menus for sorting and filtering the product list are printed by using the {PaginationSort} and {PaginationLimit} tags. The values available in the menus are based on the sort and limit attributes' values.

Attribuutit

items:

Defines the number of page buttons to display. The same number of buttons is displayed in both directions from the selected page.

Allowed values: integers.

The default value is 9. The default value must be equal to or greater than 7.

after/before:

By using the after and before attributes you can define content that is output either after or before the tag's output.

Allowed values:HTML and Interface markup.

E.g.

  • before: '<p>Tämä merkkaus näkyy ennen tagin omaa sisältöä.</p>'
  • after: '<p>Tämä taas näkyy tagin oman sisällön jälkeen.</p>'

If the tag does not produce any content, neither the content of the after and before attributes will be output.

escape:

Adds an escape character before quotation marks in the output.

The attribute makes it easier to process the tag-produced content when using JavaScript.

Allowed values:true/false. The default value is false.

or:

Defines alternative content that is displayed if the tag itself does not produce any content.

Allowed values:HTML and Interface markup.

E.g. or:'Sisältöä ei löytynyt.'