Could any1 please tell how this error can be solved?
I just have:
\Vendor\Module\Controller\Result\Index.php
<?php
namespace Vendor\Module\Controller\Result;
use Magento\Framework\App\Action\Context;
class Index extends \Magento\Framework\App\Action\Action
{
protected $tglssearchHelper;
protected $resultPageFactory;
public function __construct(
Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
)
{
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
$resultPage = $this->resultPageFactory->create();
$resultPage->getLayout()->initMessages();
$resultPage->getLayout()->getBlock('catalogsearch.leftnav');
return $resultPage;
}
}
My etc di:
<preference for="Magento\CatalogSearch\Controller\Result\Index" type="Vendor\Module\Controller\Result\Index" />
I get:
Fatal error: Cannot instantiate interface
Magento\Catalog\Model\Layer\FilterableAttributeListInterface in
C:\xampp\htdocs\magento2x_2\lib\internal\Magento\Framework\ObjectManager\Factory\Dynamic\Developer.php
on line 73
Best Answer
There is example in Magento code of how to implements the filterable attribute list.
Basicaly it is a virtual type. In our ElasticSuite module we have this kind of things into the etc/frontend/di.xml :
Then it can be injected into the leftnav block :
Maybe you will also have to fix some layout stuffs.
In my memory you have such an example in the Magento_CatalogSearch module.
You can also read the whole code in our ElasticSuite module : https://github.com/Smile-SA/elasticsuite/tree/master/src/module-elasticsuite-catalog