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.

Category alias

October 17, 2010 3:59pm

Subscribe [3]
  • #1 / Oct 17, 2010 3:59pm

    Rudy Affandi

    9 posts

    Hi all,

    I am working on a pretty complex project on EE 2.1.0 and running into this issue. I have tons of categories/sub-categories and some of the sub-categories belong to more than one parent. For example:

    Juice Category
    - Apples
    - Oranges
       - With Pulp
       - Without Pulp
    - Grapes
    
    Grocery List Category
    - Oranges
       - With Pulp
       - Without Pulp
    - Kiwi

    My question is: Is there a way to create just one Oranges sub-category and reuse it in other places? (in my example, there should be only one master of Oranges even though I use it more than once.)

    Thanks in advance for your help

    Cheers
    Rudy Affandi

  • #2 / Oct 17, 2010 9:06pm

    Rob Allen

    3114 posts

    That’s a good question. One idea might be to add some extra extra category fields to act as a “flag” so you can customise the output of your category lists.

    Here’s what I’d do (not tested):

    Create two custom SELECT fields for your categories with options Yes and No.

    Field name: Show in juices
    Field short name: juices_show
    Options: Yes/No

    Field name: Show in grocery list
    Field short name: grocery_show
    Options: Yes/No

    Then in your template add two category tags.

    <h2>Juices</h2>
    <p>{exp:channel:categories category_group="1|2"}<br />
    {if juices_show == "Yes"}<br />
    {category_name}<br />
    {/if}<br />
    {/exp:channel:categories}</p>
    
    <h2>Grocery List Category</h2>
    <p>{exp:channel:categories category_group="1|2"}<br />
    {if grocery_show == "Yes"}<br />
    {category_name}<br />
    {/if}<br />
    {/exp:channel:categories}

    Work through your categories setting the Yes/No’s as appropriate. You will need to play around with the tag parameters and variables to get the desired output.

  • #3 / Oct 18, 2010 3:21am

    John Henry Donovan

    12339 posts

    Some good advice there from bluedreamer. Would that work in your particular setup Rudy?

    I am going to move this thread to the CodeShare Corner so the conversation can continue

  • #4 / Oct 19, 2010 9:40am

    Rudy Affandi

    9 posts

    Thanks Rob for the reply. Unfortunately your proposed solution won’t work with the scope of my project. I have over 500 categories/sub categories and the problem is that one sub category that resides on the secondary level on one site can become a copy/alias on a 3rd or 4th level category on another site.

    I also looked into using Channel to simulate Categories and created custom field using Playa to create Item Children but it is very difficult to control the hierarchy properly without using many templates. I don’t think EE is geared for that at the moment. I think native “Parent/Children” relationthip for channel entries on EE is the way to go.

    For now, my solution is to create duplicate categories and manual copy of all the content inside them until there is a sensible solution.

    Thanks again for the reply and also to you John.

    Rudy

  • #5 / Oct 19, 2010 1:19pm

    OrganizedFellow

    435 posts

    For now, my solution is to create duplicate categories and manual copy of all the content inside them until there is a sensible solution.

    WOW Rudy.
    That’s alot of copying and pasting!

    I can’t help wonder if there is already some addon available at devot-ee.com?

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

ExpressionEngine News!

#eecms, #events, #releases