-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
46 deletions.
There are no files selected for viewing
40 changes: 20 additions & 20 deletions
40
src/Resources/views/storefront/component/pagination.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
{% sw_extends '@Storefront/storefront/component/pagination.html.twig' %} | ||
|
||
{% block component_pagination_nav %} | ||
{% if not (searchResult.criteria.extensions.nostoPagination) %} | ||
{% set currentPage = ((criteria.offset + 1) / criteria.limit )|round(0, 'ceil') %} | ||
{% set totalPages = (entities.total / criteria.limit)|round(0, 'ceil') %} | ||
{% if not context.context.extensions.nostoService.enabled %} | ||
{{ parent() }} | ||
{% else %} | ||
{% set currentPage = ((searchResult.criteria.extensions.nostoPagination.offset + 1) / searchResult.criteria.extensions.nostoPagination.limit )|round(0, 'ceil') %} | ||
{% set totalPages = (searchResult.criteria.extensions.nostoPagination.total / searchResult.criteria.extensions.nostoPagination.limit)|round(0, 'ceil') %} | ||
{% endif %} | ||
{% if not (searchResult.criteria.extensions.nostoPagination) %} | ||
{% set currentPage = ((criteria.offset + 1) / criteria.limit )|round(0, 'ceil') %} | ||
{% set totalPages = (entities.total / criteria.limit)|round(0, 'ceil') %} | ||
{% else %} | ||
{% set currentPage = ((searchResult.criteria.extensions.nostoPagination.offset + 1) / searchResult.criteria.extensions.nostoPagination.limit )|round(0, 'ceil') %} | ||
{% set totalPages = (searchResult.criteria.extensions.nostoPagination.total / searchResult.criteria.extensions.nostoPagination.limit)|round(0, 'ceil') %} | ||
{% endif %} | ||
|
||
{% set paginationSuffix = '' %} | ||
{% if paginationLocation %} | ||
{% set paginationSuffix = '-' ~ paginationLocation %} | ||
{% endif %} | ||
{% set paginationSuffix = '' %} | ||
{% if paginationLocation %} | ||
{% set paginationSuffix = '-' ~ paginationLocation %} | ||
{% endif %} | ||
|
||
{% if totalPages > 1 %} | ||
<nav aria-label="pagination" class="pagination-nav nosto-ns-nav"> | ||
{% block component_pagination %} | ||
{{ parent() }} | ||
{% endblock %} | ||
</nav> | ||
<style> | ||
.nosto-ns-nav { display: none } | ||
.nosto-ns-nav:first-of-type { display: block } | ||
</style> | ||
{% if totalPages > 1 %} | ||
<nav aria-label="pagination" class="pagination-nav"> | ||
{% block component_pagination %} | ||
{{ parent() }} | ||
{% endblock %} | ||
</nav> | ||
{% endif %} | ||
{% endif %} | ||
{% endblock %} |
48 changes: 22 additions & 26 deletions
48
src/Resources/views/storefront/component/product/listing.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
{% sw_extends '@Storefront/storefront/component/product/listing.html.twig' %} | ||
|
||
{% block element_product_listing_wrapper_content %} | ||
{% if not (context.context.extensions.nostoService.enabled) %} | ||
{{ parent() }} | ||
{% else %} | ||
<div class="cms-element-product-listing"> | ||
{% if searchResult.total > 0 %} | ||
{% block element_product_listing_pagination_nav_actions %} | ||
{{ parent() }} | ||
{% endblock %} | ||
{% endif %} | ||
|
||
{% block element_product_listing_row %} | ||
<div class="cms-element-product-listing"> | ||
{% if searchResult.total > 0 %} | ||
{% block element_product_listing_pagination_nav_actions %} | ||
{{ parent() }} | ||
{% endblock %} | ||
{% endif %} | ||
|
||
{% if not (searchResult.criteria.extensions.nostoPagination) %} | ||
{% set paginationTotal = searchResult.total %} | ||
{% set paginationLimit = searchResult.limit %} | ||
{% else %} | ||
{% set paginationTotal = searchResult.criteria.extensions.nostoPagination.total %} | ||
{% set paginationLimit = searchResult.criteria.extensions.nostoPagination.limit %} | ||
{% endif %} | ||
{% block element_product_listing_row %} | ||
{{ parent() }} | ||
{% endblock %} | ||
|
||
{% set totalPages = (paginationTotal / paginationLimit)|round(0, 'ceil') %} | ||
{% if totalPages > 1 %} | ||
{% block element_product_listing_pagination_nav_bottom %} | ||
{{ parent() }} | ||
{% endblock %} | ||
{% endif %} | ||
{% if not (searchResult.criteria.extensions.nostoPagination) %} | ||
{% set paginationTotal = searchResult.total %} | ||
{% set paginationLimit = searchResult.limit %} | ||
{% else %} | ||
{% set paginationTotal = searchResult.criteria.extensions.nostoPagination.total %} | ||
{% set paginationLimit = searchResult.criteria.extensions.nostoPagination.limit %} | ||
{% endif %} | ||
|
||
{% set totalPages = (paginationTotal / paginationLimit)|round(0, 'ceil') %} | ||
{% if totalPages > 1 %} | ||
{% block element_product_listing_pagination_nav_bottom %} | ||
{{ parent() }} | ||
{% endblock %} | ||
</div> | ||
{% endif %} | ||
{% endif %} | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters