{extends_parent}

{block "main-class"}main-category{/block}

{block "main"}
   <main class="main product-main">
      <div class="category-header">
         <div class="container">
             {get_photos type='sections' id=$body.category.id assign='category_photos'}
            <div class="category-banner{if $category_photos} has-img{else} no-img{/if} {if $body.category.blocks[0].identifier == "light_text"}text-light{/if}"
                 {if $category_photos}style='background-image: url("{get_photo image=19 photo=$category_photos[0].img}")'{/if}>

                {include "components/breadcrumbs.tpl"}

               <div data-reload="h1">
                   {if $body.filter_active}
                      <h1><span>{$body.category.name}</span></h1>
                       {$subtitle = {$view->getTitle()}|replace:$body.category.name:""|lower}
                       {$parts=" "|explode:$subtitle}
                       {if $parts[1]}
                          <h3>{$parts[1]|ucfirst}{$subtitle|replace:$parts[1]:" "}</h3>
                       {/if}
                   {else}
                      <h1><span>{$view->getTitle()}</span></h1>
                   {/if}
               </div>
               <div class="annotation">
                   {$body.category.blocks[0]|inline_edit nofilter}
               </div>

                {if $body.category.blocks[1]}
                   <div class="read-more">
                      <a href="#category-block" class="read-more-link" data-scrollto>{t}Více{/t}</a>
                   </div>
                {/if}
            </div>
         </div>
      </div>

      <div class="category-header">
         <div class="container">
            <div class="row">
                {insert_subsections category=$body.category up=false}
            </div>
         </div>
      </div>
      <div class="container">
         <div class="category-body" data-filter="wrapper" data-filter-element>
             {if $body.productsList|count}
                <div class="category-products" data-filter="products">
                    {include "filter/filter.top.tpl"}
                   <div data-reload="products">
                       {if $ctrl.dealer == "Y"}
                           {include "block.products.list.tpl" products=$body.productsList}
                       {else}
                           {include "block.products.tpl" products=$body.productsList catalog_class="col-xxl-3 col-lg-4 col-sm-6 col-xxs-12"}
                       {/if}

                       {if $body.pager.count > 1}
                           {include "components/pager.tpl" pager=$body.pager load_button=true}
                       {/if}
                   </div>
                </div>
             {else}
                <div data-reload="products">
                   <div class="alert alert-info">
                      Žádný produkt
                   </div>
                </div>
             {/if}
         </div>
      </div>

       <div class="container">
           {include "components/banner-effects.tpl"}
       </div>

       {if $cfg.tpl.category_banner_small}
           {if $body.category.blocks[1]}
              <div class="container-small category-block" id="category-block">
                  {$body.category.blocks[1]|inline_edit nofilter}
              </div>
           {/if}
       {else}
           {if $body.category.blocks[1]}
              <div class="container category-block-wide" id="category-block">
                  {$body.category.blocks[1]|inline_edit nofilter}
              </div>
           {/if}
       {/if}

       <div class="container">
           {insert_slider label="home-reviews" template="block.slider.reviews.tpl"}
       </div>

       {include "components/badges.tpl"}

       <div class="container news">
           {include "components/newsletter.tpl"}
       </div>
   </main>
{/block}

