<div data-variations="variations">
   <script>
      wpj.variations = {ldelim}{rdelim};
   </script>

   {$precheck_single = true}
   {$p = 1}

   {$visible_variations = 0}
   {foreach $body.product.variations.variations as $variation}
      {* varianta je vyprodana a v adminu je vypnute zobrazovani vyprodanych produktu *}
      {if $variation.delivery_time_index != 0 and $dbcfg.prod_show_not_in_store == "N"}
         {continue}
      {/if}
      {$visible_variations = $visible_variations + 1}
   {/foreach}
   <div class="product-variations-header"{if $visible_variations == 1} style="display: none;"{/if}>
      <p class="h4">
         {t}Vyberte variantu{/t}
      </p>
   </div>
   <div class="product-variations"{if $visible_variations == 1} style="display: none;"{/if}>
      {foreach $body.product.variations.variations as $variation}
         {* varianta je vyprodana a v adminu je vypnute zobrazovani vyprodanych produktu *}
         {if $variation.delivery_time_index != 0 and $dbcfg.prod_show_not_in_store == "N"}
            {continue}
         {/if}

         {$soldout = true}

         {if $variation.delivery_time_index == 0}
            {* varianta je skladem *}
            {$soldout = false}
         {elseif $dbcfg.order_not_in_store == 'N' }
            {* varianta není skladem a je zakázáno kupování vyprodaných prod. v adminu *}
            {* $soldout je true *}
         {elseif $cfg.Products.allowSoldoutToCart[$variation.delivery_time_index] or
         ($cfg.Products.allowSoldoutToCart[1] and $variation.delivery_time_index > 0)}
            {* delivery_time_index varianty je povoleny v configu *}
            {$soldout = false}
         {/if}
         <input name="IDvariation" type="radio" value="{$variation.id}" id="var_{$variation.id}"
            {if $soldout and !findModule('watchdog')} disabled
            {elseif $precheck_single and $body.product.variations.variations|count == 1 or $p == 1}checked{/if}
         >
         <label for="var_{$variation.id}"
                class="product-variation{if $body.product.variations.labels[1] && $variation.data.color|count <= 0 || $body.product.variations.labels[8]} product-variation-no-img{/if} product-variation-{if $p % 2 == 0}even{else}odd{/if} {if $soldout}soldout {if findModule('watchdog')}watchdog{else}disable{/if}{/if}"
                data-tooltip="{foreach $variation.combinations as $index => $comb}{$body.product.variations.labels[$comb.id_label].values[$comb.id_value]}{/foreach}">
            {$photo_dimensions = $cfg.Photo.types["product_cart"].size}
            {if !($body.product.variations.labels[1] && $variation.data.color|count <= 0 || $body.product.variations.labels[8])}
               <figure>
                  <img src="{get_photo photo=$variation.photos[0] size='product_cart'}" width="{$photo_dimensions[0]}"
                       height="{$photo_dimensions[1]}"
                       class="img-responsive"
                       alt="{foreach $variation.combinations as $index => $comb}{$body.product.variations.labels[$comb.id_label].values[$comb.id_value]}{/foreach}"
                       loading="lazy">

                  <span class="colors colors-{$variation.data.color|count}">
                     {foreach $variation.data.color as $color}
                        <span style="background-color: #{$color}" ;></span>
                     {/foreach}
                  </span>
               </figure>
            {/if}
            <span class="variation-content">
               <span
                  class="title">{foreach $variation.combinations as $index => $comb}{$body.product.variations.labels[$comb.id_label].values[$comb.id_value]}{/foreach}</span>
               <strong>{$variation.productPrice|format_price}</strong>
               {* todo price per unit *}
            </span>
         </label>
         {$p = $p + 1}
      {/foreach}
   </div>
</div>
