In magento 2.2.5 Enterprise edition
I am trying to get layered navigation using custom API.
I got solution form here:
https://magento.stackexchange.com/a/262086/31910
my code is this: Please ignore ObjectManager it is only for testing purpose
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$filterableAttributes = $objectManager->get(\Magento\Catalog\Model\Layer\Category\FilterableAttributeList::class);
//$appState = $objectManager->get(\Magento\Framework\App\State::class);
$layerResolver = $objectManager->get(\Magento\Catalog\Model\Layer\Resolver::class);
$filterList = $objectManager->create(
\Magento\Catalog\Model\Layer\FilterList::class,
[
'filterableAttributes' => $filterableAttributes
]
);
//$appState->setAreaCode('frontend');
$layer = $layerResolver->get();
$layer->setCurrentCategory($category);
$filters = $filterList->getFilters($layer);
$data = array();
foreach ($filters as $filter) {
if ($filter->getItemsCount()) {
$data[] = $filter;
}
}
return $data;
The problem is, I am getting this error after applying this code:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.created_in' in 'where clause', query was: SELECT FLOOR((ROUND((e.min_price) * 1, 2)) / 10000) + 1 AS
range
, COUNT(*) AScount
FROMcatalog_product_index_price
ASe
\n INNER JOINcatalog_category_product_index_store1
AScat_index
ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id='46'\n INNER JOINcataloginventory_stock_status
ASstock_status_index
ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1\n INNER JOINsearch_tmp_5e05a53f383179_70162465
ASsearch_result
ON e.entity_id = search_result.entity_id WHERE ((stock_status_index.stock_status = 1)) AND (e.created_in <= '1573154701') AND (e.updated_in > '1573154701') AND ( e.website_id = '1' ) AND ( e.customer_group_id = 0) AND (e.min_price IS NOT NULL) GROUP BY FLOOR((ROUND((e.min_price) * 1, 2)) / 10000) + 1 ORDER BY (FLOOR((ROUND((e.min_price) * 1, 2)) / 10000) + 1) ASC
I don't know why it is adding (e.created_in <= '1573154701')
in where clause
Can anyone help me resolve this issue?