<? global $lang;?>
<div class="products-content">
  <?php
    if ( is_array( $this -> _categories ) ) foreach ( $this -> _categories as $category )
    {
      if ( is_array( $category -> get_products() ) ) foreach ( $category -> get_products() as $product )
      {
        ?>
          <div class="product">
            <div class="product-name">
              <?= $product -> get_name();?>
            </div>
            <div class="product-img">
              <?
              if ( is_array( $product -> get_images() ) ) foreach ( $product -> get_images() as $img )
              {
                if ( !$i++ )
                {
                  ?>
                  <a href='<?= $img;?>' class="fancybox-buttons" rel='<?= $product -> get_id();?>'>
                    <div class="gallery_picture">
                      <div style="background: url( 'resources/thumber.php?img=<?= $img;?>&h=100&w=100' ) no-repeat center;"></div>
                    </div>
                  </a>
                  <?
                }
              }
              ?>
            </div>
            <div class="product-description">
              <?= $product -> get_description();?>
            </div>
            <?
            if ( $product -> get_price() )
            {
              ?>
                <div class="product-price">
                  <?= $product -> get_price();?>
                </div>
              <?
            }
            
            if ( is_array( $product -> get_images() ) && count( $product -> get_images() ) > 1 )
            {
              ?>
              <div class="product_gallery">
                <?
                foreach ( $product -> get_images() as $img )
                {
                  if ( $x++ )
                  {
                    ?>      
                    <a href='<?= $img;?>' class="fancybox-buttons" rel='<?= $product -> get_id();?>'>
                      <div class="gallery_picture">
                        <div style="background: url( 'resources/thumber.php?img=<?=$img;?>&h=100&w=100' ) no-repeat center;"></div>
                      </div>
                    </a>
                    <?
                  }
                }
                ?>
              </div>
              <?
            }
            ?>
          </div>
        <?
      }
//      if ( is_array( $category -> get_subcategories() ) )
//        echo \product\VCategory::drawCategories( $category -> get_subcategories(), $this -> _step + 1 );
    }
  ?>
</div>
<?
if ( $this -> _child )
  echo '<div class="button" onClick="javascript:history.go(-1);" style="margin-top: 20px;">' . $lang -> getTrans( 'T_WSTECZ' ) . '</div>';