logo

Palette - Make it Colorful🎨

Palette - Visual Page Builder, no design degree required.

Live Demo Download Palette

Scroll

HOW TO CREATE DEPENDENT LISTS IN SEARCH API?

22/02/2025, by Anonymous (not verified)

 

Hello everyone at any time! I need help implementing something on Drupal 7. Let me try to explain. I want to create dependent lists: country and city. This should be clear what it is. On any hotel website or when purchasing tickets for a flight, you select a country and a city. You click search or something else, and it redirects you to a page. I want to do the same thing.

I am using the Search API module and its extensions. I'm trying to replace the regular text input field in the search with a taxonomy selection. My taxonomy has a double hierarchy. If it were a single one, this could be done using View or in the Search Page of the Search API module itself. But I have a double hierarchy.

In the view and in the Search Page, only one field is provided where the outermost taxonomy term is selected. So there is only one dropdown. I need two dropdowns. Is it possible to implement autocomplete in the view or in the Search Page of the Search API module?

This can all be done in views without indexing using Simple Hierarchical Select or Hierarchical Select. We can add filters from these modules using their widgets, display an exposed filter in a block, and that’s it.

That would work for me, but I need to use the Facet and sorting functions to filter the data obtained after the search by price and other criteria.

If it were possible to somehow use the widget from Simple Hierarchical Select or Hierarchical Select in views where indexed data is pulled, but unfortunately, I’m not strong in php. Perhaps there is some other widget available. Or maybe we can find a way to manage without taxonomy.

Any suggestions would be greatly appreciated.