{if $items|count}
   <div class="cartbox-productlist">
      {get_session_value type='added_to_cart' assign='addedToCart'}

      {foreach $items|array_reverse as $item}
         {$item.product->fetchImages($image_size|default:'product_cart')}

         {if $addedToCart and $addedToCart.id == $item.id}
         {if !($dbcfg.analytics.google_tag_manager.gtm_dl_version == '2')}
            {include "block.gtm.tpl" gtm_type="addToCart" addedToCart=$addedToCart inline}
         {/if}

            {if $dbcfg.analytics.fb_pixel.id and !isDebug()}
               <script>
                  fbq("track", "AddToCart", {
                     content_ids: ['{$addedToCart.product.code}'],
                     content_type: "product",
                     currency: '{$ctrl.currency|default:$dbcfg.currency_code}',
                     value: {{$addedToCart.product.price_array.price_with_vat -> asFloat()} * $addedToCart.pieces}
                  });
               </script>
            {/if}

         <script>
            wpj.onReady.push(function () {
               if ($(window).width() < 768 || $(window).height() < 520) {
                  var $new = $('[data-cart="addedToCartNew"]');
                  $('[data-cart="addedToCart"]').replaceWith($new);

                  $new.focus({
                     addBodyPadding: true
                  });
                  $new.focus('show');
                  $new.attr('data-cart', 'addedToCart');
               }
            });
         </script>
            {include "focus/focus.added-to-cart.tpl" class="added-to-cart"}
         {/if}

         {block "cartbox-product"}
            <div class="cartbox-product">
               <div class="product-image img-overlay">
                  <a href="{url s=product IDproduct=$item.id_product|default:$item.id TITLE=$item.title}" title="{t}Zobrazit zboží{/t}">
                     {$photo_dimensions = $cfg.Photo.types["product_cart"].size}
                     <img src="{get_photo photo=$item.product.image size=$image_size|default:'product_cart'}" alt="{$item.title}"
                          class="img-responsive" width="{$photo_dimensions[0]}" height="{$photo_dimensions[1]}">
                  </a>
               </div>

               <div class="product-content">
                  <p class="product-title">
                     <a title="{t}Zobrazit zboží{/t}" href="{url s=product IDproduct=$item.id_product}">
                        <strong>{$item.product.model_short_title}</strong>
                        {if !$item.product.set}{$item.title|replace:$item.product.model_short_title:''}{else}{t}Kazeta{/t} {$item.product.set}{/if}
                     </a>
                     {block "cartbox-sidebar-product-price"}
                        <strong class="product-price">{$item.price.value_with_vat|format_price}</strong>
                     {/block}
                  </p>

                  <form action="{url s=cart}?act=recount" method="get" class="product-pieces">
                     <div class="pieces">
                        <div class="buy-count-wrapper">
                           <input type="number" name="products[{$item.id}][pieces]" value="{$item.pieces}"
                                  class="form-control" step="1" min="1" data-cartbox-pieces>
                           <div class="buy_count">
                              <button type="button" class="fc plus" title="{t}Přidat 1 ks{/t}" data-cart="plus"{if $dbcfg.analytics.google_tag_manager.gtm_dl_version == '2'} data-tracking-click='{get_gtm_data encode=true type='ecommerce' method='ClickAddToCart' data=['product' => $item.product, 'listType' => 'cartbox']}'{/if}></button>
                              <button type="button" class="fc minus" title="{t}Odebrat 1 ks{/t}" data-cart="minus"{if $dbcfg.analytics.google_tag_manager.gtm_dl_version == '2'} data-tracking-click='{get_gtm_data encode=true type='ecommerce' method='ClickRemoveFromCart' data=['product' => $item.product]}'{/if}></button>
                           </div>
                        </div>
                     </div>
                  </form>


                  <a href="{url s=cart act=erase IDInCart=$item.id}" class="delete-product"
                     title="{t}Odebrat produkt z košíku{/t}" data-cart="delete"
                          {if $dbcfg.analytics.google_tag_manager.gtm_dl_version == '2'}
                             data-tracking-click='{get_gtm_data encode=true type='ecommerce' method='ClickRemoveFromCart' data=['product' => $item.product]}'
                          {else}
                             data-tracking-click="{['action'=>'cartRemove','event'=>'cartRemove','sku'=>$item.id_product, 'qty'=>$item.pieces]|json_encode}"
                          {/if}
                  >
                     <span class="fc icons_trash"></span>
                  </a>

               </div>
            </div>
         {/block}
      {/foreach}
      {if $count > 0 and $items|count > $count}
         <div class="more-products">
            <a href="{url s=cart}">
               {t}... a{/t} {$cartInfo.items|count-$count}
               {t plural="další produkty" plural5="dalších produktů" count={$cartInfo.items|count-$count} items={$cartInfo.items|count-$count}}další produkt{/t}
            </a>
         </div>
      {/if}
   </div>
{/if}
