We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Display Child Categories, with Entry Channel field images.

Development and Programming

CADAUDIO's avatar
CADAUDIO
13 posts
9 years ago
CADAUDIO's avatar CADAUDIO

Ok, stumped again…

I need to display all entries within a child category, and the channel field image {product_image} associated with each entry.

I’m currently experimenting with EE2 Child Categories: I’ve tried about every parsing variation imaginable; embedded, wrapped, inside the entries tag ect.

{exp:child_categories parent="40" child_categories_sort_by="custom" child_categories_sort_direction="asc" show_empty="yes" entries_sort_by="date" entries_sort_direction="asc" entries_limit="999" site="1"}
<div class="c4">
<h1><a href="/products/{parent_category_url_title}/">{parent_category_name}</a></h1>
{parent_category_end}
{child_category_start}
<h2><a href="/products/{child_category_url_title}/">{child_category_name}</a></h2>
Total entries: {entries_total}


{child_category_end}

{entries_start}

{exp:channel:entries url_title="{url_title}" dynamic="no"}
<a href="/products/{parent_category_url_title}/{url_title}"> _    {if '{product_image_1}' != ""}_    {exp:teemthumb:size src="{product_image_1}" w="80" h="60" q="90"} {sized} {/exp:teemthumb:size}  _    {if:elseif '{product_image_1}' == ""} <img src="http://cadaudiomics.com/themes/site_themes/cad_audio/images/image-2.jpg" alt=""  /> {/if} _    </a>
{/exp:channel:entries}

<a href="/products/{parent_category_url_title}/{url_title}">{title}</a> channel: {channel_name}, posted: {entry_date}

{entries_end}
</div>
{/exp:child_categories}

What would be really nice, is if EE was a little more category friendly. I run into this with just about every build. Is it my way of thinking when it comes to categories? It shouldn’t require several plugins to display and child category, list the entries within that category and display the channel field within each should it?

In other words:

I want to display the parent category and entries within that category with the image associated with the entry.

Product Applications

   -- Acoustic Instruments
       --Product Name and Image
       --Product Name and Image
       --Product Name and Image
       --Product Name and Image
 
  -- Bass AMP
       --Product Name and Image
       --Product Name and Image
       --Product Name and Image
       --Product Name and Image
       
Derek Jones's avatar
Derek Jones
7,561 posts
9 years ago
Derek Jones's avatar Derek Jones

I’m not familiar with those add-ons, but I would suggest that a cursory glance at what you are doing is better suited for related entries than categories. Any time my data model starts treating categories more like content than taxonomy, it’s a trigger for me to use relationships.

For example, if you had just posted your desired sample output with no implementation puzzle, I would have immediately have thought of those as relationships.

That said, I think that you could work with the Channel Categories tag, but it will not be as performant as relationships since you have custom fields that you need to display along with the product titles/links.

       
CADAUDIO's avatar
CADAUDIO
13 posts
9 years ago
CADAUDIO's avatar CADAUDIO

Sorry if it sounded confusing, I’m just a little frustrated. I think I need to completely rethink how I build EE sites because categories throw me for a loop every time. I just feel it shouldn’t require hacks and third party plugins to target specific categories and have control over how data within them is displayed.

It’s not linking to categories that seems to be an issue, it’s displaying them. It would actually be nice to hook into EE itself and have the same sorting features as the backend does when searching entries.

Can you display data within a specific child category using the categories tag without a plugin? If not why?

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
9 years ago
Ingmar Greil's avatar Ingmar Greil
Can you display data within a specific child category using the categories tag without a plugin?

Do you mean something like example.com/index.php/site/index/C99 ?

       
CADAUDIO's avatar
CADAUDIO
13 posts
9 years ago
CADAUDIO's avatar CADAUDIO

No, I’m not looking to use a segment to define the result. Meaning, I’m looking single page that queries data from a specific child category, and display the entries that reside in each child category.

{exp:query sql="SELECT * FROM exp_categories WHERE parent_id='40'"}

Which works, but I also want to include content from each result.

Something like:

{exp:channel:entries url_title="{cat_url_title}" limit="20" orderby="asc" }

Example page http://cadaudiomics.com/products/product-application

The main issue I’m having is the inability to include channel field data within the results.

For instance, here is an example page where I’ve successfully pulled in child categories from a specific child but, most category plugins available don’t allow channel field data do be displayed with the results.

http://cadaudiomics.com/products/product-list

Using:

{exp:gwcode_categories channel="products" depth="1|2"  limit="1"}

Furthermore, on this page, i build a custom sort page that pulls in data from the same applications category with a drop-down using ajax and segments. When you select the product application drop-down, you can see it successfully populates but again, it uses segments and ajax.

http://cadaudiomics.com/products/

I need to list all of products in the Product Applications category, and display the associated entries within each but on a page not using segments.

Am I overthinking this? Is it a parsing issue? Build an ajax on load page? Embedded template…

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
9 years ago
Ingmar Greil's avatar Ingmar Greil
I’m looking single page that queries data from a specific child category, and display the entries that reside in each child category.

I’m still a little unclear here. Do you want to display all entries belonging to a particular (child) category? The URL I provided in my previous example does just that. Alternatively you could use a category trigger word, “category” by default. Or, you could simply use the category= parameter on a {exp:channel:entries} tag.

Or perhaps the {exp:channel:category_archive} tag is what you are looking for?

If I misunderstood you, could you please clarify again what exactly you’re trying to achieve?

The main issue I’m having is the inability to include channel field data within the results.

Not an issue when using the channel:entries tag, I should think.

       
CADAUDIO's avatar
CADAUDIO
13 posts
9 years ago
CADAUDIO's avatar CADAUDIO

I’m looking for a basic template page (without any specific url or segment) that displays the children of Product Applications, and all the entries within each child category.

And not just links of entries within each child rather full channel field display. I need the image associated with each child category entry title, and body, not category images, the images used in my channel fields.

Most third party category plugins will do what I want, but don’t offer channel field support. So, with those, I can query specific children, display the entries within the children, but they don’t support using your own channel fields as part of the output.

See image.

I really think I’m over thinking this, I’m just trying to get it finished up and the old brain isn’t working normally. 😊

At this point, I would pay someone to write a custom query for me 😊

       
CADAUDIO's avatar
CADAUDIO
13 posts
9 years ago
CADAUDIO's avatar CADAUDIO

It’s me again. I decided to do some testing.

I ran this code in a blank template: It’s shows all categories and titles properly

{exp:channel:categories  style="linear"}
  <h1>{category_name}:</h1> 
  {exp:channel:entries channel="products"}
    {my_custom_field}
  {/exp:channel:entries}
{/exp:channel:categories}

When I tried this: The category name disappears.

{exp:channel:categories  style="linear" show="40" }
  <h1>{category_name}</h1> 
  {exp:channel:entries channel="products"}
    {my_custom_field}
  {/exp:channel:entries}
{/exp:channel:categories}

What could possibly be the issue with show=”40” not displaying the cat name?

So… I added this, which displays all of the children but also shows the parent. When I remove 40, the parent, they all disappear. So now, I need to find a way to hide the parent and only display the children, which is why I went to a third party plugin, and the plugin doesn’t allow channel fields… so confused.

{exp:channel:categories show="40|41|36|42|55|43|44|45|46|47|48|49|50|51|52|53|54" style="linear"}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.