app/design/frontend/Themeness/minu/Magento_Catalog/templates/category/products.phtml
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ ?> <?php /** * Category view template * * @var $block \Magento\Catalog\Block\Category\View */ ?> <?php $category = $block->getCurrentCategory(); ?> <?php $subcategories = $category->getChildrenCategories(); ?> <?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?> <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); ?> <?php if(count($subcategories) > 0): ?> <div class="products wrapper grid products-grid"> <ol class="products list items product-items"> <?php foreach($category->getChildrenCategories() as $subcategory): ?> <?php $subcategory = $objectManager->create('Magento\Catalog\Model\Category')->load($subcategory->getId()); ?> <li class="item product product-item"> <div class="product-item-info"> <?php if ($_imgUrl = $subcategory->getImageUrl()): ?> <a href="<?= $subcategory->getUrl() ?>" class="product photo product-item-photo"> <span class="product-image-container"> <?php $_imgHtml = '<img src="' . $_imgUrl . '" />'; ?> <?php echo $_imgHtml = $_helper->categoryAttribute($subcategory, $_imgHtml, 'image'); ?> </span> </a> <?php endif; ?> <div class="product details product-item-details"> <strong class="product name product-item-name"> <a class="product-item-link" href="<?= $subcategory->getUrl() ?>"><?= $subcategory->getName() ?></a> </strong> </div> </div> </li> <?php endforeach; ?> </ol> </div> <?php else: ?> <?php if (!$block->isContentMode() || $block->isMixedMode()): ?> <?= $block->getProductListHtml() ?> <?php endif; ?> <?php endif; ?>