{% sw_extends '@Storefront/storefront/component/product/listing.html.twig' %}
{% set currentPage = ((searchResult.criteria.offset + 1) / searchResult.criteria.limit )|round(0, 'ceil') %}
{% set paginationConfig = { page: currentPage }|json_encode %}
{% if disableEmptyFilter is not defined %}
{% set disableEmptyFilter = config('core.listing.disableEmptyFilterOptions') %}
{% endif %}
{% set listingPagination = {
sidebar: sidebar,
params: params,
dataUrl: dataUrl,
filterUrl: filterUrl,
disableEmptyFilter: disableEmptyFilter,
snippets: {
resetAllButtonText: 'listing.filterPanelResetAll'|trans|sw_sanitize
}
} %}
{% block product_listing %}
{% block product_listing_cats %}
{% set currentCategory = page.header.navigation.tree[ page.navigationId ] %}
{% if currentCategory.children|length > 1 %}
{% set sliderConfig = {
} %}
{% set baseSliderOptions = {
slider: {
navPosition: 'bottom',
items: 4,
speed: 500,
loop: false,
nav: false,
gutter: 30,
nav: false,
autoHeight: false,
startIndex: 1,
responsive: {
xs: {
items: 1,
gutter: 0,
nav: true,
},
sm: {
items: 1,
gutter: 0,
nav: true,
},
md: {
items: 2,
gutter: 20,
nav: true,
},
lg: {
items: 2,
gutter: 20,
nav: true,
}
}
}
} %}
<div class="category-children base-slider"
data-base-slider="true"
data-base-slider-options='{{ baseSliderOptions|json_encode }}'>
<div class="base-slider-container"
data-base-slider-container="true">
{% for subCat in currentCategory.children|slice(0, 4) %}
{% if subCat.category.media.url is defined %}
<div class="base-slider-item">
<a href="{{ category_url( subCat.category ) }}" class="category-child">
<div class="category-image">
<img src="{{ subCat.category.media.url }}" alt="{{ subCat.category.name }}">
</div>
<div class="category-info">
<button class="btn btn-primary">
{{ subCat.category.translated.name }}
</button>
</div>
</a>
</div>
{% endif %}
{% endfor %}
</div>
<div class="category-slider-controls-container">
<div class="base-slider-controls"
data-base-slider-controls="true">
{% block element_category_slider_controls_items %}
{% block element_category_slider_controls_items_arrows %}
<button class="base-slider-controls-prev category-slider-controls-prev{% if sliderConfig.navigationArrows.value == "outside" %} is-nav-prev-outside{% elseif sliderConfig.navigationArrows.value == "inside" %} is-nav-prev-inside{% endif %}">
{% block element_category_slider_controls_items_prev_icon %}
{% sw_icon 'arrow-head-left' %}
{% endblock %}
</button>
<button class="base-slider-controls-next category-slider-controls-next{% if sliderConfig.navigationArrows.value == "outside" %} is-nav-next-outside{% elseif sliderConfig.navigationArrows.value == "inside" %} is-nav-next-inside{% endif %}">
{% block element_category_slider_controls_items_next_icon %}
{% sw_icon 'arrow-head-right' %}
{% endblock %}
</button>
{% endblock %}
{% endblock %}
</div>
</div>
</div>
{% endif %}
{% endblock %}
<div class="cms-element-product-listing-wrapper"
data-listing-pagination="true"
data-listing-pagination-options='{{ paginationConfig }}'
data-listing="true"
data-listing-options='{{ listingPagination|json_encode }}'>
{% block element_product_listing_wrapper_content %}
<div class="cms-element-product-listing">
{% if searchResult.total > 0 %}
{% block element_product_listing_pagination_nav_actions %}
<div class="cms-element-product-listing-actions row justify-content-between">
<div class="col-md-auto">
{% if searchResult.total != '' %}
<span class="listing-count">
{{ "checkout.itemCounter"|trans({'%count%': searchResult.total})|sw_sanitize }}
</span>
{% endif %}
</div>
<div class="col-md-auto">
{% block element_product_listing_sorting %}
{% sw_include '@Storefront/storefront/component/sorting.html.twig' with {
current: searchResult.sorting,
sortings: searchResult.availableSortings
} %}
{% endblock %}
</div>
</div>
{% endblock %}
{% endif %}
{% block element_product_listing_row %}
<div class="row cms-listing-row js-listing-wrapper">
{% if searchResult.total > 0 %}
{% block element_product_listing_col %}
{% for product in searchResult %}
<div class="cms-listing-col {{ listingColumns }}">
{% block element_product_listing_box %}
{% sw_include '@Storefront/storefront/component/product/card/box.html.twig' with {
'layout': boxLayout,
'displayMode': displayMode
} %}
{% endblock %}
</div>
{% endfor %}
{% endblock %}
{% else %}
{% block element_product_listing_col_empty %}
<div class="cms-listing-col col-12">
{% block element_product_listing_col_empty_alert %}
{% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
type: 'info',
content: 'listing.emptyResultMessage'|trans|sw_sanitize
} %}
{% endblock %}
</div>
{% endblock %}
{% endif %}
</div>
{% endblock %}
{% if searchResult.total > searchResult.limit %}
{% block element_product_listing_pagination_nav_bottom %}
{% sw_include '@Storefront/storefront/component/pagination.html.twig' with {
entities: searchResult,
criteria: searchResult.criteria
} %}
{% endblock %}
{% endif %}
</div>
{% endblock %}
</div>
{% endblock %}