vendor/dvdw/directory/src/Resources/views/storefront/element/cms-element-shop-directory.html.twig line 1

Open in your IDE?
  1. {% block element_shop_directory %}
  2.     {% set searchResult = element.data.listing %}
  3.     {% set currentPage = ((searchResult.criteria.offset + 1) / searchResult.criteria.limit )|round(0, 'ceil') %}
  4.     {% set limit = searchResult.criteria.limit %}
  5.     {% set paginationConfig = {
  6.         page: currentPage,
  7.         totalPages: (searchResult.total / limit)|round(0, 'ceil'),
  8.         initialPage: currentPage,
  9.         originalPage: 1
  10.     } %}
  11.     {% set slot = cmsPage.firstElementOfType('shop-directory') %}
  12.     {% set filterUrl = null %}
  13.     {% set dataUrl = null %}
  14.     {% if searchResult.currentFilters.navigationId %}
  15.         {% set filterUrl = url('frontend.cms.navigation.filter', { navigationId: searchResult.currentFilters.navigationId }) %}
  16.         {% set dataUrl = url('frontend.cms.navigation.page', { navigationId: searchResult.currentFilters.navigationId }) %}
  17.     {% endif %}
  18.     {% set params = { 
  19.         slotId: slot.id,
  20.         'no-aggregations': 1 
  21.     } %}
  22.     {% set listingPagination = {
  23.         sidebar: null,
  24.         params: params,
  25.         dataUrl: dataUrl,
  26.         filterUrl: filterUrl,
  27.         disableEmptyFilter: disableEmptyFilter,
  28.         snippets: {
  29.             resetAllButtonText: 'listing.filterPanelResetAll'|trans|sw_sanitize
  30.         }
  31.     } %}
  32.     {% set hasPagination = element.config['hasPagination']['value'] %}
  33.     <div class="cms-element-shop-directory cms-element-product-listing-wrapper"
  34.          data-listing="true"
  35.          data-listing-options='{{ listingPagination|json_encode }}'
  36.          data-listing-pagination-options='{{ paginationConfig|json_encode }}'
  37.          {% if not hasPagination %}
  38.             data-listing-infinite-scroll="true"
  39.          {% endif %}
  40.          {% if hasPagination %}
  41.              data-listing-pagination="true"
  42.          {% endif %}
  43.     >
  44.         {% set shops = element.data.listing.elements %}
  45.         <div class="cms-element-shop-directory__wrapper cms-element-product-listing{% if not hasPagination %} is-infinite-scroll{% endif %}">
  46.             <div class="cms-listing-row js-listing-wrapper">
  47.                 {% if shops %}
  48.                     {% for shop in shops %}
  49.                         <div class="cms-element-shop-directory__item">
  50.                             {% sw_include '@DvdwDirectory/storefront/component/shops/webshop.html.twig' with {
  51.                                 product: shop
  52.                             } %}
  53.                         </div>
  54.                     {% endfor %}
  55.                 {% endif %}
  56.             </div>
  57.             <div>
  58.             {# 
  59.                 Fix pagination and disable infinite scroll 
  60.                 + use shopware default pagination instead of custom element:
  61.                 '@DvdwDirectory/storefront/component/listing/pagination/pagination.html.twig'
  62.             #}
  63.             {# {% if hasPagination %} #}
  64.                 {% sw_include '@Storefront/storefront/component/pagination.html.twig' with {
  65.                     entities: searchResult,
  66.                     criteria: searchResult.criteria,
  67.                     paginationConfig: paginationConfig,
  68.                     pageOriginal: pageOriginal
  69.                 } %}
  70.             {# {% else %}
  71.                 <p>No pagination available.</p>
  72.             {% endif %} #}
  73.             </div>
  74.         </div>
  75.         {# {% if not hasPagination %}
  76.             {% block element_product_listing_loading_indicator %}
  77.                 {% sw_include '@DvdwDirectory/storefront/component/listing/loading-indicator.html.twig' %}
  78.             {% endblock %}
  79.         {% endif %} #}
  80.         <div class="empty-container-indicator">
  81.             {% block element_product_listing_col_empty_alert %}
  82.                 {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  83.                     type: 'info',
  84.                     content: 'listing.emptyResultMessage'|trans|sw_sanitize
  85.                 } %}
  86.             {% endblock %}
  87.         </div>
  88.     </div>
  89. {% endblock %}