I have an advanced search that I’d like to limit to a specific category_group—which isn’t a valid parameter in the advanced search tag. Any ideas on how to accomplish this? Thanks!
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
August 29, 2012 7:49pm
Subscribe [2]#1 / Aug 29, 2012 7:49pm
I have an advanced search that I’d like to limit to a specific category_group—which isn’t a valid parameter in the advanced search tag. Any ideas on how to accomplish this? Thanks!
#2 / Aug 29, 2012 8:59pm
What if you use one of the category add-ons to pull together a piped list of the categories within your target category group (and use that in the category parameter)? Something like GWCode Categories, I believe would do the trick.
#3 / Aug 29, 2012 9:13pm
Ah—true. Not sure it’ll parse right—maybe if it’s in an embed. Actually don’t even need to use GW. Could use:
{exp:channel:categories channel="page" category_group="8" style="linear"}{category_id}{if count != total_results}|{/if}{/exp:channel:categories}I actually ended up not needing this—but I’ll keep that solution in mind. At the very least, you could grab the EE rendered output of the search form, manually paste it in, and then render this code out. That’d be a pretty gnarly hack though—especially since there are plenty of robust search modules out there. I was basically trying not to rewrite an entire search function.
#4 / Aug 30, 2012 8:26pm
Just for fun, I ended up trying it out—It looks like it works if you throw the code above in an embed, and then pass that to the advanced search category=”{embed=group}”.