Error in user YAML: (<unknown>): found character that cannot start any token while scanning for the next token at line 5 column 16
---
title: Refactor pagination templates and paging of the search result
issue: NEXT-32337
author: Max
author_email: max@swk-web.com
author_github: @aragon999
---
- Changed return type of
Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult::getPage
from?int
toint
as the page is always computed
- Deprecated
Shopware\Storefront\Framework\Page\StorefrontSearchResult
for Shopware v6.7.0 - Changed template
@Storefront/storefront/component/pagination.html.twig
to use the already computed values of theEntitySearchResult
and remove the variabletotalEntities
for the next major version v6.7.0, usetotalPages
instead, if you want to specify a custom current page you can now pass the variablecurrentPage
- Changed template
@Storefront/storefront/component/product/listing.html.twig
to use the already computed value forcurrentPage
of thesearchResult
and adapt to changes for the pagination for the next major version v6.7.0 - Changed
@Storefront/storefront/component/review/review.html.twig
and use variable for thereviewsPerPage
instead of a magic number and adapt to changes for the pagination for the next major version v6.7.0 - Changed
@Storefront/storefront/page/product-detail/review/review.html.twig
to adapt to changes for the pagination for the next major version v6.7.0 - Changed
@Storefront/storefront/page/account/order-history/index.html.twig
to use the already computed value of thetotalPages
of the orders search result and adapt to changes for the pagination for the next major version v6.7.0
The class Shopware\Storefront\Framework\Page\StorefrontSearchResult
will be removed without replacement, since all functionality should be contained in the parent class Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult
. The sorting was not in active use in Shopware, so if that is needed it should be added as extension to the EntitySearchResult
.
- The template
@Storefront/storefront/component/pagination.html.twig
with a custom number of entries cannot be used with thetotal
variable, instead passtotalPages
. Additionally it is now possible to pass the variablecurrentPage
to the pagination template. Furthermore thecriteria
variable cannot be used inside thepagination.html.twig
template.
{% sw_include '@Storefront/storefront/component/pagination.html.twig' with {
entities: searchResult,
criteria: searchResult.criteria,
total: myCustomTotalNumber,
} %}
{% sw_include '@Storefront/storefront/component/pagination.html.twig' with {
entities: searchResult,
totalPages: (myCustomTotalNumber / myCustomLimit)|round(0, 'ceil'),
} %}