2

Within my exp:channel:entries tag, I am using the categories tag pair to show the categories that the entry is in. However, it is only showing the last category that the entry is in:

{exp:channel:entries}
    <h3><a href="{url_title_path='photos'}">{title}</a></h3><br />
    {image_upload}
        <img src="{path}_thumbs/{filename}.{extension}" />
    {/image_upload}
    <a href="{url_title_path='photos/printing'}">Print this photo</a><br />
    Categories: {categories backspace="2"}{category_name}, {/categories}<br />
{/exp:channel:entries}

This is the same on both the development and live sites.

There are a number of categories in the database (a couple of hundred), but each entry is only in around 2 or 3 categories. The correct categories are all selected when editing the entry in the admin panel.

  • 1
    What happens when you add the channel parameter in the exp:channel:entries tag with the correct channel name? – Siebird May 21 '13 at 13:18
  • @Siebird - no difference – colincameron May 22 '13 at 10:53
  • It's a good idea to always specify channel - otherwise EE will pull from all channels in the system. What URL is this page appearing at? What happens if you pull off the backspace parameter on the categories loop? Anything different if you strip out everything to just title and category? – Michael Boyink May 23 '13 at 3:13
  • Tried all those things, no joy unfortunately. The problem appears at different URLs on the development and live sites. – colincameron Jun 11 '13 at 9:16
4

I've discovered the cause:

The channel entries and categories are added through a web service, and it turns out I missed the exp_category_field_data table.

Without anything in this table, only the last category was showing. I've updated the web service to add the categories to this table, and it's working correctly now.

| improve this answer | |
  • Grr I hate EE sometimes -- they make it so difficult to import data cleanly. – Bradley Flood Mar 24 '14 at 3:06
  • 2
    If you don't need category fields, your web service can ignore the exp_category_field_data. Just make sure your {exp:channel:entries} tag has disable="category_fields" and all of the categories will show up. – Steve Grossi Oct 15 '14 at 19:27

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.