0

How do I remove the sorting and positioning tools from the category page in frontend? Can I remove them in a way that I only disable them from one category?

  • For Magento 1 or Magento 2? – Nikolas Aug 27 '17 at 19:50
1

You can remove it by overriding the following template

/vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar.phtml

and comment out the following code

   <?php if ($block->isExpanded()): ?>
            <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/sorter.phtml')) ?>
   <?php endif; ?>

This will affect all categories.

To do it for a specific category. Create in your theme a custom_toolbar.phtml file like the original but with commented out the above code. Then go to the specific category in Magento admin, click on the tab Design and on the Layout Update XML add the following code

<referenceBlock name='product_list_toolbar'>
    <action method='setTemplate'>
        <argument name='template' xsi:type='string'>Magento_Catalog::product/list/custom_toolbar.phtml</argument>
    </action>
</referenceBlock>

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.