{if !$changeStart}
    {$changeStart = 0}
{/if}
<style type="text/css" media="all">
    @media print {
        @page
        {
            margin: 0mm 0mm 0mm 0mm !important;
            padding: 0;
        }
    }

    BODY
    {
        margin:0;
        padding: 0;
    }
    #Stitky{
        text-align: center;
        position:relative;
        box-sizing: border-box;
        page-break-inside:always;
        float:left;
        width:104mm;
        margin:0;
        padding: 0;
    }

    {$width = 104}
    {$height = 150}
    #stitek{
        width: {$width}mm ;
        height: {$height / 4}mm ;
        float: left;
        text-align: center;
        padding: 0 5mm;
        box-sizing: border-box;
    }

    #barcode{
        margin-top: 15px;
        height: 40px;
        overflow: hidden;
    }
    p.title{
        font-size:13px;
        height: 13px;
        overflow: hidden;
        margin:0;
        padding:0;
        margin-bottom: 10px;
    }
    p{
        font-size:12px;
        height: 13px;
        padding:0 20px;
    }
    .stitek_body{
        width:100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .stitek_code{
        font-size: 17px;
    }
</style>
{$count = $count_columns * $count_rows}
{$counter = $count_columns * $count_rows}
{foreach $products as $key => $product}
    {for $repeat = 1 to $product.pieces}
        {if $counter == $count}
            <div id="Stitky">
        {/if}
        {for $for = 1 to $change_start}
            {$change_start =- 1}
            <div id="stitek">
            </div>
            {$counter = $counter -1}
        {/for}
       {block stitek}
           <div id="stitek">

              <div class="stitek_body">
                  <div>
                  {block catalog_number}
                      <p style="text-align: center" class="stitek_code">
                          {$product.code}
                      </p>
                  {/block}
                 {block barcode}
                     <div id="barcode">
                        {if !empty($product.barcode.chars)}
                         <img src="{$cfg.Addr.full}_wpj/barcode/?oID={urlencode($product.barcode.chars)}&type={$product.barcode.chars_type}&height=40">
                        {/if}
                     </div>
                 {/block}
                 {block descr}
                     <p>
                         <span style="float: left">{$product.product_title}</span>
                     </p>
                    {if $product.ean}
                       <p>
                          <span style="float: left">EAN:{$product.ean}</span>
                       </p>
                    {/if}
                 {/block}
                  </div>
                  <div>
                        <img src="{$product.url}">
                  </div>
              </div>
           </div>
       {/block}
        {$counter = $counter -1}
        {if $counter == 0}
            </div>
            {$counter = $count}
        {/if}
    {/for}
{/foreach}
