0

i want to add another category description section after the product listing on category view page.

Is it possible without coding in Magento 2.2? If not how can i put it?

0

This is not possible to do from the admin. You have to create an XML file to get this working. There are a few different ways to do this, but i will show you the way using a custom theme. Create a file here:

app/design/frontend/{vendor_namespace}/{theme_name}/Magento_Catalog/layout/catalog_category_view.xml

And use this code here:

<?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>
        <referenceContainer name="content">
            <block class="Magento\Catalog\Block\Category\View" name="category.description.bottom" template="Magento_Catalog::category/description.phtml" after="-"/>
        </referenceContainer>
    </body>
</page>

This will place the secondary category description at the bottom of the content of the page. This might not be the right place for you, but you can play with the referenceContainer you are looking to place this in and get the results you are looking for.

---Edit---

For all categories

After more information, if you are looking to place the same content at the bottom of all categories you can use a Widget to do this. Create a Block in the admin under Content -> Blocks with the info that you want. Then create a new Widget under Content -> Widgets. Inside here you have to link this new widget to the theme you are using and give it a name. This can't be changed down the line, so if you have multiple themes you will need to make a widget for each.

Inside here you set the required field and choose the location of where you want the widget to go.

enter image description here

In the other tab you can select the Block you created earlier. Now this block will show up at the bottom of every category on the site.

For just one category

There is a little "hack" that you can use if you just want content on just one category. You can create a xml file that is locked to just one id and place your call to a template (or cms block if you like) there.

app/design/frontend/{vendor_namespace}/{theme_name}/Magento_Catalog/layout/catalog_category_view_id_20.xml

With this in place, you can now make any calls you like and it will only show on that category.

<?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>
        <referenceContainer name="content">
            <!--calling a template file-->
            <block class="Magento\Catalog\Block\Category\View" name="single.category.description.bottom" template="Magento_Catalog::category/cat-specific-description.phtml" after="-"/>
            <!--or calling a cms block in from the admin -->
            <block class="Magento\Cms\Block\Block" name="your_block">
                <arguments>
                    <argument name="block_id" xsi:type="string">your_block_name_here</argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>
  • it must be unique content for every category same as default category description. – Efex Feb 17 '18 at 15:30
  • as in you need two different text fields in the admin? You want to have a category description in the normal place and another place for category content at the bottom of the page? – circlesix Feb 17 '18 at 23:41
  • Yes ........... – Efex Feb 18 '18 at 1:06
  • I've updated my answer. If it's still not on track, please update your question with exactly what you are trying to achieve. – circlesix Feb 18 '18 at 16:19
  • it's ok but how can i put it under product listing on category page? snag.gy/6WDTAg.jpg – Efex Feb 18 '18 at 21:24

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.