{if !$hide_first_part}
   <div data-reload="variation">
       {if !$product}
           {$product = $body.product}
       {/if}
       {$isSet = isset($product.campaign_codes.PS)}

       {$product_soldout = true}

       {if $product.deliveryTime == 0}
           {$product_soldout = false}
       {elseif $dbcfg.order_not_in_store == 'N' }
       {elseif $cfg.Products.allowSoldoutToCart[$product.deliveryTime] or
       $cfg.Products.allowSoldoutToCart[1] and $product.deliveryTime > 0}
           {$product_soldout = false}
       {/if}

       {if !$isSet}
          <div class="variation-single">
              {if $product.variationId}
                  {if $product.product.variations.variations[$product.variationId].combinations|count > 1}
                      {foreach $product.product.variations.variations[$product.variationId].combinations as $index => $comb}
                          {if $comb.id_label == 15}
                             <p data="{$comb.id_value}">{t}Hmotnost:{/t} {$product.product.variations.labels[15].values[$comb.id_value]}</p>
                          {/if}
                      {/foreach}
                  {/if}
              {/if}
          </div>
           {include "product/product.price-block.tpl"}
       {/if}
       {if !$product_soldout}
          <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}" data-detail-productid>
              {if $product.variationId}
                 <input type="hidden" name="IDvariation" value="{$product.variationId}">
              {/if}

              {if $isSet}
                  {include "product/sets/product.submit-block.set.tpl"}
              {else}
                  {include "product/product.submit-block.tpl"}
              {/if}

              {if $isSet}
                  {include "product/sets/product.sets.selected.tpl"}
                  {include "product/product.price-block.tpl"}
              {else}
                 <p class="delivery-timetable">
                    <span class="delivery delivery-{$product.deliveryTime}" data-deliverytime>
                        {$product.deliveryTimeText}
                        {if $product.inStore > 5}
                           > 5 {t}ks{/t}
                        {/if}
                    </span>
                 </p>
                  {if $product.deliveryTime == 0}
                      {get_delivery_dates product=$product assign='deliveries'}
                      {if $deliveries.min.deliveryPrice->getValue()->isPositive()}
                          {$text = "{t}od {/t}"}
                          {$price = $deliveries.min.deliveryPrice|format_price}
                      {else}
                          {$text = "{t}zdarma{/t}"}
                          {$price = ''}
                      {/if}
                      {if $deliveries.min.delivery}
                         <div class="delivery-info">
                            <p>{t price=$price text=$text date=$deliveryDate|format_date_locale_pretty:'d. L.':null:true escape=false}Ihned k odeslání
                                  <strong>{text}{price}</strong>{/t}
                               , {t date=$deliveries.min.delivery|format_date_locale_pretty:'d. L.':null:true escape=false}u vás doma již
                                  <strong>{date}</strong>{/t}</p>
                            <span class="delivery-{$product.deliveryTime}"></span>
                            <a href="" data-focus-opener="product-delivery">{t}Možnosti dopravy{/t}</a>
                         </div>
                      {/if}
                  {/if}

                  {*{include "focus/focus.product-delivery.tpl" class="product-delivery"}*}
              {/if}
          </form>
       {else}
           {ifmodule WATCHDOG}
               {include "product/product.watchdog.tpl"}
           {/ifmodule}
       {/if}

       {ifmodule QUANTITY_DISCOUNT}
           {include "product/product.quantityDiscounts.tpl"}
       {/ifmodule}

       {ifmodule BONUS_PROGRAM}
           {include "product/bonus-points.tpl"}
       {/ifmodule}

       {ifmodule SHOPPING_LIST}
       {if $ctrl.logged}
           {include "focus/focus.add-shopping-list.tpl" class="shopping-list" }
       {/if}
       {/ifmodule}

       {*{ifmodule RESERVATIONS}
          <a href="#"
             data-wpj-focus="{path('kupshop_reservation_reservation_focusreservationcreate', ['productId' => $product.id, 'variationId' => $product.variationId])}"
             data-wpj-focus-ajax="1">
             Rezervovat zboží
          </a>
       {/ifmodule}*}
   </div>
{/if}

{if !$hide_gallery}
    {$image_type = "product_detail"}
    {$visible_photos = 3}
    {$css_class = 'col-sm-6 col-xxs-12'}
    {$hidden_photos = $body.product.photos|count - $visible_photos}
   <div data-reload="variation-gallery">
       {$image = $product.product.image}
       {$product_photos = $body.product.photos}
       {if $product.variationId and $product.product.variations.variations[$product.variationId].photos[0]}
           {$visible_photos = 4}
           {$hidden_photos = $product.product.variations.variations[$product.variationId].photos|count - $visible_photos}
           {$product_photos = $product.product.variations.variations[$product.variationId].photos}
           {$image = $product.product.variations.variations[$product.variationId].photos[0]}
       {else}
          <div class="{$css_class} gallery-item">
              {$main_photo_dimensions = $cfg.Photo.types["product_detail"].size}
             <a {if $image}href="{get_photo photo=$image size=0}" data-rel="gallery"{/if}>
                <img src="{get_photo photo=$image size=3}"
                     alt="{$image.descr|default:$product.title}" class="img-responsive" width="{$main_photo_dimensions[0]}"
                     height="{$main_photo_dimensions[1]}" fetchpriority="high">
             </a>
          </div>
       {/if}

       {if $product_photos}
           {foreach $product_photos as $photo}
               {if $photo@iteration == ($visible_photos + 1)}
                  <a href="{get_photo photo=$photo size=0}" data-rel="gallery" class="btn gallery-more-photos">
                     <img src="{get_photo photo=$image size=$image_type}" alt="{$photo.descr|default:$body.product.title}"
                          class="img-responsive"
                          width="{$cfg.Photo.types[$image_type].size[0]}" height="{$cfg.Photo.types[$image_type].size[1]}">
                     <span class="fc icons_image"></span>
                     <span class="count">+{$hidden_photos}&nbsp;{t plural="další" plural5="dalších" count=$hidden_photos}další{/t}</span>
                  </a>
               {else}
                  <div class="{$css_class} gallery-item{if $photo@iteration > $visible_photos} gallery-item-hidden{/if}">
                     <a href="{get_photo photo=$photo size=0}" data-rel="gallery">
                        <img src="{get_photo photo=$photo size=$image_type}"
                             alt="{$photo.descr|default:$body.product.title}"
                             width="{$cfg.Photo.types[$image_type].size[0]}" height="{$cfg.Photo.types[$image_type].size[1]}"
                             class="img-responsive">
                     </a>
                  </div>
               {/if}
           {/foreach}
       {/if}
   </div>
{/if}
