0

I have a strange thing in EE 2.8.1. I want to show a list of all categories in category_group=“1” but nothing won’t show up.

I have 3 category groups

  • ID 1 - with 105 categories, top & sub level, Channel = "Producten"
  • ID 2 - with 2 categories, Channel = "Nieuws"
  • ID 3 - with 1 categorie, Channel = "Producten"

When i use for example:

{exp:channel:categories channel="producten" dynamic="no"}
{category_name}
{/exp:channel:categories}

{exp:channel:categories category_group="2" dynamic="no"}
{category_name}
{/exp:channel:categories}

{exp:channel:categories category_group="1" dynamic="no"}
{category_name}
{/exp:channel:categories}
  • Example One: I just get the one category from ID 3 and nothing from ID 1
  • Example Two: Just works great, nothing special
  • Example Three: Nothing happend, but why?

So i don’t see what can be the problem, anybody else have a idea? Looks like EE does not see Group 1.

4
  • Have you try without dynamic="0" ?
    – worfoual
    Apr 24, 2014 at 7:04
  • I did now but no result Channel="Producten" Test ---- ID2 Nieuws Projecten ---- ID1 ---- ID0 Nieuws Projecten Test
    – Eddyfever
    Apr 24, 2014 at 7:08
  • And also dynamic="0" doesn't change anything. Really strange, looks like the database doesn't exists.
    – Eddyfever
    Apr 24, 2014 at 7:12
  • Sorry I mean don't use dynamic="no", just try like that:{exp:channel:categories category_group="1"}
    – worfoual
    Apr 24, 2014 at 10:16

1 Answer 1

2

You need to specify the channel parameter, and you can leave out dynamic="no" because that's not a parameter for this tag.

If specifying the channel parameter does not work,try adding the following parameters: status="not closed" show_future_entries="yes" show_expired="yes"

{exp:channel:categories category_group="1" status="not closed" show_future_entries="yes" show_expired="yes"}
{category_name}
{/exp:channel:categories}

If the tag then outputs your categories, the reason they were not showing up is because the entries with those categories did not meet the default conditions i.e. entries with a status of open with an entry date in the past which have not expired. So you can then adjust the parameters to suit your particular entries e.g. omit the show_expired parameter if you don't want categories with only expired entries included.

You can review all the parameters for the channel categories tag at http://ellislab.com/expressionengine/user-guide/add-ons/channel/categories.html#parameters

9
  • Thank you for your reply, i understand what you mean with the parameters. But no luck with it. Still nothing shows up with your code. When i change the ID1 to a ID2 i get those categories but nothing from ID1. It looks like the problem is more in the database it self. Because on a product page i use {categories}<li><a href="{path=products/index}">{category_name}</a></li>{/categories} and then i get the category where the product is in. So they are there. Maybe any idea?
    – Eddyfever
    Apr 28, 2014 at 6:29
  • Could you add the revised version of the {exp:channel:categories} code that still won't work for you? If the {categories} tag works within the channel entries tag, that suggests that everything is being stored correctly in the database. You could also try admin > system admin > output & debugging > set display output profiler to yes.
    – Janine
    Apr 28, 2014 at 10:48
  • If you think the db is a factor, you could try admin I was unable to update my last comment, but the output profiler will show all the database queries being run, and if you find the one related to the channel categories tag, you can run it against the database yourself and review the results. But posting more of the code you are using will help. As well as the exp:channel:categories tag, could you post the opening exp:channel:entries tag that is working for you on the product page?
    – Janine
    Apr 28, 2014 at 10:55
  • Thank you for your reply, because i run this site on a localhost on work, i will post the code and test the debugging tomorrow morning.
    – Eddyfever
    Apr 29, 2014 at 17:04
  • Tidy - maybe this JS Fiddle helps you to understand whats going on. Would you like have some more debug information?
    – Eddyfever
    Apr 30, 2014 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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