ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

categories parents and children

August 15, 2012 10:39am

Subscribe [2]
  • #1 / Aug 15, 2012 10:39am

    javier vilchis

    9 posts

    This question may be related to a resolved thread.

    Hello, I’m trying to do this:

    Main
      -sub main
    About
    Location
    Product
      -product 1
      -product 2
      -product 3
            -product 3a
            -product 3b
            -product 3c

    I’m able create the Parent and Child but I cannot get the children from the Child Cat. For instance, if I create an entry and set it to be in the category of Product > -product 3, it creates an entry inside -product 3 > -product 3d

    When I click that entry, I would like to get the category parent of that -product 3d entry.

    I’m able to get it with js but it gives me the whole list of categories

    {exp:channel:entries channel="products" url_title="{segment_3}" limit="1" orderby="date" sort="desc" dynamic="on" paginate="bottom" }
    {exp:channel:categories parent_only="yes" category_group="8" limit="1"}
                    [removed]
    var oldURL = document.referrer;
    [removed](oldURL);
     }
                    [removed]
    {/exp:channel:categories}
                        <h1>{title}</h1>
                     
                        <div class="clear"></div>
                      
                        {if product_thumbnail == ""}
                          
                        {if:else}
                          {product_thumbnail}
                        {/if}
                        
                          
                         <!--  {product_thumbnail} -->
                          
                          {product_content_<?php echo $_SESSION['lang']; ?>}      
            
         {/exp:channel:entries}

    Please let me know if this can be done without using any plugins.

  • #2 / Aug 15, 2012 10:43am

    javier vilchis

    9 posts

    my bad, I said “I’m able create the Parent and Child but I cannot get the children from the Child Cat. For instance, if I create an entry and set it to be in the category of Product > -product 3, it creates an entry inside -product 3 > -product 3d”

    but what I meant to say is that I cannot get the category>category name> of that entry.

  • #3 / Aug 15, 2012 11:14am

    Boyink!

    5011 posts

    I’d say this is one time where using a plugin will just be easier and more elegant.

  • #4 / Aug 16, 2012 5:30pm

    Dan Decker

    7338 posts

    Hi Javier,

    I’m going to agree with Mike on this and recommend Child Categories as a solution.

    It’s not clear in the User Guide, but the channel categories tag is a stand-along tag. Nesting it inside of a channel entries tag is discouraged. It can cause some performance problems and can produce unpredictable results too.

    That plugin gives you some flexibility above what EE does natively, including category depth.

    ~

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases