1

I want to customize the design of catalog list page. ** I want to use different layout and design for each product category**. for that, I am calling different phtml files from static block. using static block I am calling another phtml file but still in product list page default Magento list.phtml files are load. i don't know what actually issue please help me! I am using Magento 2.1.1 version

4

You need to create a xml file catalog_category_view_id_{{id}}.xml under your theme > Magento_Catalog > layout and change list file.

For detail : http://sumankc.com/2016/12/10/different-template-for-different-categories-in-magento-2-category_id-layout-handle-in-m2/

  • hi Bhudiya, Could you please how you achieved ? I want to create different templates for different category top menu – Sushivam Feb 21 '17 at 6:37
3

Created customlist.phtml from list.phtml or copied the code of list.phtml and create

Assign customlist.phtml in admin side (admin → category → Layout section)

<referenceContainer name="content">
    <referenceBlock name="category.products">
        <block name="product_list" class="Magento\Catalog\Block\Product\ListProduct">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Magento_Catalog::product/customlist.phtml</argument>
            </action>
        </block>
    </referenceBlock>
</referenceContainer>
0

I'm unable to add a comment so I'm going to post an answer.

catalog_catalog_view.xml has a block with the product list template in there. If you didn't remove it from that xml file, then it will always display in all the other product category.

Is the list.phtml suppose to only load on certain pages?

If so, then in admin > products > categories > you product category, under design, you can add the below code to update the layout and have the list.phtml removed from that category page.

<block name="category.products.list" remove="true"/>

Let me know if this is what you were looking to do.

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.