0

With Search API + Facet API it is possible to create search facets for taxonomy term reference fields, that reflect the hierarchy of terms in the vocabulary, based on the taxonomy_term_parent table. (With Facet API Taxonomy Folding it is even possible to browse these hierarchies as folders.)

Sometimes hierarchical information is not represented in the taxonomy_term_parent table, and the relations exist between terms of different vocabularies.

E.g. in a site I am building, a "Product series" has a term reference field to "Product family", which has a term reference to a "Supplier". Suppliers, Product families and Product series are 3 distinct taxonomy vocabularies.

Some products only have a supplier. Others have a supplier and a product family. And some have all three. If a product has a series, then its product family is the same as that of the series. And if it has a product family, then the supplier is the same as that of the product family.

I would like to expose this structure as one hierarchical facet, similar in appearance and behavior to that for a single hierarchical vocabulary.

Any ideas?

What I managed so far is to assemble the terms from different vocabularies into a common entity property. I also managed to unify the two different "parent term" relationships (series -> family, family -> supplier) into a common entity property. But then what?

0

One alternative, which is not quite the same, is to use dependencies between facets.

So, the product families facet is shown only if a supplier is chosen. And the product series facet is shown only if a product family is chosen.

With hook_block_view_alter() one can rewrite the block title, so that the product family facet block says e.g. "Acme product family", if "Acme" is chosen as a supplier.

Again, this is not quite the same. But it provides an acceptable user experience, I would say. And it might be a suitable solution for some visitors of this question.

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.