5

Where is the ListProduct.php under Magento\CatalogSearch\Block\SearchResult? I can't find it under the source code folder.

3
  • Where are you getting this? There's no sign of any such class or path in the Magento 2.0 core (master/releases or develop).
    – Ryan Hoerr
    Feb 23, 2016 at 3:06
  • Please check this file path "Magento\Catalog\Block\Product\ListProduct.php"
    – Vishal
    Feb 23, 2016 at 5:13
  • Okay..? I don't understand your problem. There are no references to Magento\CatalogSearch within that class.
    – Ryan Hoerr
    Feb 23, 2016 at 13:40

1 Answer 1

11

Let me answer it by myself. I can't find the ListProduct.php under Magento\CatalogSearch\Block\SearchResult because it is a virtual type which will be redirected to Magento\Catalog\Block\Product\ListProduct.php due to the di.xml under Magento\CatalogSearch\etc\frontend\di.xml

<?xml version="1.0"?>

    <!--
    /**
     * Copyright © 2015 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
        <virtualType name="Magento\CatalogSearch\Model\Session\Storage" type="Magento\Framework\Session\Storage">
            <arguments>
                <argument name="namespace" xsi:type="string">catalogsearch</argument>
            </arguments>
        </virtualType>
        <virtualType name="Magento\CatalogSearch\Model\Session" type="Magento\Framework\Session\Generic">
            <arguments>
                <argument name="storage" xsi:type="object">Magento\CatalogSearch\Model\Session\Storage</argument>
            </arguments>
        </virtualType>
        <virtualType name="Magento\CatalogSearch\Block\SearchResult\ListProduct" type="Magento\Catalog\Block\Product\ListProduct">
            <arguments>
                <argument name="catalogLayer" xsi:type="object">Magento\Catalog\Model\Layer\Search</argument>
            </arguments>
        </virtualType>
    </config>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.