Show Category that Entry belongs to in Search Results with a twist
Hi.
Category Group is Locations (regions).
Channel Entries are Home and Land Packages.
I have a scenario on a real estate site where I want the user to be able to search for homes and filter by number of bedrooms etc.
I this case I would like the search results to show the category(region) the home(s) belong to instead of the actual entry(s).
I know this can be done, but the kicker is when there is more than one entry per category it is going to show the Location (category) multiple times (based on the number of entries returned in the results) and this I don't want.
It also needs to cater for when more regions (categories) get returned in the results, so we can't just limit=1.
I hope this makes sense, it's a little hard to explain.
Any ideas?
=)
Replies
Low 28 Apr 2016 06:15
I think you mean that you want to show a list of (unique) categories based on the current search results. So, a context aware list of categories.
I'm afraid that's not possible. EE lacks the APIs to do this correctly.
Trent 28 Apr 2016 06:24
Yes that's what I would like to achieve.
I have been working on a solution where I use Low Search to create a string of entry_id's eg. 1|2|3, I then use stash to pass that to an embed template where gwcode categories takes care of outputting the categories.
It works as it should, not as neat as what I would like but it's a solution.
I am happy to share my solution should anyone need it.
Thanks for your response Low.
=)