Everything is in the question i need to load a custom product collection in frontend using smile elasticsuite. But i can't figure out how to do it. Do you guys have a working example ?
` "smile/elasticsuite": "~2.10.13"`
So far this is the error i'm getting (which makes sense as the method is declared in smile and not in magento...but i don't understand why it's using the magento class instead of smile.
Thats the error I'm getting :
> rror: Call to undefined method Magento\Catalog\Model\ResourceModel\Product\Collection\Interceptor::addSortFilterParameters() in /var/www/magento/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/LayerPlugin.php:87
Stack trace:
#0 /var/www/magento/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/LayerPlugin.php(67): Smile\ElasticsuiteCatalog\Plugin\LayerPlugin->setSortParams()
#1 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(121): Smile\ElasticsuiteCatalog\Plugin\LayerPlugin->beforePrepareProductCollection()
#2 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(153): Sa\CustomCollection\Model\Layer\Interceptor->Magento\Framework\Interception\{closure}()
#3 /var/www/magento/generated/code/Sa/CustomCollection/Model/Layer/Interceptor.php(41): Sa\CustomCollection\Model\Layer\Interceptor->___callPlugins()
#4 /var/www/magento/vendor/magento/module-catalog/Model/Layer.php(147): Sa\CustomCollection\Model\Layer\Interceptor->prepareProductCollection()
#5 /var/www/magento/app/code/Sa/CustomCollection/Model/Layer.php(9): Magento\Catalog\Model\Layer->getProductCollection()
#6 /var/www/magento/generated/code/Sa/CustomCollection/Model/Layer/Interceptor.php(23): Sa\CustomCollection\Model\Layer->getProductCollection()
#7 /var/www/magento/vendor/magento/module-catalog/Block/Product/ListProduct.php(481): Sa\CustomCollection\Model\Layer\Interceptor->getProductCollection()
#8 /var/www/magento/vendor/magento/module-catalog/Block/Product/ListProduct.php(121): Magento\Catalog\Block\Product\ListProduct->initializeProductCollection()
#9 /var/www/magento/vendor/magento/module-catalog/Block/Product/ListProduct.php(200): Magento\Catalog\Block\Product\ListProduct->_getProductCollection()
#10 /var/www/magento/vendor/magento/framework/View/Element/AbstractBlock.php(1113): Magento\Catalog\Block\Product\ListProduct->_beforeToHtml()
#11 /var/www/magento/vendor/magento/framework/View/Element/AbstractBlock.php(1118): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#12 /var/www/magento/vendor/magento/framework/View/Element/AbstractBlock.php(678): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#13 /var/www/magento/generated/code/Sa/CustomCollection/Block/Product/ListProduct/Interceptor.php(617): Magento\Framework\View\Element\AbstractBlock->toHtml()
#14 /var/www/magento/vendor/magento/framework/View/Layout.php(578): Sa\CustomCollection\Block\Product\ListProduct\Interceptor->toHtml()
#15 /var/www/magento/vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Layout->_renderBlock()
#16 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#17 /var/www/magento/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#18 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#19 /var/www/magento/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#20 /var/www/magento/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#21 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#22 /var/www/magento/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#23 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#24 /var/www/magento/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#25 /var/www/magento/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#26 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#27 /var/www/magento/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#28 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#29 /var/www/magento/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#30 /var/www/magento/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#31 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#32 /var/www/magento/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#33 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#34 /var/www/magento/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#35 /var/www/magento/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#36 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#37 /var/www/magento/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#38 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#39 /var/www/magento/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#40 /var/www/magento/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#41 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#42 /var/www/magento/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#43 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#44 /var/www/magento/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#45 /var/www/magento/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#46 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#47 /var/www/magento/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#48 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#49 /var/www/magento/vendor/magento/framework/View/Layout.php(975): Magento\Framework\View\Layout\Interceptor->renderElement()
#50 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->getOutput()
#51 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent()
#52 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}()
#53 /var/www/magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(347): Magento\Framework\View\Layout\Interceptor->___callPlugins()
#54 /var/www/magento/vendor/magento/framework/View/Result/Page.php(260): Magento\Framework\View\Layout\Interceptor->getOutput()
#55 /var/www/magento/vendor/magento/framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render()
#56 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult()
#57 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent()
#58 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}()
#59 /var/www/magento/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(95): Magento\Framework\View\Result\Page\Interceptor->___callPlugins()
#60 /var/www/magento/vendor/magento/framework/App/Http.php(120): Magento\Framework\View\Result\Page\Interceptor->renderResult()
#61 /var/www/magento/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
#62 /var/www/magento/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#63 /var/www/magento/pub/index.php(29): Magento\Framework\App\Bootstrap->run()
#64 {main}
Here is my layout if it can help
```
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<!--adding attribute tag to inherit the default stying for products-->
<attribute name="class" value="page-products"/>
<referenceContainer name="content">
<block class="Sa\CustomCollection\Block\Product\ListProduct" name="mycollection_index_index" as="product_list" template="Magento_Catalog::product/list.phtml">
<container name="category.product.list.additional" as="additional" />
<block class="Magento\Framework\View\Element\RendererList" name="category.product.type.details.renderers" as="details.renderers">
<block class="Magento\Framework\View\Element\Template" name="category.product.type.details.renderers.default" as="default"/>
</block>
<block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="category.product.addto" as="addto">
<block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
name="category.product.addto.compare" as="compare"
template="Magento_Catalog::product/list/addto/compare.phtml"/>
</block>
<block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
<block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName">
<argument name="name" xsi:type="string">product_list_toolbar</argument>
</action>
</block>
</referenceContainer>
<referenceContainer name="sidebar.main">
<block class="Sa\CustomCollection\Block\Navigation" name="catalog.leftnav" as="navigation" before="-" template="Magento_LayeredNavigation::layer/view.phtml">
<block class="Sa\CustomCollection\Block\Navigation\State" name="catalog.navigation.state" as="state" template="Magento_LayeredNavigation::layer/state.phtml" />
<block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalog.navigation.renderer" as="renderer" template="Magento_LayeredNavigation::layer/filter.phtml">
<arguments>
<argument name="product_layer_view_model" xsi:type="object">Magento\LayeredNavigation\ViewModel\Layer\Filter</argument>
</arguments>
</block>
</block>
</referenceContainer>
<referenceBlock name="mycollection_index_index">
<arguments>
<argument name="viewModel" xsi:type="object">Magento\Catalog\ViewModel\Product\OptionsData</argument>
</arguments>
</referenceBlock>
</body>
</page>
```
And here is my module structure, feel free to ask for any file details
[![enter image description here][1]][1]
[1]: https://i.sstatic.net/tCDVe.png