<?php
/**
 * Category view template
 *
 * @var $block \MGS\ThemeSettings\Block\Category\Landing
 */
?>
<?php $category = $this->getCurrentCategory() ?>
<?php $themeSettingConfig = $this->getThemeSettingConfig() ?>
<?php $_categories = $category->getChildrenCategories(); ?>
<?php if(count($_categories)>0): ?>
    <div class="landing-categories-parallax">
        <div class="line">
            <?php $i =0; foreach ($_categories as $_category): ?>
                <?php if ($_category->getIsActive()): ?>
                    <?php $i++; ?>
                    <?php $image = $_category->getFbuilderThumbnail();?>
                    <div class="landing-parallax-item col" style="background-image: url('<?php echo $block->getImageUrl($image); ?>');">
                        <div class="landing-parallax-detail">
                            <h2><a href="<?php echo $_category->getUrl() ?>" title="<?php echo $block->escapeHtml($_category->getName()) ?>"><?php echo $block->escapeHtml($_category->getName()) ?></a></h2>
                            <div class="landing-parallax-count">
                                <?php echo __('%1 product (s)', $_category->getProductCount());  ?>
                            </div>
                            <?php if(!$category->getHideDescription()): ?>
                                <?php $_description = $this->helper('Magento\Catalog\Helper\Output')->categoryAttribute($_category, $_category->getDescription(), 'description') ?>
                                <?php if ($_description): ?>
                                    <div class="landing-parallax-shortdes">
                                        <div class="category-description">
                                            <?php echo $themeSettingConfig->truncateString($_description, $category->getTruncateDescription()) ?>
                                        </div>
                                    </div>
                                <?php endif ?>
                            <?php endif ?>
                            <a class="btn btn-primary margin-top10" href="<?= $_category->getUrl()?>"><?php echo __('Shop Now'); ?></a>
                        </div>
                    </div>
                <?php endif; ?>
            <?php endforeach ?>
        </div>
    </div>
<?php endif ?>
