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?– NikolasAug 27, 2017 at 19:50
1 Answer
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>
-
-
I put the file in app/design/frontend/vendor/myname/Magento_Catalog/templates/product/list/toolbar/toolbar.phtml. Right? Aug 27, 2017 at 21:50
-
Yes.Check how to override a template magento.stackexchange.com/questions/116389/…– NikolasAug 28, 2017 at 7:59