{function catalog_b2b_form_wrapper}
   <div class="catalog-b2b-list-form-wrapper">
       {if $product.variations|count and !$variation}
          <button class="btn btn-insert btn-block" data-opener="[data-product-variations-{$product.id}]">
              {$product.variations|count}&nbsp;{t plural="varianty" plural5="variant" count=$product.variations|count}varianta{/t}
             <span class="fc icons_caret-down"></span>
          </button>
       {elseif !(($product.inStore and !$variation) or ($variation and $variation.in_store))}
          {ifmodule WATCHDOG}
             <div data-reload="ajax-watchdog-{$product.id}-{$variation.id}">
                {if !$product.variations and !$variation}
                   {get_product_info type='is_watchdog' product=$product assign='is_watchdog'}
                {elseif $variation}
                   {get_product_info type='is_watchdog' product=$product id_variation=$variation.id assign='is_watchdog'}
                {/if}

                {if !$is_watchdog}
                   <a class="btn btn-block btn-secondary" href="{path('kupshop_watchdog_watchdog_add', ['id_product' => $product.id, 'id_variation' => $variation.id])}" data-ajax-watchdog>{t}Hlídat produkt{/t}</a>
                {else}
                   <a class="btn btn-block btn-secondary" href="{path('kupshop_watchdog_watchdog_remove', ['id_product' => $product.id, 'id_variation' => $variation.id, 'availability' => 1])}" data-ajax-watchdog>{t}Zrušit hlídání{/t}</a>
                {/if}
             </div>
          {/ifmodule}
       {else}
          <form action="{url s=cart}" method="get" data-buy-form>
             <input type="hidden" name="act" value="add">
             <input type="hidden" name="redir" value="1">
             <input type="hidden" name="IDproduct" value="{$product.id}">
              {if $variation}
                 <input type="hidden" name="IDvariation" value="{$variation.id}">
              {/if}

              {include "product/product.submit-block.tpl" hide_favorites=true}
          </form>
       {/if}
   </div>
{/function}

<div class="row {$row_class|default:'catalog-row'}" {if $body.pager}data-page="{$body.pager.number}"
     data-products-row{/if}{if $dbcfg.analytics.google_tag_manager.gtm_dl_version == 2} data-tracking-view='{get_gtm_data encode=true type='ecommerce' method='ProductsImpressions' data=['products' => $products, 'listType' => $listType, 'listId' => $listId]}'{/if}>

    {foreach $smarty.get.dynamic_filter.variations as $var_filter}
        {if $var_filter.value|count == 1}
            {$var_filter_active = true}
        {/if}
    {/foreach}

    {block "fetchData"}
        {ifmodule PRODUCTS_VARIATIONS}
        {$products->fetchVariations(true)|silent}
        {/ifmodule}
    {/block}

    {foreach $products as $product}
        {if $body.filter_active and $product.matched_id_variation and $var_filter_active}
            {$hash = "#`$product.matched_id_variation`"}
        {else}
            {$hash = ''}
        {/if}
       <div class="{$catalog_class|default:"col-xxs-12"}">
          <div class="catalog-b2b-list">
             <div class="catalog-b2b-list-content">
                <a href="{url s=product IDproduct=$product.id TITLE=$product.title}" class="img"{if $dbcfg.analytics.google_tag_manager.gtm_dl_version == 2} data-tracking-click='{get_gtm_data encode=true type='ecommerce' method='ProductClick' data=['product' => $product, 'position' => $product@iteration, 'listType' => $listType, 'listId' => $listId]}'{/if}>
                   <img src="{get_photo photo=$product.image size='product_cart'}"
                        width="{$cfg.Photo.types.product_cart.size[0]}" height="{$cfg.Photo.types.product_cart.size[1]}"
                        class="img-responsive" alt="{$product.title}">
                </a>
                <div class="title-delivery-wrapper">
                   <div class="title-wrapper">
                      <a href="{url s=product IDproduct=$product.id TITLE=$product.title}"{if $dbcfg.analytics.google_tag_manager.gtm_dl_version == 2} data-tracking-click='{get_gtm_data encode=true type='ecommerce' method='ProductClick' data=['product' => $product, 'position' => $product@iteration, 'listType' => $listType, 'listId' => $listId]}'{/if}>
                         <h3 class="heading-reset title">{$product.title nofilter}</h3>
                      </a>
                       {if $product.code}
                          <p class="code">
                              {t}Kód:{/t}&nbsp;{$product.code}
                          </p>
                       {/if}
                   </div>
                   <div class="delivery-wrapper">
                      <p class="delivery delivery-{$product.deliveryTime}">
                          {$product.deliveryTimeText}
                      </p>
                   </div>
                </div>
                <div class="price-wrapper">
                   {calc_product_discount product=$product assign='discount'}
                   {if !$hide_discount && ($discount.discount->asFloat() >= 1) && !$product.variations|count}
                      <span class="flag flag-discount" data-flag>-{$discount.discount->asFloat()|round} %</span>
                   {/if}
                   <div>

                       {foreach $product.variations as $id => $var}
                           {if ($var@first || $var.price < $variation_price)}
                               {$variation_price = $var.price}
                           {/if}
                       {/foreach}

                      {if $product.variations|count}
                         <p class="price"><strong>{if $product.price_array.price_without_vat->lessThan($product.priceMax.price_without_vat) and $product.variations|count}{t}od{/t}&nbsp;{/if}{$variation_price.value_without_vat|format_price}</strong> {t}bez DPH{/t}</p>
                         {else}
                         <p class="price"><strong>{$product.productPrice.value_without_vat|format_price}</strong> {t}bez DPH{/t}</p>
                      {/if}

                      {if $discount.retailPrice}
                         <p class="price-moc">{t}MOC{/t} {$discount.retailPrice|format_price} {t}s DPH{/t}</p>
                      {/if}
                   </div>
                </div>
             </div>

             {catalog_b2b_form_wrapper product=$product variation=null}
          </div>
           {if $product.variations|count}
              <div class="catalog-b2b-list-variations-wrapper" data-product-variations-{$product.id} style="display: none;">
                  {foreach $product.variations as $variation}
                     <div class="catalog-b2b-list">
                        <div class="catalog-b2b-list-content">
                           <div class="title-delivery-wrapper">
                              <div class="title-wrapper">
                                 <h3 class="heading-reset title">{$variation.title nofilter}</h3>
                                  {if $variation.code}
                                     <p class="code">
                                         {t}Kód:{/t}&nbsp;{$variation.code}
                                     </p>
                                  {/if}
                              </div>
                              <div class="delivery-wrapper">
                                 <p class="delivery delivery-{$variation.delivery_time}">
                                     {$variation.delivery_time_text}
                                 </p>
                              </div>
                           </div>
                           <div class="price-wrapper">
                              <p class="price"><strong>{$variation.productPrice->getPriceWithoutVat()|format_price}</strong> {t}bez DPH{/t}
                              </p>
                              {if $discount.retailPrice}
                                 <p class="price-moc">{t}MOC{/t} {$discount.retailPrice|format_price} {t}s DPH{/t}</p>
                              {else}
                                 <p class="price-moc">{t}MOC{/t} {$variation.productPrice->getOriginalPrice()->getPriceWithoutDiscount()->getPriceWithVat()|format_price} {t}s DPH{/t}</p>
                              {/if}
                           </div>
                        </div>

                         {catalog_b2b_form_wrapper product=$product variation=$variation}
                     </div>
                  {/foreach}
              </div>
           {/if}
       </div>
    {/foreach}
</div>
