Dependent Smart Search filters - get selected values to modify queries to populate filters

Lawrence LeFebour asked on June 2, 2017 22:13

Hi there, our current solution uses a less-than-optimal approach to get dependent smart search filter dropdowns enabled. We have one smart search filter for Page Type and a second smart search filter for Author. Selecting an option from the Page Type filter updates the Author filter to only show Authors for the selected Page Type. The converse also works, by selecting an Author only the available Page Types are displayed in the Page Types filter. We do this using cookies on-change of the smart search filter and then use the macro syntax to retrieve the appropriate cookie to modify the query 'where' condition when populating the smart search filter.

So, this approach is a bit brittle and I'm looking for an alternate way to access the selected smart search filter item through a macro expression instead of using a cookie. I am also hoping that a different approach would allow me to more easily accommodate multiple smart search filter selections if I use checkboxes instead of a dropdown control.

Is it possible to use the macro syntax to retrieve the selected value(s) of the smart search filters?

Recent Answers

Roman Hutnyk answered on June 5, 2017 11:11

Have you looked at component events? They should allow you to fire an event whenever user selects a value in one of your filters and handle it in another filter.

0 votesVote for this answer Mark as a Correct answer

Lawrence LeFebour answered on June 5, 2017 14:23 (last edited on June 5, 2017 15:04)

Interesting. Thanks Roman, I will look into this and report back. So for my scenario, I'm looking to create a better faceted search that prevents a user from ever receiving zero results. That means that every related filter would affect the others on the page to limit what the user can filter for. For example, if my filters included Category, Author, Industry, Technology, Publish Date - making checkbox (or date) selections from any filter would update the available selections in other filters. As an example, I found this Kentico-based site that has behaviour similar to what I'm looking for:

Would component events work in my scenario or would I end up with circular logic for the events? I don't think I would since I would likely still used postbacks instead of an AJAX update for the filters & results. Any insights would be appreciated - thanks again.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.