I am trying to do a category filter using segments. I will try to break it down as best as possible! Hopefully someone can assist me.

EE Versions: v2.9.2, Low Seg2Cat: v2.8.1

I am using 2 category groups at the moment. "Training Brand" & "Training Category".

Step 1 is choosing the "Training Category" Like so...

{exp:channel:categories style="linear" category_group="3" category="{segment_category_ids}" show_empty="no"}                    
    <li><a href="{exp:transcribe:uri path="training/group/{category_url_title}"}">{category_name}</a></li>

Which works fine, it only shows me the categories that have an entry in them.

Step 2 is where I am running into trouble.

I am trying to display a list of categories from the group "Training Category" that have an associated category with the category now in the segment.

I've tried using this code...

<table class="table table-striped table-bordered table-hover">
    {exp:channel:entries channel="training_resources" category="{segment_category_ids}"}

            <td width="70%">{categories category_group="2" limit="1"}{category_url_title} {category_id}{/categories} </td>
            <td align="center" width="30%"><a class="btn btn-primary" href="{exp:transcribe:uri path="training/resource/{segment_3}/{categories category_group="2" limit="1"}{category_url_title}{/categories}"}" role="button">View</a></td>


This snippet of code, displays only the entries that are in the related to the segment, which is good. But it also duplicates the entries showing the categories multiple times if there are multiple entries per category.

This is a 3 page process where on the 1st and second you are selecting 2 different categories, and on the 3rd will display all the entries based on those 2 categories.

Has anyone had any luck by filtering with categories?

Thanks, Funk

  • Can you maybe sketch out what your expected and resultant output is? Not clear on what you want to be happening in step 2. – Derek Hogue Feb 2 '15 at 13:43

Your Answer

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

Browse other questions tagged or ask your own question.