Pregunta

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.

¿Fue útil?

Solución

<preference for="Amasty\Shopby\Model\ResourceModel\Fulltext\Collection" type="Abc\Cde\Model\ResourceModel\Product\Collection" />
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top