When filters + Ancor is enabled for category, sorting by product name doesn't work. I know the fix as I tested in Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection
. So now I'm trying to override it in my module but below does not work. It still reads from core file.
<?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="Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection" type="MyVendor\Mymodule\Model\ResourceModel\Fulltext\Collection" />
</config>
Below did not work too:
<virtualType name="MyVendor\MyModule\Model\ResourceModel\Fulltext\CollectionFactory" type="Magento\Catalog\Model\ResourceModel\Product\CollectionFactory">
<arguments>
<argument name="instanceName" xsi:type="string">MyVendor\MyModule\Model\ResourceModel\Fulltext\Collection</argument>
</arguments>
</virtualType>
etc/di.xml
oretc/frontend/di.xml
.