6

When call block on custom view:

$layer=$layout->createBlock('Magento\LayeredNavigation\Block\Navigation\Category');

Exception #0 (RuntimeException): Illegal state #0 /home/httpdocs/generated/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection/Interceptor.php(63): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection->addFieldToFilter('category_ids', '169') #1 /home/httpdocs/vendor/magento/module-catalog-search/Model/ResourceModel/Fulltext/Collection.php(479): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->addFieldToFilter('category_ids', '169') #2 /home/httpdocs/generated/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection/Interceptor.php(128): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection->addCategoryFilter(Object(Magento\Catalog\Model\Category\Interceptor)) #3 /home/httpdocs/vendor/magento/module-catalog-search/Model/Layer/Filter/Category.php(76): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->addCategoryFilter(Object(Magento\Catalog\Model\Category\Interceptor)) #4 /home/httpdocs/vendor/magento/module-layered-navigation/Block/Navigation.php(67): Magento\CatalogSearch\Model\Layer\Filter\Category->apply(Object(Magento\Framework\App\Request\Http)) #5 /home/httpdocs/vendor/magento/framework/View/Element/AbstractBlock.php(273): Magento\LayeredNavigation\Block\Navigation->_prepareLayout()

4
  • Hello @Phong I have kind of same issue regarding FilterableAttributeListInterface Feb 25 '19 at 6:55
  • 1
    So I added preference in di.xml and it worked, Please debug and check which Interface is not defined and set preference of that Interface in di.xml Feb 25 '19 at 6:56
  • community.magento.com/t5/Magento-2-x-Programming/… This will also help. Feb 25 '19 at 6:59
  • Hi @Phong, did you found any solution for this, I am facing the same issue Jan 2 '20 at 10:27
0
  1. By removing throw exception, you can solve the issue.
  2. Override file if it works in your case

Go to vendor\magento\module-catalog-search\Model\ResourceModel\Fulltext\Collection->addFieldToFilter() function and remove

    if ($this->searchResult !== null) {
    throw new \RuntimeException('Illegal state');
}

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.