{$colorVariations = false}
{foreach $product.variations as $variation}
    {if $variation.values[15]}
        {$colorVariations = true}
    {/if}
{/foreach}

{if $product.variations}
   <button type="submit" class="catalog-add-to-cart {if $product.variations}has-variations{/if}"
           title="Vložit do košíku"></button>
   <div class="catalog-variations">
       {$v = 0}
       {foreach $product.variations as $id => $var}
           {*{calc_product_discount product=$product variation=$var assign='discount_var'}
           {if !$discount || ($discount_var.discount->asFloat() > $discount.discount->asFloat())}
               {$discount = $discount_var}
               {$discounted_variation = $var}
           {/if}*}

           {if $var.delivery_time != 0 and $dbcfg.prod_show_not_in_store == "N"}
               {* varianta je vyprodana a v adminu je vypnute zobrazovani vyprodanych produktu *}
               {continue}
           {/if}

           {$soldout = true}

           {if $var.delivery_time == 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 *}
           {elseif $cfg.Products.allowSoldoutToCart[$var.delivery_time] or
           $cfg.Products.allowSoldoutToCart[1] and $var.delivery_time > 0}
               {* delivery_time_index varianty je povoleny v configu *}
               {$soldout = false}
           {/if}


           {if $v == 4 and !$var@last}
              <a href="{url s=product IDproduct=$product.id TITLE=$product.title}"
                 title="{t pocet={$product.variations|count - 4}}a {pocet} další velikosti{/t}"
                      {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}>+{$product.variations|count - 4}</a>
               {break}
           {elseif !$soldout}
              <div class="catalog-variation">
                  {if $var.photo}
                      {$photoId = $var.photo}
                     <a href="{url s=product IDproduct=$product.id TITLE=$product.title}#{$var.id}"
                        class="color-var"
                        data-photo="{get_photo id=$photoId image=$img_size|default:'product_catalog'}"
                     >
                        <input name="IDvariation" type="radio" value="{$id}" id="varX_{$id}">

                         {if $var.values|count > 1}
                             {foreach $var.values as $id => $value}
                                 {if $id == 15}{continue}{/if}
                                <p>{$value}</p>
                             {/foreach}
                         {else}
                             {foreach $var.values as $id => $value}
                                <p>{$value}</p>
                             {/foreach}
                         {/if}

                        <p class="price">
                            {if $ctrl.dealer == "Y"}
                                {$var.price.value_without_vat|format_price}
                            {else}
                                {$var.price.value_with_vat|format_price}
                            {/if}
                        </p>
                     </a>
                  {else}
                     <input name="IDvariation" type="radio" value="{$id}" id="varX_{$id}">
                      {', '|implode:array_filter($var.values)}
                     <p class="price">
                         {if $ctrl.dealer == "Y"}
                             {$var.price.value_without_vat|format_price}
                         {else}
                             {$var.price.value_with_vat|format_price}
                         {/if}
                     </p>
                  {/if}
              </div>
               {$v = $v+1}
           {/if}
       {/foreach}
   </div>
{/if}
