I am trying to override theme layout block.
Layout is on path: app/design/frontend/Codazon/unlimited/default/Magento_Catalog/layout/catalog_category_view.xml
Theme is adding its custom block in content container.
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="cdz-cat-layout-config" template="Magento_Catalog::category/cat-layout-config.phtml" after="-" />
</referenceContainer>
</body>
</page>
Now, I am trying to override that block class and template so I have in my module layout on the following path
app/code/SmSoftware/CspFix/view/frontend/layout/catalog_category_view.xml
template itselt is on this path:
app/code/SmSoftware/CspFix/view/frontend/templates/category/cat-layout-config.phtml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<referenceBlock class="SmSoftwareCspFixBlockThemeCsp" name="cdz-cat-layout-config"
template="SmSoftware_CspFix::category/cat-layout-config.phtml" />
</referenceContainer>
</body>
</page>
I have tried setting my template file in theme layout and that works. Since that solution is not really acceptable I would appreciate someone’s help trying to find the problem in overriding layout in my module.
All block I try to override in that specific layout are not working. Also in some blocks I tried to set $_template to be my template and in di.xml added record for overriding block class, but that is not working either.
Magento version that is used is 2.4.5-p10.