0

I'm trying to move the category image and description into a single div.

They're both in the catalog module under 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">
                    <arguments>
                        <argument name="image" xsi:type="object">Magento\Catalog\ViewModel\Category\Image</argument>
                        <argument name="output" xsi:type="object">Magento\Catalog\ViewModel\Category\Output</argument>
                    </arguments>
                </block>
                <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>

This is my code

<move element="category.description" destination="category.view.container" before="category.image" />

Nothing is happening

1
  • Have you checked my answer?
    – ZealousWeb
    Commented Apr 21, 2021 at 12:21

1 Answer 1

0

As per default magento code category image and description is already in a single div which is "category-view". Both are calling in the same container. According to your "move element" code , it seems you are trying move description before category image and that will be achieve by below code.

In your theme's or module's catalog_category_view.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <move element="category.description" destination="category.view.container" before="-" />
    </body>
</page>

Please check and let me know if you have any query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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