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. {ProductSet}).

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'
)}

The pagination tools are implemented as a form, with the action attribute assigned the address of the current page.

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

After this, the pagination parameters are printed using the {PaginationFormParameters} tag.

The product list sorting and filtering menus are printed using the {PaginationSort} and {PaginationLimit} tags. The values of the menus are determined based on the values of the sort and limit attributes defined in the product list.

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.

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

before: / after:

With these two attributes, you can define content that is output before or after the content produced by the tag.

Allowed values:text that may contain HTML and Interface markup.

E.g.

  • before: '<p>This markup appears before the tag's own content.</p>'.
  • after: '<p>This appears after the tag's own content.</p>'

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

escape:

Adds escape characters to the content printed by the tag, making it easier to use the content in JavaScript code or JSON objects.

Sallitut arvot:
  • true: the attribute adds escape characters before quotation marks
  • false: the attribute does nothing
  • json: the attribute adds escape characters to the output, allowing the content to be used in JSON markup.
or:

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

Allowed values:text that may contain HTML and Interface markup.

E.g. or:'Content not found.'