0

my file : Vendor/theme/Magento_Catalog/templates/category/products.phtml i made this changes `

if($category_name == 'Featured Product'){?>
     <!--  when Featured Products -->
            <style>
           .sidebar{
                    display:none;

            }
            .toolbar{
                display:none;
            }
        </style>
       <?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('featured_product_top')->toHtml(); ?>

        <?php if (!$block->isContentMode() || $block->isMixedMode()): ?>
            <?= $block->getProductListHtml() ?>
        <?php endif; ?>
    <?}else{?>
    <!--  other ctegories -->
    <?php
        /**
         * Category view template
         *
         * @var $block \Magento\Catalog\Block\Category\View
         */
        ?>
        <?php if (!$block->isContentMode() || $block->isMixedMode()): ?>
            <?= $block->getProductListHtml() ?>
        <?php endif; ?>

    <?php } ?>`
  • you want completely remove side bar for some categories ? – Hassan Ali Shahzad Sep 26 at 19:08
1

You can do this in the category configuration from the Magento admin.

Catalog > Category > Select category to change the layout.

Please see attached screenshot for more information.

enter image description here

Hope this helps!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.