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 showing up twice

September 10, 2012 2:00pm

Subscribe [1]
  • #1 / Sep 10, 2012 2:00pm

    Sven T.

    21 posts

    Hi

    I am musing over a strange behavior of the categories. I have only one category group. It contains only first and 2nd level categories.

    <h3>Category</h3>
    <p>    <ul><br />
     <br />
        <?<br />
            // this is a work around due to EE unexpected behavior of the path function<br />
            $mypath="{path='storefront/find'}";<br />
        ?><br />
        {exp:channel:categories style="linear" category_group="1"}<br />
      {if "{shop_by}" != "no"}<br />
             <li><a href="http://&lt?=$mypath?&gt/{category_url_title}/{category_id}/sb">{category_name}</a></li><br />
      {/if}<br />
        {/exp:channel:categories}<br />
     <br />
        </ul>

    Now I would expect every category to show up once - but the list get contains each child category twice which looks in my case like this:


    Category

      Rings
      Watches
      Knives
      Spiritual
      Clocks
      Apparel
      Plates
      Outdoor
      Gift Items
      Sculpture
      Spiritual
      Clocks
      Apparel
      Plates
      Outdoor
      Gift Items
      Sculpture

    (I marked the doubles blue)

    Has anyone an idea whats causing this?

    Thanks

  • #2 / Sep 11, 2012 10:39pm

    Dan Decker

    7338 posts

    Hi Sven Tilburg,

    I am sorry you are having trouble with this!

    I’m not clear on why you are using PHP here?

    What version of ExpressionEngine are you seeing this behavior with?

    What are you trying to do? Can you give me a description about what your end goal is?

    I’d look forward to offering some ideas!

    Cheers,

  • #3 / Sep 12, 2012 1:32pm

    Sven T.

    21 posts

    Hi

    The php is not the issue - I have to use it to build my path manually - EE will otherwise add something to the path (what I don’t want in this case) - So I am using php only to get the site path and then build the uri myself. But the whole PHP thing is unrelated to the issue of child categories showing up twice.

    I am using EE 2.4 here

    Sven

    PS: The links go to a search, I am bascially searching for entries that contain the category name. (Thats does make sense in my case 😊 )

  • #4 / Sep 13, 2012 11:48am

    Dan Decker

    7338 posts

    Hey Sven,

    But the whole PHP thing is unrelated to the issue of child categories showing up twice.

    That’s fine, but it does affect output, ultimately. I simply wanted to know how you were using it to have the full picture of your template 😊 What parsing stage is it set to in this template? Is this the entire template?

    Thanks for giving your version number. With it being 2.4, I won’t be able to replicate. Is it possible to update to ExpressionEngine 2.5.3?

    If not, I would really need to see the whole template to effectively troubleshoot.

    Thanks for your patience!

    Cheers,

  • #5 / Sep 14, 2012 1:40pm

    Sven T.

    21 posts

    Hi here is the full template - I hope you find what I am missing here…

    <div id="shopby">
        <h2>Shop by:</h2>
    
    <h3>Service Branch</h3>
    <p>    <ul><br />
            <li><a href="http://{path=storefront/find_internal}/army">U.S. Army</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/airforce">U.S. Air Force</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/marine">U.S. Marine Corps</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/navy">U.S. Navy</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/coast">U.S. Coast Guard</a></li><br />
        </ul></p>
    
    <h3>War / Conflict</h3>
    <p>    <ul><br />
            <li><a href="http://{path=storefront/find_internal}/wwii">WW II</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/koreawar">Korean War Service</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/koreadefense">Korea Defense Service</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/coldwar">Cold War</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/vietnamservice">Vietnam Service</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/vietnam">Vietnam Campaign</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/desertstorm">Desert Storm</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/iraq">Iraq</a></li><br />
            <li><a href="http://{path=storefront/find_internal}/afghanistan">Afghanistan</a></li><br />
        </ul></p>
    
    <p>    </p><h3>Category</h3>
    <p>    <ul><br />
     <br />
        <?<br />
            // this is a work around due to EE unexpected behavior of the path function<br />
            $mypath="{path='storefront/find'}";<br />
        ?><br />
        {exp:channel:categories style="linear" category_group="1"}<br />
      {if "{shop_by}" != "no"}<br />
             <li><a href="http://&lt?=$mypath?&gt/{category_url_title}/{category_id}/sb">{category_name}</a></li><br />
      {/if}<br />
        {/exp:channel:categories}<br />
     <br />
        </ul><br />
    </div>

    Its the template of a sidebar that is embeded in the site. Site uses CT as a cart. Allow PHP = Yes on Output.

    Thanks for helping

    Sven

  • #6 / Sep 17, 2012 4:36pm

    Dan Decker

    7338 posts

    Hey Sven,

    I’d like to get a closeup look at this. Be on the lookout for an email from EllisLab!

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases