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 } ?>`
1
  • you want completely remove side bar for some categories ? Sep 26, 2019 at 19:08

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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