templates/default/components/molecules/pagination/pagination.html.twig line 1

Open in your IDE?
  1. {% if (paginationPosition == 'top' and pagination.currentPage > 1) or (paginationPosition == 'bottom' and pagination.totalPages > pagination.currentPage) %}
  2. <div class="pagination">
  3. {% if paginationPosition == 'top' %}
  4. {% if pagination.currentPage > startPage %}
  5. {% set page = (startPage - 1) %}
  6. {% else %}
  7. {% set page = (pagination.currentPage - 1) %}
  8. {% endif %}
  9. {% set buttonText = 'pagination_more_before_text'|trans %}
  10. {% else %}
  11. {% if pagination.currentPage < startPage %}
  12. {% set page = (startPage + 1) %}
  13. {% else %}
  14. {% set page = (pagination.currentPage + 1) %}
  15. {% endif %}
  16. {% set buttonText = 'pagination_more_text'|trans %}
  17. {% endif %}
  18. {% if( dataPath is defined) %}
  19. {%if current_sorting is defined and current_sorting is not null %}
  20. {% set path = path(dataPath, {'page': page, 'q': searchText, 'startPage': startPage, 'sort[field]':current_sorting.field, 'sort[order]': current_sorting.order}) %}
  21. {%else%}
  22. {% set path = path(dataPath, {'page': page, 'q': searchText, 'startPage': startPage}) %}
  23. {%endif%}
  24. {% else %}
  25. {%if current_sorting is defined and current_sorting is not null %}
  26. {% set path = path('app_catalog_get_more_products', {'categoryId': category.id, 'page': page, 'startPage': startPage, 'sort[field]':current_sorting.field, 'sort[order]': current_sorting.order}) %}
  27. {%else%}
  28. {% set path = path('app_catalog_get_more_products', {'categoryId': category.id, 'page': page, 'startPage': startPage}) %}
  29. {%endif%}
  30. {% endif %}
  31. {% include('components/atoms/text-link/text-link.html.twig') with {
  32. 'href': '?page=' ~ page,
  33. 'text': buttonText,
  34. 'class': 'button button--multitool button--width-auto js-pagination',
  35. 'attributes': {
  36. 'data-pagination-ajax-url': path,
  37. 'data-product-grid-inner': '.product-grid',
  38. 'data-pagination-inner-top': '.listing__pagination--top',
  39. 'data-pagination-inner-bottom': '.listing__pagination--bottom',
  40. 'data-pagination-position': paginationPosition
  41. }
  42. } %}
  43. {% if paginationPosition == 'bottom' %}
  44. <p class="pagination__count">{{ 'pagination_product_counter'|trans({'%productsFrom%': (pagination.currentPage * pagination.itemsPerPage), '%productsTo%': pagination.totalItems}) }}</p>
  45. {% endif %}
  46. </div>
  47. {% endif %}