<?php foreach ($categories as $category): ?>
  <div class="category-layout <?php echo $journal3->classes($category['classes']); ?>">
    <div class="category-thumb">
      <?php if ($images): ?>
      <div class="image">
        <?php if ($category['total_text'] && $productsCountTextPosition == 'image'): ?>
          <div class="product-count product-count-image <?php if ($category['total'] <= 0): ?>product-count-zero<?php endif; ?>"><?php echo $category['total_text']; ?></div>
        <?php endif; ?>
        <a href="<?php echo $category['href']; ?>">
          <?php if ($journal3->get('performanceLazyLoadImagesStatus')): ?>
            <img src="<?php echo $dummy_image; ?>" data-src="<?php echo $category['thumb']; ?>" <?php if ($category['thumb2x']): ?>data-srcset="<?php echo $category['thumb']; ?> 1x, <?php echo $category['thumb2x']; ?> 2x" <?php endif; ?> width="<?php echo $image_width; ?>" height="<?php echo $image_height; ?>" alt="<?php echo $category['name']; ?>" title="<?php echo $category['name']; ?>" class="img-responsive lazyload"/>
          <?php else: ?>
            <img src="<?php echo $category['thumb']; ?>" <?php if ($category['thumb2x']): ?>srcset="<?php echo $category['thumb']; ?> 1x, <?php echo $category['thumb2x']; ?> 2x" <?php endif; ?> width="<?php echo $image_width; ?>" height="<?php echo $image_height; ?>" alt="<?php echo $category['name']; ?>" title="<?php echo $category['name']; ?>" class="img-responsive"/>
          <?php endif; ?>
        </a>
      </div>
      <?php endif; ?>

      <div class="caption">
        <div class="name"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a><?php if ($category['total_text'] && $productsCountTextPosition == 'name'): ?><div class="product-count product-count-name <?php if ($category['total'] <= 0): ?>product-count-zero<?php endif; ?>"><?php echo $category['total_text']; ?></div><?php endif; ?></div>

        <?php if ($category['total_text'] && $productsCountTextPosition == 'below'): ?>
        <div class="product-count product-count-below <?php if ($category['total'] <= 0): ?>product-count-zero<?php endif; ?>"><?php echo $category['total_text']; ?></div>
        <?php endif; ?>

        <div class="description"><?php echo $category['description']; ?></div>
        <?php if ($viewMoreText): ?>
            <div class="button-group">
              <a class="btn btn-view-more" href="<?php echo $category['href']; ?>" <?php if ($journal3->is_desktop && ($journal3->get('CategoryButtonDisplay') == "icon") && $journal3->get('CategoryButtonTooltipStatus')): ?>data-toggle="tooltip-hover" data-tooltip-class="<?php echo $module_id ? 'module-categories-' . $module_id . ' module-categories-grid' : 'category-grid'; ?> view-more-tooltip" data-placement="<?php echo $journal3->get('CategoryButtonTooltipPosition'); ?>"<?php endif; ?> title="<?php echo $viewMoreText; ?>">
                <span class="btn-text"><?php echo $viewMoreText; ?></span>
              </a>
            </div>
        <?php endif; ?>
      </div>
    </div>
  </div>
<?php endforeach; ?>
