{block name='productlist-item-list'}
{if isset($Artikel, $Artikel->kArtikel) && !empty($Artikel->kArtikel)}
    {et_getGlobalSettings assign="et_globalSettings"}
    {et_isShopVersionAtLeast value="5.5.0-rc.1" assign='shopIsAtLeast55'}
    {block name='productlist-item-list-variables'}
        {assign var='showRatings' value=$showRatings|default:true}
        {assign var='showManufacturer' value=$showManufacturer|default:true}
        {assign var='showAvailability' value=$showAvailability|default:true}
        {assign var='showQuickview' value=$showQuickview|default:true}
        {assign var='showBasket' value=$showBasket|default:true} {* This must evaluate to true on default because on AJAX reload this setting will not be evaluated *}
        {assign var='showVariations' value=$showVariations|default:true}
        {assign var='maxVariations' value=$maxVariations|default:1000}{* This must be very high if nothing is set to allow everything on AJAX reload - the actual limits were imposed before when the parent was rendered! *}
        {assign var='maxVariationValues' value=$maxVariationValues|default:1000}{* This must be very high if nothing is set to allow everything on AJAX reload - the actual limits were imposed before when the parent was rendered! *}
        {$lazyLoadImages=$lazyLoadImages|default:true}

        {* Parameter since 5.1.2 *}
        {assign var='idPrefix' value=$idPrefix|default:''}

        {if !$showVariations}
            {assign var=hasOnlyListableVariations value=0}
        {else}
            {hasOnlyListableVariations artikel=$Artikel
            maxVariationCount=$maxVariations
            maxWerteCount=$maxVariationValues
            assign='hasOnlyListableVariations'}
        {/if}
    {/block}
    {block name='productlist-item-list-productbox-outer'}
        <div id="{$idPrefix}result-wrapper_buy_form_{$Artikel->kArtikel}" data-wrapper="true"
             class="productbox et-item-list productbox-row productbox-show-variations">
            <div class="productbox-inner">
                {block name='productlist-item-list-productbox-inner'}
                    <div class="row">
                        {block name='productlist-item-list-image-wrapper'}
                        <div class="{block name='productlist-item-list-image-cols'}col-4 col-lg-3{/block}">
                            <div class="et-item-list-image">
                                {block name='productlist-item-list-image'}
                                    <div class="productbox-image">
                                        {if isset($Artikel->Bilder[0]->cAltAttribut)}
                                            {assign var=alt value=$Artikel->Bilder[0]->cAltAttribut}
                                        {else}
                                            {assign var=alt value=$Artikel->cName}
                                        {/if}
                                        {if isset($Artikel->oSuchspecialBild)}
                                            {block name='productlist-item-list-include-searchspecials'}
                                                {include file='snippets/ribbon.tpl'}
                                            {/block}
                                        {/if}
                                        {block name='productlist-item-box-include-productlist-actions'}
                                            <div class="productbox-quick-actions productbox-onhover d-none d-md-flex"  role="group" aria-label="{if $shopIsAtLeast55}{lang key='productActions'}{else}Product Actions{/if}">
                                                {include file='productlist/productlist_actions.tpl'}
                                            </div>
                                        {/block}
                                        {block name="productlist-item-list-images"}
                                            <div class="productbox-images">
                                                <a href="{$Artikel->cURLFull}" title="{$Artikel->cName|unescape:'htmlall'|escape:'html'}">
                                                    <div class="list-gallery">
                                                        {block name="productlist-item-list-gallery-image"}
                                                            {block name="productlist-item-list-images-inner"}{* Replacement for the previously duplicated image block since JTL-Shop 5.3 *}
                                                                {strip}
                                                                    {$image = $Artikel->Bilder[0]}
                                                                    <div class="productbox-image {if !$et_globalSettings.freeAspectRatioImagesEnabled}square square-image {/if}first-wrapper">
                                                                        <div class="inner">
                                                                            {image alt=$alt|truncate:60 fluid=true webp=true lazy=$lazyLoadImages
                                                                            src="{$image->cURLKlein}"
                                                                            srcset="{$image->cURLMini} {$Einstellungen.bilder.bilder_artikel_mini_breite}w,
                                                                            {$image->cURLKlein} {$Einstellungen.bilder.bilder_artikel_klein_breite}w,
                                                                            {$image->cURLNormal} {$Einstellungen.bilder.bilder_artikel_normal_breite}w"
                                                                            sizes="auto"
                                                                            class="{if !$isMobile && !empty($Artikel->Bilder[1])}first{/if}"
                                                                            }
                                                                        </div>
                                                                    </div>
                                                                    {if !$isMobile && !empty($Artikel->Bilder[1])}
                                                                        {$image = $Artikel->Bilder[1]}
                                                                        {if isset($image->cAltAttribut)}
                                                                            {assign var=alt value=$image->cAltAttribut}
                                                                        {else}
                                                                            {assign var=alt value=$Artikel->cName}
                                                                        {/if}
                                                                        <div class="productbox-image {if !$et_globalSettings.freeAspectRatioImagesEnabled}square square-image {/if}second-wrapper">
                                                                            <div class="inner">
                                                                                {image alt=$alt|truncate:60 fluid=true webp=true lazy=$lazyLoadImages
                                                                                src="{$image->cURLKlein}"
                                                                                srcset="{$image->cURLMini} {$Einstellungen.bilder.bilder_artikel_mini_breite}w,
                                                                                {$image->cURLKlein} {$Einstellungen.bilder.bilder_artikel_klein_breite}w,
                                                                                {$image->cURLNormal} {$Einstellungen.bilder.bilder_artikel_normal_breite}w"
                                                                                sizes="auto"
                                                                                class="second"
                                                                                }
                                                                            </div>
                                                                        </div>
                                                                    {/if}
                                                                {/strip}
                                                            {/block}
                                                        {/block}
                                                    </div>
                                                </a>
                                                {if !empty($Artikel->Bilder[0]->cURLNormal)}
                                                    <meta itemprop="image" content="{$Artikel->Bilder[0]->cURLNormal}">
                                                {/if}
                                            </div>
                                        {/block}

                                        {if $smarty.session.Kundengruppe->mayViewPrices()
                                        && isset($Artikel->SieSparenX)
                                        && $Artikel->SieSparenX->anzeigen == 1
                                        && $Artikel->SieSparenX->nProzent > 0
                                        && !$NettoPreise
                                        && $Artikel->taxData['tax'] > 0
                                        }
                                            {block name='productlist-item-list-badge-yousave'}
                                                <div class="productbox-sale-percentage">
                                                    <div class="ribbon ribbon-7 productbox-ribbon">{$Artikel->SieSparenX->nProzent}%</div>
                                                </div>
                                            {/block}
                                        {/if}
                                    </div>
                                {/block}
                            </div>
                        </div>
                        {/block}
                        {block name='productlist-item-list-details-basket-wrapper'}
                            {block name='productlist-item-list-details-wrapper'}
                                <div class="{block name='productlist-item-list-details-cols'}d-none d-lg-flex col-5{/block}">
                                    <div class="et-item-list-details">
                                        {block name='productlist-item-list-manufacturer'}
                                            {if $showManufacturer && $Einstellungen.artikeldetails.artikeldetails_hersteller_anzeigen !== 'N'}
                                                <div class="et-item-box-manufacturer productbox-manufacturer" itemprop="brand" itemscope itemtype="https://schema.org/Brand">
                                                    <meta itemprop="name" content="{$Artikel->cHersteller|escape:'quotes'}" />
                                                    <a href="{if !empty($Artikel->cHerstellerHomepage)}{$Artikel->cHerstellerHomepage}{else}{$ShopURL}/{$Artikel->cHerstellerSeo}{/if}"
                                                       class="link-discreet"
                                                            {if $Einstellungen.artikeldetails.artikeldetails_hersteller_anzeigen === 'B'}
                                                                data-toggle="tooltip"
                                                                data-placement="left"
                                                                title="{$Artikel->cHersteller}"
                                                            {/if}
                                                       itemprop="url"
                                                    >
                                                        {* Show Manufacturer Image *}
                                                        {if ($Einstellungen.artikeldetails.artikeldetails_hersteller_anzeigen === 'B'
                                                        || $Einstellungen.artikeldetails.artikeldetails_hersteller_anzeigen === 'BT')
                                                        && !empty($Artikel->cHerstellerBildURLKlein)
                                                        }
                                                            {block name='productlist-item-box-manufacturer-image'}
                                                                {image lazy=$lazyLoadImages
                                                                webp=true
                                                                src=$Artikel->cHerstellerBildURLKlein
                                                                alt=$Artikel->cHersteller|escape:'html'
                                                                }
                                                                <meta itemprop="logo" content="{$Artikel->cHerstellerBildURLKlein}">
                                                            {/block}
                                                        {/if}

                                                        {* Show Manufacturer Name *}
                                                        {if $Einstellungen.artikeldetails.artikeldetails_hersteller_anzeigen !== 'B'}
                                                            {block name='productlist-item-box-manufacturer-name'}
                                                                <span>{$Artikel->cHersteller}</span>
                                                            {/block}
                                                        {/if}
                                                    </a>
                                                </div>
                                            {/if}
                                        {/block}
                                        {block name='productlist-item-list-title'}
                                            {block name='productlist-item-list-title-heading'}
                                                <div class="productbox-title">
                                                    <a href="{$Artikel->cURLFull}" class="link-discreet" title="{$Artikel->cName|unescape:'htmlall'|escape:'html'}"><span itemprop="name">{$Artikel->cName}</span></a>
                                                </div>
                                            {/block}
                                            <meta itemprop="url" content="{$Artikel->cURLFull}">
                                        {/block}
                                        {block name='productlist-item-list-rating'}
                                            {if $Einstellungen.bewertung.bewertung_anzeigen === 'Y' && $Artikel->fDurchschnittsBewertung > 0 && $showRatings}
                                                <div class="et-item-box-rating productbox-rating" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
                                                    <meta itemprop="ratingValue" content="{$Artikel->fDurchschnittsBewertung}"/>
                                                    <meta itemprop="bestRating" content="5"/>
                                                    <meta itemprop="worstRating" content="1"/>
                                                    <meta itemprop="reviewCount" content="{et_getReviewCount article=$Artikel}">
                                                    {include file='productdetails/rating.tpl' stars=$Artikel->fDurchschnittsBewertung link=$Artikel->cURLFull}
                                                </div>
                                            {/if}
                                        {/block}
                                        <div class="productbox-details">
                                            {block name='productlist-item-list-details'}
                                                {include file='productlist/item_details.tpl' tplScope="list" lazyLoadImages=$lazyLoadImages}
                                            {/block}
                                        </div>
                                        {if $Einstellungen.artikeluebersicht.artikeluebersicht_kurzbeschreibung_anzeigen === 'Y'
                                        && $Artikel->cKurzBeschreibung}
                                            {block name='productlist-item-list-description'}
                                                <div class="item-list-description" itemprop="description">
                                                    {$Artikel->cKurzBeschreibung}
                                                </div>
                                            {/block}
                                        {/if}
                                        {* GPSR *}
                                        {block name='productlist-item-list-gpsr'}
                                            {if !empty($et_globalSettings.gpsrSource) && $et_globalSettings.gpsrSource !== 'none'}
                                                {include file="widgets/snippets/gpsr.tpl" etGlobalSettings=$et_globalSettings gpsrContext='list'}
                                            {/if}
                                        {/block}
                                    </div>
                                </div>
                            {/block}
                            {block name='productlist-item-list-basket-wrapper'}
                                <div class="{block name='productlist-item-list-basket-cols'}col-8 col-lg-4{/block}">
                                    <div class="et-item-list-basket">
                                        {block name='productlist-item-list-manufacturer-mobile'}
                                            {* Mobile display of manufacturer - note that this does not duplicate the schema.org meta data *}
                                            {if $showManufacturer}
                                                <div class="et-item-box-manufacturer productbox-manufacturer d-lg-none">
                                                    <a href="{if !empty($Artikel->cHerstellerHomepage)}{$Artikel->cHerstellerHomepage}{else}{$ShopURL}/{$Artikel->cHerstellerSeo}{/if}"
                                                    class="link-discreet"
                                                            {if $Einstellungen.artikeldetails.artikeldetails_hersteller_anzeigen === 'B'}
                                                                data-toggle="tooltip"
                                                                data-placement="left"
                                                                title="{$Artikel->cHersteller}"
                                                            {/if}
                                                    >
                                                        {* Show Manufacturer Image *}
                                                        {if ($Einstellungen.artikeldetails.artikeldetails_hersteller_anzeigen === 'B'
                                                        || $Einstellungen.artikeldetails.artikeldetails_hersteller_anzeigen === 'BT')
                                                        && !empty($Artikel->cHerstellerBildURLKlein)
                                                        }
                                                            {block name='productlist-item-box-manufacturer-mobile-image'}
                                                                {image lazy=$lazyLoadImages
                                                                webp=true
                                                                src=$Artikel->cHerstellerBildURLKlein
                                                                alt=$Artikel->cHersteller
                                                                }
                                                            {/block}
                                                        {/if}

                                                        {* Show Manufacturer Name *}
                                                        {if $Einstellungen.artikeldetails.artikeldetails_hersteller_anzeigen !== 'B'}
                                                            {block name='productlist-item-box-manufacturer-mobile-name'}
                                                                <span>{$Artikel->cHersteller}</span>
                                                            {/block}
                                                        {/if}
                                                    </a>
                                                </div>
                                            {/if}
                                        {/block}
                                        {block name='productlist-item-list-title-mobile'}
                                            {* Mobile display of the product title - note that this does not duplicate the schema.org meta data *}
                                            {block name='productlist-item-list-title-mobile-heading'}
                                                <div class="productbox-title d-lg-none">
                                                    <a href="{$Artikel->cURLFull}" class="link-discreet" title="{$Artikel->cName|unescape:'htmlall'|escape:'html'}"><span>{$Artikel->cName}</span></a>
                                                </div>
                                            {/block}
                                        {/block}
                                        {block name='productlist-item-list-buy-form'}
                                            <form id="{$idPrefix}buy_form_{$Artikel->kArtikel}"
                                                action="{$ShopURL}" class="form form-basket jtl-validate"
                                                data-toggle="basket-add"
                                                method="POST"
                                            >
                                                {csrf_token}
                                                {$isFlexVoucher = defined('FKT_ATTRIBUT_VOUCHER_FLEX') && $Artikel->Preise->fVKNetto == 0 && isset($Artikel->FunktionsAttribute[$smarty.const.FKT_ATTRIBUT_VOUCHER_FLEX])}
                                                <div class="productbox-options"{if !$isFlexVoucher} itemprop="offers" itemscope itemtype="https://schema.org/Offer"{/if}>
                                                    {if !$isFlexVoucher}
                                                        <link itemprop="businessFunction" href="http://purl.org/goodrelations/v1#Sell"/>
                                                        {block name='productlist-item-list-form'}
                                                            {block name='productlist-item-list-include-price'}
                                                                <div class="item-list-price et-item-list-price">
                                                                    {include file='productdetails/price.tpl' Artikel=$Artikel tplscope=$tplscope}
                                                                    {include file='productdetails/stock_microdata.tpl' Artikel=$Artikel}
                                                                </div>
                                                            {/block}
                                                        {/block}
                                                    {/if}
                                                    {if $hasOnlyListableVariations > 0 && !$Artikel->bHasKonfig && $Artikel->kEigenschaftKombi === 0}
                                                        <div class="productbox-variations">
                                                            {block name='productlist-item-list-form-variations'}
                                                                <div class="productbox-onhover">
                                                                    {block name='productlist-item-list-form-include-variation'}
                                                                        {include file='productdetails/variation.tpl'
                                                                        simple=$Artikel->isSimpleVariation showMatrix=false
                                                                        smallView=true ohneFreifeld=($hasOnlyListableVariations == 2)}
                                                                    {/block}
                                                                </div>
                                                            {/block}
                                                        </div>
                                                    {/if}
                                                    {block name='productlist-item-list-basket-details'}
                                                        <div class="form-row productbox-actions item-list-basket-details">
                                                            {if ($Artikel->inWarenkorbLegbar === 1 || ($Artikel->nErscheinendesProdukt === 1 && $Einstellungen.global.global_erscheinende_kaeuflich === 'Y'))
                                                            && (($Artikel->nIstVater === 0 && (!isset($Artikel->Variationen) || count($Artikel->Variationen) === 0)) || $hasOnlyListableVariations === 1)
                                                            && !$Artikel->bHasKonfig
                                                            && $showBasket
                                                            && !$isFlexVoucher
                                                            }
                                                                {if $Artikel->nIstVater && $Artikel->kVaterArtikel == 0}
                                                                    <div class="col col-12">
                                                                        {block name='productlist-item-list-basket-details-variations'}
                                                                            <div role="alert" class="alert alert-info choose-variations text-left-util">
                                                                                <div class="sr-only">x</div>
                                                                                {lang key='chooseVariations' section='messages'}
                                                                            </div>
                                                                        {/block}
                                                                    </div>

                                                                {else}
                                                                    <div class="col col-12 et-validation-error-wrapper">
                                                                        {block name='productlist-item-list-basket-details-quantity'}
                                                                            <div class="input-group" data-bulk="{if !empty($Artikel->staffelPreis_arr)}1{else}0{/if}">
                                                                                <input type="number"
                                                                                    step="{if $Artikel->cTeilbar === 'Y' && $Artikel->fAbnahmeintervall == 0}any{elseif $Artikel->fAbnahmeintervall > 0}{$Artikel->fAbnahmeintervall}{else}1{/if}"
                                                                                    min="{if $Artikel->fMindestbestellmenge}{$Artikel->fMindestbestellmenge}{else}0{/if}"
                                                                                    max="{$Artikel->FunktionsAttribute[$smarty.const.FKT_ATTRIBUT_MAXBESTELLMENGE]|default:''}"
                                                                                    id="{$idPrefix}quantity{$Artikel->kArtikel}"
                                                                                    class="form-control quantity"
                                                                                    name="anzahl"
                                                                                    autocomplete="off"
                                                                                    aria-label="{lang key='quantity'}"
                                                                                    data-decimals="{getDecimalLength quantity=$Artikel->fAbnahmeintervall}"
                                                                                    data-product-id="{if isset($Artikel->kVariKindArtikel)}{$Artikel->kVariKindArtikel}{else}{$Artikel->kArtikel}{/if}"
                                                                                    value="{if $Artikel->fAbnahmeintervall > 0 || $Artikel->fMindestbestellmenge > 1}{if $Artikel->fMindestbestellmenge > $Artikel->fAbnahmeintervall}{$Artikel->fMindestbestellmenge}{else}{$Artikel->fAbnahmeintervall}{/if}{else}1{/if}"
                                                                                />
                                                                                <div class="input-group-append">
                                                                                    {block name='productlist-item-list-basket-details-add-to-cart'}
                                                                                        {$basketLoadingIcon = ''}
                                                                                        {if !empty($et_globalSettings.pushToBasketAnimationList) && $et_globalSettings.pushToBasketAnimationList === 'iconSpin'}
                                                                                            {et_getIcon key='pushToBasketSpin' assign="basketLoadingIcon"}
                                                                                        {/if}
                                                                                        {include file="widgets/base/button.tpl"
                                                                                        type="submit"
                                                                                        id="{$idPrefix}submit{$Artikel->kArtikel}"
                                                                                        title="{lang key='addToCart'}"
                                                                                        variant="cart"
                                                                                        classes="btn-block basket-details-add-to-cart"
                                                                                        ariaLabel="{lang key='addToCart'}"
                                                                                        label="{if !empty($basketLoadingIcon)}<i class=\"{$basketLoadingIcon} et-icon-fw et-icon-spin et-loading-only\"></i>{/if}{lang key='addToCart'}"}
                                                                                    {/block}
                                                                                </div>
                                                                            </div>
                                                                        {/block}
                                                                    </div>
                                                                {/if}
                                                            {else}
                                                                <div class="col col-12">
                                                                    {block name='productlist-item-list-basket-details-details'}
                                                                        {include file="widgets/base/button.tpl" variant="primary" href="{$Artikel->cURLFull}" role="button" label="{lang key='details'}" title="{lang key='details'}"}
                                                                    {/block}
                                                                </div>
                                                            {/if}
                                                        </div>
                                                        {block name='productlist-item-list-stock'}
                                                            {if $showAvailability}
                                                                <div class="et-item-list-stock productbox-stock">
                                                                    {include file='productdetails/stock.tpl' skipMicrodata=true}
                                                                </div>
                                                            {/if}
                                                        {/block}
                                                    {/block}
                                                    {block name='productlist-item-form-expandable-inputs-hidden'}
                                                        {if $Artikel->kArtikelVariKombi > 0}
                                                            <input type="hidden" name="aK" value="{$Artikel->kArtikelVariKombi}"/>
                                                        {/if}
                                                        {if isset($Artikel->kVariKindArtikel)}
                                                            <input type="hidden" name="VariKindArtikel" value="{$Artikel->kVariKindArtikel}"/>
                                                        {/if}
                                                        <input type="hidden" name="a" value="{$Artikel->kArtikel}"/>
                                                        <input type="hidden" name="wke" value="1"/>
                                                        <input type="hidden" name="overview" value="1"/>
                                                        <input type="hidden" name="Sortierung" value="{if !empty($Suchergebnisse->Sortierung)}{$Suchergebnisse->Sortierung}{/if}"/>
                                                        {if $Suchergebnisse->getPages()->getCurrentPage() > 1}
                                                            <input type="hidden" name="seite" value="{$Suchergebnisse->getPages()->getCurrentPage()}"/>
                                                        {/if}
                                                        {if $NaviFilter->hasCategory()}
                                                            <input type="hidden" name="k" value="{$NaviFilter->getCategory()->getValue()}"/>
                                                        {/if}
                                                        {if $NaviFilter->hasManufacturer()}
                                                            <input type="hidden" name="h" value="{$NaviFilter->getManufacturer()->getValue()}"/>
                                                        {/if}
                                                        {if $NaviFilter->hasSearchQuery()}
                                                            <input type="hidden" name="l" value="{$NaviFilter->getSearchQuery()->getValue()}"/>
                                                        {/if}
                                                        {if $NaviFilter->hasCharacteristicValue()}
                                                            <input type="hidden" name="m" value="{$NaviFilter->getCharacteristicValue()->getValue()}"/>
                                                        {/if}
                                                        {if $NaviFilter->hasCategoryFilter()}
                                                            {assign var=cfv value=$NaviFilter->getCategoryFilter()->getValue()}
                                                            {if is_array($cfv)}
                                                                {foreach $cfv as $val}
                                                                    <input type="hidden" name="hf" value="{$val}"/>
                                                                {/foreach}
                                                            {else}
                                                                <input type="hidden" name="kf" value="{$cfv}"/>
                                                            {/if}
                                                        {/if}
                                                        {if $NaviFilter->hasManufacturerFilter()}
                                                            {assign var=mfv value=$NaviFilter->getManufacturerFilter()->getValue()}
                                                            {if is_array($mfv)}
                                                                {foreach $mfv as $val}
                                                                    <input type="hidden" name="hf" value="{$val}"/>
                                                                {/foreach}
                                                            {else}
                                                                <input type="hidden" name="hf" value="{$mfv}"/>
                                                            {/if}
                                                        {/if}
                                                        {foreach $NaviFilter->getCharacteristicFilter() as $filter}
                                                            <input type="hidden" name="mf{$filter@iteration}" value="{$filter->getValue()}"/>
                                                        {/foreach}
                                                    {/block}
                                                </div>
                                            </form>
                                        {/block}
                                    </div>
                                </div>
                            {/block}
                        {/block}
                    </div>
                {/block}
            </div>
        </div>
    {/block}
{/if}
{/block}
