ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Search Limited To Category Group

August 29, 2012 7:49pm

Subscribe [2]
  • #1 / Aug 29, 2012 7:49pm

    Aaren Hofferth

    55 posts

    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

    John St-Amand

    865 posts

    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

    Aaren Hofferth

    55 posts

    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

    Aaren Hofferth

    55 posts

    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}”.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases