cancel
Showing results for 
Search instead for 
Did you mean: 

Exception when filtering by category in Layered Navigation (Bucket does not exist)

Exception when filtering by category in Layered Navigation (Bucket does not exist)

Hi,

 

I upgraded magento CE 2.1.9 to CE 2.2.0 and now I get an exception when trying to filter by category in the layered navigation. My base category is set as anchor and when I select a sub category I get the following error:

 

1 exception(s):
Exception #0 (Magento\Framework\Exception\StateException): Bucket does not exist

Exception #0 (Magento\Framework\Exception\StateException): Bucket does not exist
#0 /var/www/html/generated/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection/Interceptor.php(115): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection->getFacetedData('category')
#1 /var/www/html/vendor/magento/module-catalog-search/Model/Layer/Filter/Category.php(111): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->getFacetedData('category')
#2 /var/www/html/vendor/magento/module-catalog/Model/Layer/Filter/AbstractFilter.php(202): Magento\CatalogSearch\Model\Layer\Filter\Category->_getItemsData()
#3 /var/www/html/vendor/magento/module-catalog/Model/Layer/Filter/AbstractFilter.php(159): Magento\Catalog\Model\Layer\Filter\AbstractFilter->_initItems()
#4 /var/www/html/vendor/magento/module-catalog/Model/Layer/Filter/AbstractFilter.php(148): Magento\Catalog\Model\Layer\Filter\AbstractFilter->getItems()
...

I'm completely stuck with this. Does anyone has a clue about this?

 

Thanks!

9 REPLIES 9

Re: Exception when filtering by category in Layered Navigation (Bucket does not exist)

I've got the same problem. Any solutions?

Re: Exception when filtering by category in Layered Navigation (Bucket does not exist)

I am also facing same error after upgrading magento from 2.1.9 to 2.2.2. Is there any solution ??

Re: Exception when filtering by category in Layered Navigation (Bucket does not exist)

Have you resolved this error??

Re: Exception when filtering by category in Layered Navigation (Bucket does not exist)

I have added below code on above "Bucket does not exist" condition. Because we are showing subcategories on main category pages. So we don't need filters. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $category = $objectManager->get('Magento\Framework\Registry')->registry('current_category'); if($category && $category->getIsAnchor() == '0'){ return ''; } if (!$bucket) { throw new StateException(new Phrase('Bucket does not exist')); }

Re: Exception when filtering by category in Layered Navigation (Bucket does not exist)

You have to set the Root category to Anchored -> 'Yes'. If it is set already as 'Yes', you have set it again to 'No' and  'Save' and then again into 'Yes' -> 'Save'.  This should resolve your problem.

 

This is a known issue in Magento2.

 

Re: Exception when filtering by category in Layered Navigation (Bucket does not exist)

You have to set the Root category to Anchored -> 'Yes'. If it is set already as 'Yes', you have set it again to 'No' and  'Save' and then again into 'Yes' -> 'Save'.  This should resolve your problem.

 

This is a known issue in Magento2.

Re: Exception when filtering by category in Layered Navigation (Bucket does not exist)

The last solution did not work for me to solve this "bucket does not exist" issue, but I found a workaround, set "is anchor" to the the sub-categories as well. It did the trick for me.

 

See here: https://magento.stackexchange.com/questions/208995/when-i-click-on-category-filter-on-category-list-...

Re: Exception when filtering by category in Layered Navigation (Bucket does not exist)

Thank so much. It's work for me

Re: Exception when filtering by category in Layered Navigation (Bucket does not exist)

I had this issue today on search results pages.

What worked was running bin/magento indexer:reindex catalog_category_product