1

I'm trying to have 2 pieces of static content on a category page. One directly beneath the category title and another below the product listings. I notice Categories have a "description" and support a static block, so my plan is to use "description" for one section of text and a static block for the other.

The problem I'm having is moving the static block with a layout update. What I'm doing is using the identifier of the static block and a layout update like this:

<move element="test-category-block" destination="content" after="-"/>

However the static block is not moving. Any idea why not?

1

I looked at the base catalog_category_view.xml file in vendor/magento/module-catalog/view/frontend/layout/catalog_category_view.xml:

<referenceContainer name="columns.top">
    <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>

In accordance with that, changing the layout update from the identifier of the static block to category.cms solved it.

|improve this answer|||||

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.