<?php
$helper = $block->getHelper();
$isEnabled = $helper->isEnabledHtmlSitemap();
$enableCms = $helper->isEnabledCMS();
$enabledCategory = $helper->isEnabledCategory();
$enabledProduct = $helper->isEnabledProduct();
?>
<?php if ($isEnabled): ?>
    <?php if ($enableCms): ?>
        <div class="col-sm-6">
            <h2 class="title"><?= /*@noEscape*/ __('CMS Pages')?></h2>
            <?php
                $getCMS = $block->getCmsPages();
            foreach ($getCMS as $item => $value) {
                if (!$value->getIsActive()) {
                    continue;
                }
                 /*@noEscape*/ echo '<h4 class="cms_page_link">
                                    <a href="' . $block->getBaseUrl() . $value->getIdentifier() . '/" title = "' .
                $value->getTitle() . '"">' . $value->getTitle() . '</a>
                                </h4>';
            } ?>
        </div>
    <?php endif;?>
    <?php if ($enabledCategory): ?>
        <div class="col-sm-6">
            <h2 class="title"><?= /*@noEscape*/ __('Categories')?></h2>
            <?php
                $categories = $block->getCategoryCollection(); ?>
                <?php foreach ($categories as $category):
                    if (!$category->getIsActive()) {
                        continue;
                    } ?>
                    <div class="bss_h3">
                        <?= /*@noEscape*/ $category->getName()?>
                    </div>
                        <?php
                            $setAllCategories = $block->getAllCategories($category);
                             /*@noEscape*/ echo $setAllCategories; ?>
                <?php endforeach; ?>
        </div>
    <?php endif;?>
    <?php if ($enabledProduct): ?>
        <h2 class="heading"><?= /*@noEscape*/ __('Products'); ?></h2>
        <div class="grid"> 
            <?php
            $productCollection = $block->getProductCollection();
            foreach ($productCollection as $product) {
                /*@noEscape*/ echo $product->getData("id");
               /*@noEscape*/ echo '<div class="product_link" style = "display:inline-block;padding:0 10px;">
                        <h4 class="sitemap_product_list">
                        <a href="'.$product->getUrlModel()->getUrl($product).'"
                        title = "'.$product->getName().'" >'.$product->getName().'</a>
                        </h4>
                    </div>';
            }
            if ($block->getPagerHtml()): ?>
                <div class="order-products-toolbar toolbar bottom"><?= /*@noEscape*/ $block->getPagerHtml(); ?></div>
            <?php endif ?>
        </div>
    <?php endif;?>
   
<?php endif;?>
