2

I want to use the different file for a category but not working.

For that I have change under Catalog > Categories > Layout Update XML

I have check with both arguments and action but not working

Path of my list File : Magento_Catalog::product/my-own-list.phtml

Using Action

<referenceBlock name="category.products.list">
     <action method="setTemplate">
        <argument name="template" xsi:type="string">Magento_Catalog::product/my-own-list.phtml</argument>
     </action>
</referenceBlock>

Using Argument

<referenceBlock name="category.products.list">
<arguments>
<argument name="template" xsi:type="string">Magento_Catalog::product/my-own-list.phtml</argument>
</arguments>
</referenceBlock>
6

Try with this:

<referenceContainer name="content">
    <referenceBlock name="category.products.list">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Magento_Catalog::product/my-own-list.phtml</argument>
        </action>
    </referenceBlock>
</referenceContainer>

Magento 2 for some reason doesn't allow <referenceBlock> as the starting element, but you can bypass this limitation by referencing the parent container.

  • I have clear the cache and working fine, thanks – Bachcha Singh Jan 6 '18 at 6:18
  • After adding <referenceContainer> I was still having trouble getting the updates to display in one environment. Turns out this category data is stored in an index and my cron:run was failing. Found this when running CLI magento indexer:reindex and layout updated started working. – Ian at Xantek Apr 18 '18 at 13:05

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.