{% sw_extends '@storefront/storefront/element/cms-element-product-listing.html.twig' %}

{# ---------------- START: TEMPLATE VARS ---------------- #}
{# Set theme variables #}
{% set bcbListingBoxLayout = element.translated.config.boxLayout.value %}

{% if bcbListingBoxLayout == 'standard' %}
    {# Layout type "Standard" #}
    {% set bcbListingColumnCountLg = theme_config('theme-listing-column-count-lg') %}
    {% set bcbListingColumnCountMd = theme_config('theme-listing-column-count-md') %}
    {% set bcbListingColumnCountSm = theme_config('theme-listing-column-count-sm') %}
    {% set bcbListingColumnCountXl = theme_config('theme-listing-column-count-xl') %}
    {% set bcbListingColumnCountXs = theme_config('theme-listing-column-count-xs') %}
    {% set bcbListingColumnCountSidebarLg = theme_config('theme-listing-column-count-sidebar-lg') %}
    {% set bcbListingColumnCountSidebarMd = theme_config('theme-listing-column-count-sidebar-md') %}
    {% set bcbListingColumnCountSidebarSm = theme_config('theme-listing-column-count-sidebar-sm') %}
    {% set bcbListingColumnCountSidebarXl = theme_config('theme-listing-column-count-sidebar-xl') %}
    {% set bcbListingColumnCountSidebarXs = theme_config('theme-listing-column-count-sidebar-xs') %}

{% elseif bcbListingBoxLayout == 'image' %}
    {# Layout type "Big image" #}
    {% set bcbListingColumnCountLg = theme_config('theme-listing-column-count-lg-image') %}
    {% set bcbListingColumnCountMd = theme_config('theme-listing-column-count-md-image') %}
    {% set bcbListingColumnCountSm = theme_config('theme-listing-column-count-sm-image') %}
    {% set bcbListingColumnCountXl = theme_config('theme-listing-column-count-xl-image') %}
    {% set bcbListingColumnCountXs = theme_config('theme-listing-column-count-xs-image') %}
    {% set bcbListingColumnCountSidebarLg = theme_config('theme-listing-column-count-sidebar-lg-image') %}
    {% set bcbListingColumnCountSidebarMd = theme_config('theme-listing-column-count-sidebar-md-image') %}
    {% set bcbListingColumnCountSidebarSm = theme_config('theme-listing-column-count-sidebar-sm-image') %}
    {% set bcbListingColumnCountSidebarXl = theme_config('theme-listing-column-count-sidebar-xl-image') %}
    {% set bcbListingColumnCountSidebarXs = theme_config('theme-listing-column-count-sidebar-xs-image') %}

{% elseif bcbListingBoxLayout == 'minimal' %}
    {# Layout type "Minimal content" #}
    {% set bcbListingColumnCountLg = theme_config('theme-listing-column-count-lg-minimal') %}
    {% set bcbListingColumnCountMd = theme_config('theme-listing-column-count-md-minimal') %}
    {% set bcbListingColumnCountSm = theme_config('theme-listing-column-count-sm-minimal') %}
    {% set bcbListingColumnCountXl = theme_config('theme-listing-column-count-xl-minimal') %}
    {% set bcbListingColumnCountXs = theme_config('theme-listing-column-count-xs-minimal') %}    
    {% set bcbListingColumnCountSidebarLg = theme_config('theme-listing-column-count-sidebar-lg-minimal') %}
    {% set bcbListingColumnCountSidebarMd = theme_config('theme-listing-column-count-sidebar-md-minimal') %}
    {% set bcbListingColumnCountSidebarSm = theme_config('theme-listing-column-count-sidebar-sm-minimal') %}
    {% set bcbListingColumnCountSidebarXl = theme_config('theme-listing-column-count-sidebar-xl-minimal') %}
    {% set bcbListingColumnCountSidebarXs = theme_config('theme-listing-column-count-sidebar-xs-minimal') %}

{% elseif  bcbListingBoxLayout == 'list' %}
   {# Layout type "List content" #}
    {% set bcbListingColumnCountLg = 12 %}
    {% set bcbListingColumnCountMd = 12 %}
    {% set bcbListingColumnCountSm = 12 %}
    {% set bcbListingColumnCountXl = 12 %}
    {% set bcbListingColumnCountXs = 12 %}
    {% set bcbListingColumnCountSidebarLg = 12 %}
    {% set bcbListingColumnCountSidebarMd = 12 %}
    {% set bcbListingColumnCountSidebarSm = 12 %}
    {% set bcbListingColumnCountSidebarXl = 12 %}
    {% set bcbListingColumnCountSidebarXs = 12 %}
{% else %}
    {# Fallback: Shopware default values #}
    {% set bcbListingColumnCountLg = 4 %}
    {% set bcbListingColumnCountMd = 6 %}
    {% set bcbListingColumnCountSm = 6 %}
    {% set bcbListingColumnCountXl = 3 %}
    {% set bcbListingColumnCountXs = 12 %}    
    {% set bcbListingColumnCountSidebarLg = 6 %}
    {% set bcbListingColumnCountSidebarMd = 6 %}
    {% set bcbListingColumnCountSidebarSm = 6 %}
    {% set bcbListingColumnCountSidebarXl = 4 %}
    {% set bcbListingColumnCountSidebarXs = 12 %}
{% endif %}

{% block element_product_listing_wrapper %}
    {% set listingColumns = 'col-'~ bcbListingColumnCountXs ~' col-sm-'~ bcbListingColumnCountSm ~' col-md-'~ bcbListingColumnCountMd ~' col-lg-'~ bcbListingColumnCountLg ~' col-xl-'~ bcbListingColumnCountXl %}

    {% if section and section.type == 'sidebar' %}
        {% set listingColumns = 'col-'~ bcbListingColumnCountSidebarXs ~' col-sm-'~ bcbListingColumnCountSidebarSm ~' col-md-'~ bcbListingColumnCountSidebarMd ~' col-lg-'~ bcbListingColumnCountSidebarLg ~' col-xl-'~ bcbListingColumnCountSidebarXl %}
    {% endif %}  
    {{ parent() }}
 
{% endblock %}




