{block name='snippets-wishlist-button'}
    {assign var='isOnWishList' value=false}
    {assign var='wishlistPos' value=0}
    {assign var='isVariationItem' value=!empty($Artikel->Variationen) && empty($Artikel->kVariKindArtikel)}
    {assign var='tabIndx' value=0}
    {if isset($tplscope) && $tplscope=='list'}
        {assign var='tabIndx' value=-1}
    {/if}
    {et_isShopVersionAtLeast value="5.2.0-beta" assign='shopIsAtLeast52'}
    {if $shopIsAtLeast52}
        {if !$isVariationItem && count(JTL\Session\Frontend::getWishlist()->getItems()) > 0}
            {foreach JTL\Session\Frontend::getWishlist()->getItems() as $item}
                {if $item->getProductID() === $Artikel->kArtikel || $item->getProductID() === $Artikel->kVariKindArtikel}
                    {$isOnWishList=true}
                    {$wishlistPos=$item->getID()}
                    {break}
                {/if}
            {/foreach}
        {/if}
    {else}
        {if isset($smarty.session.Wunschliste) && !$isVariationItem}
            {foreach $smarty.session.Wunschliste->CWunschlistePos_arr as $product}
                {if $product->kArtikel === $Artikel->kArtikel || $product->kArtikel === $Artikel->kVariKindArtikel}
                    {$isOnWishList=true}
                    {$wishlistPos=$product->kWunschlistePos}
                    {break}
                {/if}
            {/foreach}
        {/if}
    {/if}
    {block name='snippets-wishlist-button-main'}
        {if $buttonAndText|default:false}
            {block name='snippets-wishlist-button-button-text'}
                <button name="Wunschliste"
                    type="submit"
                    class="btn btn-link {$classes|default:''} wishlist-button wishlist action-tip-animation-b {if $isOnWishList}on-list{/if}"
                    aria-label="{lang key='addToWishlist' section='productDetails'}"
                    data-wl-pos="{$wishlistPos}"
                    data-product-id-wl="{if isset($Artikel->kVariKindArtikel)}{$Artikel->kVariKindArtikel}{else}{$Artikel->kArtikel}{/if}"
                    tabindex="{$tabIndx}"
                >
                    <span class="wishlist-button-inner">
                        <span class="{if $isOnWishList}{et_getIcon key="wishlistActive"}{else}{et_getIcon key="wishlistInactive"}{/if} wishlist-icon"></span>
                        <span class="wishlist-button-text">{lang key='onWishlist'}</span>
                    </span>
                </button>
            {/block}
        {else}
            {block name='snippets-wishlist-button-button'}
                <button name="Wunschliste"
                    type="submit"
                    class="{$classes|default:''} wishlist badge badge-circle-1 action-tip-animation-b {if $isOnWishList}on-list{/if}"
                    aria-label="{lang key='addToWishlist' section='productDetails'}"
                    title="{lang key='addToWishlist' section='productDetails'}"
                    data-wl-pos="{$wishlistPos}"
                    data-product-id-wl="{if isset($Artikel->kVariKindArtikel)}{$Artikel->kVariKindArtikel}{else}{$Artikel->kArtikel}{/if}"
                    data-toggle="tooltip"
                    data-trigger="hover"
                    tabindex={$tabIndx}
                >
                    <span class="{if $isOnWishList}{et_getIcon key="wishlistActive"}{else}{et_getIcon key="wishlistInactive"}{/if}"></span>
                </button>
            {/block}
        {/if}
        {block name='snippets-wishlist-button-hidden'}
            <input type="hidden" name="wlPos" value="{$wishlistPos}" />
        {/block}
    {/block}
{/block}
