Magento 2: remove the category image and description from the corresponding XML file
-
23-12-2020 - |
Вопрос
I am working on a Magento 2.1.7 shop and I have created a child-theme of Magento Blank.
I need to eliminate the category image and description, more exactly the <div class="category-view"><!-- More code here --></div>
element from the category page.
The file to edit, if I am not wrong, is app/design/frontend/Company_Name/Theme_Name/Magento_Catalog/layout/catalog_category_view.xml
.
What is the piece of code I have to edit in order to eliminate the category image and description?
Thank you!
Решение
Try adding below code in your
app/design/frontend/Company_Name/Theme_Name/Magento_Catalog/layout/catalog_category_view.xml
<referenceBlock name="category.image" remove="true"/>
<referenceBlock name="category.description" remove="true"/>
Другие советы
I have removed the block that contains both of them this by adding remove="true"
to the columns.top element.
<referenceContainer name="columns.top" remove="true">
<container name="category.view.container" htmlTag="div" htmlClass="category-view" after="-">
<block class="Magento\Catalog\Block\Category\View" name="category.image" template="Magento_Catalog::category/image.phtml"/>
<block class="Magento\Catalog\Block\Category\View" name="category.description" template="Magento_Catalog::category/description.phtml"/>
<block class="Magento\Catalog\Block\Category\View" name="category.cms" template="Magento_Catalog::category/cms.phtml"/>
</container>
</referenceContainer>