Stash
ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6
Back to this add-on's main page
View Other Add-ons From Mark Croxton
Unique Category List - Please help
Support Request
maxbato
|
Posted: 08 October 2018 12:23 PM |
|
|
|
Hi There,
I am attempting to get a unique category list from multiple entries. Some of these entries have the same category.
The categories are:
Service Documents
Training
Exams
Using the code below (please disregard the crazy channel:enries tag, it is used for member segmentation, my list is outputting:
Service Documents TrainingExams Training
I suppose there is more I need to do in my code to get this to work correctly?
{exp:stash:set_list name="categories" parse_tags="yes"} {exp:channel:entries channel="your_firm" orderby="date" sort="desc" search:advisor_company="{embed:adv_comp}" search:advisor_company_exclude="{embed:adv_comp_x}" search:advisor_segmentation_c="{embed:adv_seg}" search:advisor_segmentation_exclude="{embed:adv_x}"} {stash:cats} {categories}{category_name}{/categories} {/stash:cats} {/exp:channel:entries} {/exp:stash:set_list}
{exp:stash:get_list name="categories" unique="yes"} {cats} {/exp:stash:get_list}
|
|
|
Mark Croxton
|
Posted: 09 October 2018 06:03 AM |
# 1
|
|
Developer
|
Since an entry may have multiple categories you would need to capture each one individually.
{exp:stash:set_list name="categories" parse_tags="yes" parse_depth="2"} {exp:channel:entries channel="your_firm" orderby="date" sort="desc" search:advisor_company="{embed:adv_comp}" search:advisor_company_exclude="{embed:adv_comp_x}" search:advisor_segmentation_c="{embed:adv_seg}" search:advisor_segmentation_exclude="{embed:adv_x}"} {categories}{stash:cats}{category_name}{/stash:cats}{/categories} {/exp:channel:entries} {/exp:stash:set_list}
|
|
|
maxbato
|
Posted: 09 October 2018 03:05 PM |
# 2
|
|
|
Thank you Mark! Works perfectly.
|
|
|