Announcement

Collapse
No announcement yet.

Sidebar Navigation - First level categories disappear when digging down

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sidebar Navigation - First level categories disappear when digging down

    Hi all,
    When you go to 'all products' it shows all the main categories in the left hand sidebar.

    https://www.imagescienceassociates.c...-products.html

    The only section with a second level of nav is Targets (there is a plus sign that opens the two Targets categories). If you click on Targets (not the plus) the main categories disappear and only the two sub categories are shown. I don't like that user experience.

    Ideally I'd love to have ALL the categories show, all the time - even when you are in the Targets subcategories. Is there a way to change the current behavior? Thanks!


    #2
    The Colossus framework has custom code in the Global Settings > Settings > Category Tree Template that will only pull in the current category and subcategories if on the category page.

    Updating the code to use the Shadows Category Tree Template will get you the functionality needed. You may need to update the styling a bit to match the Colossus theme. Here is a snippet that will get you started:


    Code:
    <nav class="x-accordion-category-tree t-accordion-category-tree">
        <ul class="x-accordion-category-tree__row">
            <mvt:foreach array="cattree_categories" iterator="cattree_category">
                <li class="x-category-tree__list x-category-tree__list--level-&mvte:cattree_category:level;">
                    <mvt:if expr="NOT ISNULL l.settings:category:id AND l.settings:category:id EQ l.settings:cattree_category:id AND l.settings:page:code NE 'CTLG'">
                        <a class="x-category-tree__link x-category-tree__link--current" href="&mvte:cattree_category:link;">&mvt:cattree_c ategory:name;</a>
                    <mvt:elseif expr="NOT ISNULL g.Category_Code AND ISNULL l.settings:category:id AND l.settings:cattree_category:code EQ g.Category_Code AND l.settings:page:code NE 'CTLG'">
                        <a class="x-category-tree__link x-category-tree__link--current" href="&mvte:cattree_category:link;">&mvt:cattree_c ategory:name;</a>
                    <mvt:else>
                        <a class="x-category-tree__link" href="&mvte:cattree_category:link;">&mvt:cattree_category:name;</a>
                    </mvt:if>
                </li>              
            </mvt:foreach>  
        </ul>
    </nav>
    <!-- end .x-accordion-category-tree -->
    Last edited by Nick; 08-01-23, 11:07 AM.
    Nicholas Adkins
    Technical Training Specialist / Miva, Inc.
    [email protected]
    https://www.miva.com/mivalearn

    Comment


      #3
      Hi Nick, that almost works! I replaced the code and it looks fine on the main category, but when I click into a child category is has this listed for each link:

      ategory:name;

      (see attached). So what am I doing wrong?
      Attached Files

      Comment


        #4
        Looks like there was an issue with the copying of code into the forum post. I updated the code above that will correct the issue. There was just a space that was not supposed to be there.
        Nicholas Adkins
        Technical Training Specialist / Miva, Inc.
        [email protected]
        https://www.miva.com/mivalearn

        Comment


          #5
          I completely replaced my category tree code with this code and it worked after I found a couple more spots with there was a space ... thanks Nick! As you mentioned, the formatting is a bit different but not bad.

          Thanks for your help!
          Last edited by jfazar; 08-02-23, 08:24 AM.

          Comment

          Working...
          X