0

I'm trying to develop a simple product catalog using categories; I use Transcribe plugin, also.

I've got main categories CAT1 (id4), CAT2 (id5), CAT3 (id6), CAT4 (id7) and subcategories of CAT1: SUBCAT1, SUBCAT2, SUBCAT3. Every main category have its own template page, for example when the user select CAT1 go to page: http://develop/products/group/C4/ On that page I need to show a list of CAT1 subcategories: SUBCAT1, SUBCAT2 and SUBCAT3. I wanna do it dynamically. Now, I can show my subcategories list right set parent_id manually...

{exp:channel:categories channel="products" style="linear"}
    {if parent_id=="4"}
        {exp:transcribe:replace name="category_{category_url_title}"}<br />
    {/if}
{/exp:channel:categories}

I'm able to get the current main category ID...

{exp:channel:entries channel="products" limit="1"}
    {categories}
        {category_id}
    {/categories}
{/exp:channel:entries}

I wonder if there's a way to combine these informations and, simply, get "SUBCAT1, SUBCAT2, SUBCAT3" as output without use any plugins, when I'm on the CAT1 page.

1

Use Gw Code Categories like as below:

{exp:gwcode_categories cat_id="{segment_3}"}
    {cat_name}
{/exp:gwcode_categories}

OR if you want to use category url title then:

{exp:gwcode_categories cat_url_title="{segment_3}"}
    {cat_name}
{/exp:gwcode_categories}

Output:

-> CAT1
   -> SUBCAT1
   -> SUBCAT2
   -> SUBCAT3

If you don't want to show the "CAT1" category, you can add the incl_self parameter like so: incl_self="no".

2
  • First of all, Jainil, thanks so much for your help! I prefer to use less plugins I can, but I've already hear about GWcode, so I give it a try. It work fine in EE3 (the old stable version with a self-made porting, the EE3 beta also): I can do what i want with categories list. But it does not work with Transcribe plugin: I must use {exp_transcribe:replace name="category_{cat_url_title}"} inside {exp:gwcode_categories ...} ...But it seems that Transcribe is executed first GWcode generate his output loop.. I just started to use EE and I'm really confused..
    – deste
    Jan 18 '17 at 10:40
  • 2
    Finally, I have discovered EE parse parameter ... I've added parse="inward" to my {ext:gwcode_categories} tag and all works fine! Thank you!
    – deste
    Jan 18 '17 at 13:42

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.