1

Hii we need to override Magento\Catalog\Model\ResourceModel\Product\Collection class for our customisation. To do this we added

<preference for="Magento\Catalog\Model\ResourceModel\Product\Collection" type="Abc\Cde\Model\ResourceModel\Product\Collection"/>

in di.xml. This override works in home page but in plp page it is not working because in plp page one of amasty module uses

<virtualType name="Magento\CatalogSearch\Model\ResourceModel\Fulltext\CollectionFactory"
            type="Magento\Catalog\Model\ResourceModel\Product\CollectionFactory">
        <arguments>
            <argument name="instanceName" xsi:type="string">Amasty\Shopby\Model\ResourceModel\Fulltext\Collection</argument>
        </arguments>
    </virtualType>

both are extending magento collection.How can i ovveride the code that my function needs to work.

2
<preference for="Amasty\Shopby\Model\ResourceModel\Fulltext\Collection" type="Abc\Cde\Model\ResourceModel\Product\Collection" />

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.