cancel
Showing results for 
Search instead for 
Did you mean: 

Magento2 category filter major issue

Magento2 category filter major issue

Magento 2 does not render categories with children categories (marked as is_anchor= yes) correctly in layered navigation.

Seems to be a M2 issue, even in sample data demo, why is it that "Women or Men" categories with" tops & bottoms" sub-categories are hard coded as blocks to show in left navigation? Shouldn't they be rendering in category layered navigation with their children categories down the levels? Seems to be a quick work around because layered navigation is broken.

I looked at many M2 demo or live M2 sites out there, they all have the same problem and some uses the work around to pull all their categories in leftnav.

When you have over 3000 categories nested ,it is not a solution to create a block for each so that they show in left nav.

I don't see many people referring to this problem as if no-one cares about category filter in magento 2.

The problem did not exist in M1.

Am i missing something, anyone with a solution? Thanks.

 

9 REPLIES

Re: Magento2 category filter major issue

For now Layered Navigation in Magento 2 should work the same, from user point of view, as one in M1 (Implementation and Architecture have been changed, but not user experience).

All kind of navigations: Term (all attributes like color, size etc.), Dynamic Range (Price), Category should work the same as it’s done in M1.

 

Problem described in @cnyc post sounds awkward for me. As I can’t reproduce wrong behavior on M2 demo site with Sample Data on board.

For example, you can see it here  http://magento2.demo.ubertheme.com/women/tops-women.html

On the left side menu there is “Category” LN filter at the top with categories : “Jacket”, “Hoodies & Sweatshirts”, “Tees”, “Bras & Tanks”. All these categories were rendered automatically 

 in category layered navigation with their children categories down the levels.

 

For example, you can add new custom category, mark it as “is Anchor” and it will appear on front-end as well.

Username : uber Password : uber123

http://magento2.demo.ubertheme.com/admin  (Products->Categories)

I added my own category "IgorTest" to demonstrate, that newly created categories would get to Category LN as well.

 

Just to show you that Magento 2 doesn’t have hardcoded top level categories in layout , as it’s stated in your post.

Here are layouts for LN 

magento2ce/app/code/Magento/LayeredNavigation/view/frontend/layout/catalogsearch_result_index.xml  (for search result page) magento2ce/app/code/Magento/LayeredNavigation/view/frontend/layout/catalog_category_view_type_layered.xml (for category traversing)

 

And data for Category LN are generated with Plugin

Magento\CatalogSearch\Model\Adapter\Mysql\Plugin\Aggregation\Category\DataProvider

 

Which also doesn’t contain hard coded category ids/names.

Could you @cnyc describe in more details what exactly you consider as an issue regarding Category LN? And what hardcoded categories you mean? 

Re: Magento2 category filter major issue

1- you can add new custom category, mark it as “is Anchor” and it will appear on front-end as well.

 

Not exactly, ex: In your admin demo, i have moved bottoms category ( --> Women--->bottoms)

inside -->Women-->tops

Now the tree is:

Women

--Tops

   ----Jackets

   ----Hoodies & Sweatshirts

  ----Tees

  ----Bras & Tanks

  ----Bottoms

 

 

Women tops or bottoms are all set "is_anchor = yes"

Should they now all show in category filter layered nav? Yes

No, not in your demo M2, check it.

http://magento2.demo.ubertheme.com/women/tops-women.html

 

is_anchor=yes categories (Bottoms) are not rendered in LN (M2), only categories with no children are rendered.

 

 

2-Magento 2 doesn’t have hardcoded top level categories

 

 I meant static blocks (women's category)

 

Re: Magento2 category filter major issue

Bug confirmed and already fixed in Magento 2 mainline branch. Fix would be available in 2.0.3 patch version of Magento

Thanks for reporting 

Re: Magento2 category filter major issue

How did you get a category to appear in the Layered Navigation? I thought only attributes would appear there.

Re: Magento2 category filter major issue

Is this bug fixed? Because I'm having the same exact problem and currently using version 2.0.5. Tested on 2.0.4 as well, same issue.

Re: Magento2 category filter major issue

Hello,

 

Has the category filter on the navigation pane issue been resolved?  I'm running 2.1.0 and it still seems to be a persistent problem...?

Re: Magento2 category filter major issue

We had the same problem with missing layered navigation filters. After a lot of trial and error (I'm not a developer) I found a workaround that works for us, maybe for you as well. 

 

The root of the problem seems to be connected with Magento URL rewrites. If there are more than one URL rewrite entries for categories in the MySQL table (url_rewrites) that have an identical target_path and the field "is_autogenerated" = 1 then the parent category will not show the filters. Probably Magento needs a unique rewrite entry for a specific category (=target_path) otherwise it does not now which URL to use for the frontend filters. 

 

At first I deleted the unwanted URL rewrite "duplicates" (they all have .html at the end of the URL of the request_path which we don't want) and that worked until the next morning after the nightly import cron script ran. During that process Magento unfortunately creates these urlkey.html request_path entries even though we set Magento to not append any suffix to the URL key.

 

What actually helped was to set all of those duplicate url rewrite entries with unwanted request_path to is_autogenerated=0 (reindex afterwards). The filters appear and this setting does not get overwritten after a new import. 

This workaround also helped with our canonical URLs and sitemap URLs but only for categories. For product URL rewrite entries Magento unfortunately does overwrite is_autogenerated to 1 for each import process. 

 

We're using Magento 2.0.9 with PIM Akeneo & PIMgento 2 for product import. 

Re: Magento2 category filter major issue

Hi,

    This still is not fixed on M 2.1.6

Re: Magento2 category filter major issue

The bug is still there in magento 2.1.8