I tried to override the MagentoCatalogModelLayer.php
to rewrite getProductCollection()
method but it didn’t work for me. I have tried multiple things and end up writing here as I had no clue what went wrong.
Added in etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogModelLayer"
type="VendorModuleModelLayer" />
</config>
I have no clue what I am missing here. The class VendorModuleModelLayer extends MagentoCatalogModelLayer
Surprisingly, no errors shown by the compiler. Code compilation was successful. Looking for some expert tips here
I tried to use this solution as well but not worked for me. Facing other issues.
Version: Magento 2.4.3-p1