Hi folks,

I'm using TVI module for different Views per vocabulary. The facets blocks are always empty on this pages. I don't know why. I tried use page with path /taxonomy/term/%category alias and just block to show products, but no result at all. Products are shown, but facets is not.

Any suggestion where to look at?

This also appears when using another view with a wildcard path: taxonomy/term/%.

Comments

Niklan created an issue. See original summary.

borisson_’s picture

Status: Active » Postponed (maintainer needs more info)

I have no idea what the TVI module is, and how it's supposed to work.

But it looks like that one is not based on search api or core search. If you want to support that, either https://www.drupal.org/project/core_views_facets, a custom facet source or a facet source implemented by tvi should fix this.

If it is based on search api, we'll need more information.

niklan’s picture

StatusFileSize
new11.51 KB

TVI replace default views for term page by selected one. This view has search_api_index db table for data and it works fine, except, facets didn't see it.

I attached config file for that view. There is nothing that can break it. Only context by term id and sort by creation time, nothing else.

borisson_’s picture

Status: Postponed (maintainer needs more info) » Active

Ok, back to active it is. Exposed filters should work.

niklan’s picture

StatusFileSize
new119.49 KB

Tried to add exposed filter to that view and enable it as block, all works fine.

Exposed block is working

foolfitz’s picture

Me too, Facets block is empty on TVI pages.

niklan’s picture

Any advice where to look? Which file has logic to show or not factes, maybe I can dive in and fix it.

borisson_’s picture

I'm not sure what the problem here is, it might be that TVI provides another views display (not page or block), so that means we'd have to create a new facetsource plugin.

It might also be related to #2922344: Facets not visible on Wildcard Path - taxonomy/term/%.

borisson_’s picture

Title: Facets blocks are always empty on TVI pages » Facets not visible on Wildcard Path - taxonomy/term/%.
Issue summary: View changes

So I checked this, it's a duplicate of #2922344: Facets not visible on Wildcard Path - taxonomy/term/%, renaming this issue and closing the other one.

gnikolovski’s picture

Hi all.

This would be a really useful feature to have. Can somebody tell me what would be the best way to implement it? Any suggestions how to start?

vanlindholm’s picture

Any progress on this or suggested fix? A large part of my site is using wildcard paths so it would be great to have this fixed.

jeffam’s picture

I ran into this issue while playing with Commerce product entities, Search API + Facets, and Taxonomy Views Integrator (TVI).

I discovered that enabling both the core taxonomy term view and my custom search index view and setting them to both use page displays with the path taxonomy/term/%, I could get the facet blocks to appear and work.

borisson_’s picture

StatusFileSize
new8.85 KB
new44.08 KB

I can't seem to reproduce this, I created a new index that only displays taxonomy terms. I added the language field to that index.

I created a facet on that language field and that shows up without any issues.

I would love to fix this, but if I can't reproduce it, that will be hard.

vanlindholm’s picture

Ok, so here is my observations with a sample setup for context.

Setup:

Taxonomy:
Food
-Fruit
|_apples
|_pears ...
- Nut butters, Spreads & Honey
|_Honey
|_ Nut Butters
|_ Seeds

Brand
- Brand A
- Brand B
- Brand C
- Brand D

The brand taxonomy is associated with food products and other products.

Products:
Create products (commerce 2.0) associated with the Food taxonomy and tag them with the relevant term e.g. apples would be associated with fruit and apples and brand a, b or c. Create another type of product and associated with brand d. All food products are published with the url /food/* using the pathauto pattern food/[term:parents:join-path]/[term:name]

View (search_api_view)
Path: /food/%term
Contextual filter: Product datasource: Food Category » Taxonomy term » Term ID

Facets
Create facets for Food and Brand and associate them with the above view. Add the facets to the relevant block.

Test case 1

Setup
As above but install the TVI module and associated it with the the Food taxonomy and the search_api_view.

Tick: Enable taxonomy views integrator to override presentation.
Using with view: your search_api_view
Display: page
Tick: Child terms will use these settings
Tick: Pass all arguments to views

Test Steps

  1. Navigate to /food/Nut butters, Spreads & Honey

Expected result

  1. The relevant facets are rendered on the page

Result

  1. Error: The page is rendered with the correct products but the facet blocks are empty

Test case 2

Setup: As above but this time don't use TVI i.e. untick Enable taxonomy views integrator to override presentation for the food taxonomy.

Test Steps

  1. Navigate to /food/Nut butters, Spreads & Honey
  2. Select Brand B from the Brand facet
  3. Untick the selected brand
  4. Navigate to the page again (refresh of the page)

Expected result

  1. Page is rendered with the facets. The Brand facet only displays the brands associated with the products published under Nut butters, Spreads & Honey
  2. Only Brand B food products are displayed
  3. The brands associated with Nut butters, Spreads & Honey are displayed again
  4. The page is displayed as in #1 with facets.

Result

  1. On first navigation to the page the facets appeared as expected
  2. Brand B products displayed
  3. Error: All brand facets are displayed, even those not associated with food products.
  4. Error: The facets are no longer displayed
niklan’s picture

Status: Active » Closed (works as designed)
Related issues: +#2993234: Route Enhancer to fix route match parameters.

The original issue with missing blocks using TVI is fixed by patch for TVI.

Anyway, this looks like issue is not related to Facets module. It uses

$facet->getFacetSource()->isRenderedInCurrentRequest()

Which from Search API module ViewsDisplayBase::isRenderedInCurrentRequest(). He get info about views on page from route match and his params, which messed up and fixed by patch for TVI, beacuse it's more related to him than facets. This also fixes alot of other problems with Condition Plugins and maybe other modules. So I recommend to look at TVI issue for more information.