{extends_parent}

{block 'utils-end' append}
    {get_contexts language=1 assign='language_contexts'}
    {get_unified_product product=$body.product assign="unifiedProduct"}
    {*{$sizeTables = $product_templates[1]}*}
{/block}

{block "main"}
   <main class="main main-product" data-tooltip-wrapper>
      <div class="product-top">
         <div class="container">
             {include "components/breadcrumbs.tpl"}

            <div class="row">
               <div class="col-xl-4 col-lg-5 col-xxs-12 pull-right">
                  <div class="product-top-content">
                      <h1 class="heading-reset">
                          {if $body.product.producer}
                             <span class="product-producer-name">
                                <a href="{url s=category IDcat=0 IDpd=$body.product.producer.id producerTitle=$body.product.producer.title}"
                                   title="{$body.product.producer.title}">
                                    {$body.product.producer.title}
                                </a>
                             </span>
                          {/if}
                          {if $body.product.param[83].value and $body.product.title|strstr:$body.product.param[83].value}
                             <span class="h1">{$body.product.param[83].value}</span>
                             <span class="h3">{$body.product.title|replace:$body.product.param[83].value:''|replace:$body.product.producer.title:''}</span>
                          {else}
                             <span class="h3">{$body.product.title|replace:$body.product.producer.title:''}</span>
                          {/if}
                      </h1>
                     <p class="perex">
                         {$perex = $body.product.descr}
                         {insert_page code='perex_tooltips' assign='perex_tooltips'}
                         {foreach $perex_tooltips.blocks as $block}
                             {if $body.product.descr|lower|strstr:$block.name|lower}
                                 {$perex = $body.product.descr|regex_replace:"/(`$block.name`)/i":"<span data-tooltip='{strip_tags($block.content, '<br/><p><strong>')}'>{$block.name}</span>"}
                                 {break}
                             {/if}
                         {/foreach}
                        <span>{$perex nofilter}</span>

                      <div class="product-items">
                        {get_znz_product_composition_short product=$body.product assign="shortComposition"}
                        {if $shortComposition}
                            {$shortComposition nofilter}
                        {/if}
                     </div>

                      {include "product/product.ajax.tpl" product=$unifiedProduct hide_first_part=1 hide_sticky_info=1 hide_gallery=1}
                     </p>

                      {if $product_reviews.rating_count}
                          {include 'reviews/product.reviews.rating-stars.tpl'}
                      {/if}
                  </div>
               </div>

               <div class="col-xl-8 col-lg-7 col-xxs-12">
                   {include 'product/product.gallery.tpl'}

                  <div class="product-flags flags">
                      {include 'product/product.flags.tpl' product=$body.product hide_discount=false}
                  </div>
               </div>

               <div class="col-xl-4 col-lg-5 col-xxs-12 pull-right">
                  <div class="product-top-content">
                      {include 'product/product.banner.tpl'}

                      {ifmodule PRODUCT_GIFTS}
                          {* modul product_gifts - dárky k produktu *}
                          {include "product/product.gifts.tpl"}
                      {/ifmodule}

                      {if !$body.product->isold()}
                          {insert_products type="collection_product" template="product/block.products.collections.tpl" image='product_cart' product=$body.product.id param_id=90 tooltip_param_id=46}
                         {if $isB2BUser && $body.product.variations.variations|count}
                            {include "product/product.variations.b2b.tpl"}
                         {else}
                             {if $body.product.variations.variations|count}
                                {include "product/product.variations.tpl"}
                             {/if}
                             {include 'product/product.template.tpl' position='price'}
                             {include "product/product.ajax.tpl" product=$unifiedProduct hide_second_part=1 hide_sticky_info=1 hide_gallery=1}
                         {/if}
                      {else}
                          {include "focus/focus.product-watchdog.tpl" class="product-watchdog"}
                          {include "product/product.soldout.tpl"}
                      {/if}
                  </div>
                  <div class="product-sticky-info-helper"></div>
                  {block "product-top-additional"}{/block}
               </div>

               <div class="col-xl-8 col-lg-7 col-xxs-12">
                   {include "product/product.links.tpl"}
               </div>
            </div>
         </div>
      </div>

      {block "product-usp"}
         <div class="product-usp">
            <div class="container">
                {insert_page code='usp'}
            </div>
         </div>
      {/block}

       {include 'product/product.bottom-content.tpl'}

      <div class="container">
          {insert_products type="related_product" related_type=1 product=$body.product count=10 in_store=1 image=2 show_producer=1 template='block.products.carousel.tpl' title="{t}Mohlo by vás zajímat{/t}" id='related-products' listType='detail_related' listId=$body.product.id
          fallback=[['type'=>'also_buyed', 'ID'=>$body.product.id], ['type'=>'related_fallback', 'price_max'=>1200]]}

          {include 'components/block.products.last-visited-ajax.tpl' listType='detail_lastvisited' listId=$body.product.id}

         <script>
            wpj.onReady.push(function(){
               wpj.lastVisitedProducts.addLastVisitedProduct({$body.product.id});
            });
         </script>

      </div>

   </main>
{/block}


{block "body" append}
    {include "focus/focus.sizetable.tpl" class="sizetable" sizeTables=$sizeTables}

    {if !$body.product->isold() and !$isSet}
        {include "focus/focus.product-delivery.tpl" class="product-delivery"}
    {/if}
{/block}
