3

Using Solspace SuperSearch I want to search by category (and keyword), and have the categories list on the result page remember which checkboxes I selected.

It works great when I am looping through the channel entries tag like so:

{exp:channel:categories parent_only="yes"}
{exp:super_search:variables}
    <li>
        {category_name}
        <input
            type="checkbox"
            value="{category_url_title}"
            name="category[]"
            {if super_search_category_{category_url_title}} checked="checked"{/if} />
    </li>
{/exp:super_search:variables}
{/exp:channel:categories}

I would like to use GWCcode Categories to have greater control however. When I do, I run into parse order issues and the checked="checked" does not render:

{exp:gwcode_categories depth="0" max_depth="1" style="linear"}
{exp:super_search:variables}
    <li>
        {cat_name}
        <input
            type="checkbox"
            value="{cat_url_title}"
            name="category[]"
            {if super_search_category_{cat_url_title}} checked="checked"{/if} />
    </li>
{/exp:super_search:variables}
{/exp:gwcode_categories}

Has anyone had the same problem and gotten these two addons to work together? Any alternative methods come to mind that give me this functionality?

EDIT: minor syntax error in code, see comments

  • Have you intentionally left out the closing super search tag? – Jason Varga Jan 30 '13 at 20:58
  • @JasonVarga no that was my mistake, I simplified my code somewhat to paste it here, accidentally removed it. The closing tag is there in my actual template. – Benjamin Smith Jan 31 '13 at 16:34
1

Try adding parse="inward" to the GWCode tag. It's a plugin tag instead of a module tag, so it will try to parse inner tags first, unless you add the parse="inward" parameter.

| improve this answer | |
  • Thank you. This solved an issue where gwcode was nested inside a channel entries attempting to get children using cat_url_title="{url_title}" – Michael Nov 21 '14 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.