0

I'm using the tag below to display the categories of an entry using the entry_id. I'm using those categories to generate a form. I want to exclude specific category groups as they aren't needed in the form. When I use the tag below, the excl_group_id parameter doesn't work if the entry_id parameter is included. if I remove the entry_id parameter, the excl_group_id parameter works, but it then lists all categories for that channel and not just the selected categories from that entry...Is it possible to get that excl_group_id to work along with the entry_id parameter?

{exp:channel:entries channel="products_beds" disable="categories|member_data|category_fields|pagination" url_title="{segment_4}" sort="asc" dynamic="yes"}

{exp:gwcode_categories entry_id="{entry_id}" channel="products_beds" style="linear" excl_group_id="4"}
    {!— code to generate form based on categories —}
{/exp:gwcode_categories}

{/exp:channel:entries}
  • What if you remove the channel= from gw tags. You're targeting the channel in your exp:channel tag already. – stuartmcd69 Jun 3 '14 at 23:42
  • If I remove the channel= and the excl_group_id= it will display the categories for the entry. If I remove just the channel= and leave the excl_group_id= it doesn't display anything, so that parameter must rely on the channel= parameter for the tag to work at all. – Mike Lohrman Jun 4 '14 at 13:52
  • So you're saying you want to show categories an entry belongs to but hide a paticular category ? – stuartmcd69 Jun 4 '14 at 14:23
  • yea, I'm using the plugin to generate a form based on a couple category groups (product customizations), but I also have 1 or 2 category groups assigned to the product that I don't want to be in the form. – Mike Lohrman Jun 4 '14 at 15:51
  • 1
    I dont know the whole gw thing but I'd use switchee to filter out extraneous cats! – stuartmcd69 Jun 4 '14 at 16:22
0

I'm not sure why it wouldn't work but rather then delve into the GW code I'd simply use a conditional to remove the categories that aren't required. Should allow you to move on at least :)

{exp:channel:entries
  channel="products_beds"
  disable="categories|member_data|category_fields|pagination"
  url_title="{segment_4}"
  sort="asc" dynamic="yes"
}
    {exp:gwcode_categories entry_id="{entry_id}" style="linear"} //Should work without channel= tag
        {exp:switchee variable="{cat_id}" parse="inward"}
          {case value="4"}
            //Do nothing
          {/case}
          {case default="yes"}
            //Do something
          {/case}
        {/exp:switchee}
    {/exp:gwcode_categories}
{/exp:channel:entries}
| improve this answer | |

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.