Announcement

Collapse
No announcement yet.

Retaining the Parent Category in the Category Tree

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

    Retaining the Parent Category in the Category Tree

    One of the "features" of the Colossus Category Tree Template is to not display all of the Parent Categories once a Child (sub-category) has been selected


    Code:
    <nav class="x-accordion-category-tree t-accordion-category-tree">
    <mvt:comment>
    <!-- Check if the current, parent category has any children. -->
    </mvt:comment>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:bread crumbs:links[1]:code, l.settings:current_parent)"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_parent:id, l.settings:children)"/>
    <mvt:if expr="l.settings:children GT 0">
    <mvt:comment>
    <!--
    If the parent category has children, show all child and grandchild categories in an accordion navigation.
    -->
    </mvt:comment>
    <ul class="x-accordion-category-tree__row">
    <mvt:foreach iterator="child" array="children">
    <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
    <mvt:assign name="l.uri:cat_id" value="l.settings:child:id"/>
    <mvt:assign name="l.settings:grandchildren" value="0"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:child :code, l.settings:current_child)"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_child:id, l.settings:grandchildren)"/>
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:child:link)"/>
    <mvt:foreach iterator="grandchild" array="grandchildren">
    <mvt:if expr="l.settings:grandchild:code EQ l.settings:breadcrumbs:current_item:code">
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_ID(l.settings:grandch ild:parent_id, l.settings:parent_category)" />
    </mvt:if>
    </mvt:foreach>
    <mvt:if expr="(l.settings:child:code EQ l.settings:breadcrumbs:current_item:code) OR (l.settings:child:code EQ l.settings:parent_category:code)">
    <mvt:assign name="l.settings:current:active" value="'is-active'"/>
    <mvt:assign name="l.settings:current:child" value="'x-accordion-category-tree__link--current'"/>
    <mvt:else>
    <mvt:assign name="l.settings:current:active" value="''"/>
    <mvt:assign name="l.settings:current:child" value="''"/>
    </mvt:if>
    <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-1 &mvte:current:active;">
    <div class="x-accordion-category-tree__summary">
    <a class="x-accordion-category-tree__link &mvte:current:child; u-text-medium" href="&mvte:child:link:uri;">&mvte:child:name;</a>
    <mvt:if expr="l.settings:grandchildren GT 0">
    <button class="x-accordion-category-tree__toggle c-button u-bg-transparent u-font-tiny" data-hook="accordion-toggle" type="button" aria-label="View More &mvte:child:name;"><span class="u-icon-add"></span></button>
    </mvt:if>
    </div>
    <mvt:if expr="l.settings:grandchildren GT 0">
    <ul class="x-accordion-category-tree__row x-accordion-category-tree__details">
    <mvt:foreach iterator="grandchild" array="grandchildren">
    <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
    <mvt:assign name="l.uri:cat_id" value="l.settings:grandchild:id"/>
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:grandchild:link)"/>
    <mvt:if expr="l.settings:grandchild:code EQ l.settings:breadcrumbs:current_item:code">
    <mvt:assign name="l.settings:current:grandchild" value="'x-accordion-category-tree__link--current'"/>
    <mvt:else>
    <mvt:assign name="l.settings:current:grandchild" value="''"/>
    </mvt:if>
    <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-2">
    <a class="x-accordion-category-tree__link &mvte:current:grandchild;" href="&mvte:grandchild:link:uri;">&mvte:grandchild :name;</a>
    </li>
    </mvt:foreach>
    </ul>
    </mvt:if>
    </li>
    </mvt:foreach>
    </ul>
    <mvt:else>
    <mvt:comment>
    <!--
    If the parent category does not have children, show all parent and, applicable,
    child categories in an accordion navigation.
    -->
    </mvt:comment>
    <ul class="x-accordion-category-tree__row">
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent('', l.settings:parent_categories)" />
    <mvt:foreach iterator="parent" array="parent_categories">
    <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
    <mvt:assign name="l.uri:cat_id" value="l.settings:parent:id"/>
    <mvt:assign name="l.settings:children" value="0"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:paren t:code, l.settings:current_parent)"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_parent:id, l.settings:children)"/>
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:parent:link)"/>
    <mvt:foreach iterator="child" array="children">
    <mvt:if expr="l.settings:child:code EQ l.settings:breadcrumbs:current_item:code">
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_ID(l.settings:child:p arent_id, l.settings:parent_category)" />
    </mvt:if>
    </mvt:foreach>
    <mvt:if expr="(l.settings:parent:code EQ l.settings:breadcrumbs:current_item:code) OR (l.settings:parent:code EQ l.settings:parent_category:code)">
    <mvt:assign name="l.settings:current:active" value="'is-active'"/>
    <mvt:assign name="l.settings:current:parent" value="'x-accordion-category-tree__link--current'"/>
    <mvt:else>
    <mvt:assign name="l.settings:current:active" value="''"/>
    <mvt:assign name="l.settings:current:parent" value="''"/>
    </mvt:if>
    <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-1 &mvte:current:active;">
    <div class="x-accordion-category-tree__summary">
    <a class="x-accordion-category-tree__link &mvte:current:parent; u-text-medium" href="&mvte:parent:link:uri;">&mvte:parent:name;</a>
    <mvt:if expr="l.settings:children GT 0">
    <button class="x-accordion-category-tree__toggle c-button u-bg-transparent u-font-tiny" data-hook="accordion-toggle" type="button" aria-label="View More &mvte:parent:name;"><span class="u-icon-add"></span></button>
    </mvt:if>
    </div>
    <mvt:if expr="l.settings:children GT 0">
    <ul class="x-accordion-category-tree__row x-accordion-category-tree__details">
    <mvt:foreach iterator="child" array="children">
    <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
    <mvt:assign name="l.uri:cat_id" value="l.settings:child:id"/>
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:child:link)"/>
    <mvt:if expr="l.settings:child:code EQ l.settings:breadcrumbs:current_item:code">
    <mvt:assign name="l.settings:current:child" value="'x-accordion-category-tree__link--current'"/>
    <mvt:else>
    <mvt:assign name="l.settings:current:child" value="''"/>
    </mvt:if>
    <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-2">
    <a class="x-accordion-category-tree__link &mvte:current:child;" href="&mvte:child:link:uri;">&mvte:child:name;</a>
    </li>
    </mvt:foreach>
    </ul>
    </mvt:if>
    </li>
    </mvt:foreach>
    </ul>
    </mvt:if>
    </nav>
    <!-- end .x-accordion-category-tree -->
    Is there a way to simplify this so that the parent categories still remain when a child is selected?
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    #2
    Hi Leslie,

    I haven't tested it, but you might try something like this:
    Code:
    <nav class="x-accordion-category-tree t-accordion-category-tree">
    <mvt:comment>
    <!-- Check if the current, parent category has any children. -->
    </mvt:comment>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:bread crumbs:links[1]:code, l.settings:current_parent)"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_parent:id, l.settings:children)"/>
    <mvt:if expr="l.settings:children GT 0">
    <mvt:comment>
    <!--
    If the parent category has children, show all child and grandchild categories in an accordion navigation.
    -->
    </mvt:comment>
    <mvt:assign name="l.parent_uri:store_id" value="g.Store:id"/>
    <mvt:assign name="l.parent_uri:cat_id" value="l.settings:parent:id"/>
    <mvt:assign name="l.settings:children" value="0"/>
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_parent_uri" value="URI_Load_Item_Canonical(l.parent_uri, l.settings:parent:link)"/>
    <ul class="x-accordion-category-tree__row">
    <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-1">
    <div class="x-accordion-category-tree__summary">
    <a class="x-accordion-category-tree__link &mvte:current:parent; u-text-medium" href="&mvte:parent:link:uri;">&mvte:parent:name;</a>
    <mvt:if expr="l.settings:children GT 0">
    <button class="x-accordion-category-tree__toggle c-button u-bg-transparent u-font-tiny" data-hook="accordion-toggle" type="button" aria-label="View More &mvte:parent:name;"><span class="u-icon-add"></span></button>
    </mvt:if>
    </div>
    </li>
    <mvt:foreach iterator="child" array="children">
    <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
    <mvt:assign name="l.uri:cat_id" value="l.settings:child:id"/>
    <mvt:assign name="l.settings:grandchildren" value="0"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:child :code, l.settings:current_child)"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_child:id, l.settings:grandchildren)"/>
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:child:link)"/>
    <mvt:foreach iterator="grandchild" array="grandchildren">
    <mvt:if expr="l.settings:grandchild:code EQ l.settings:breadcrumbs:current_item:code">
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_ID(l.settings:grandch ild:parent_id, l.settings:parent_category)" />
    </mvt:if>
    </mvt:foreach>
    <mvt:if expr="(l.settings:child:code EQ l.settings:breadcrumbs:current_item:code) OR (l.settings:child:code EQ l.settings:parent_category:code)">
    <mvt:assign name="l.settings:current:active" value="'is-active'"/>
    <mvt:assign name="l.settings:current:child" value="'x-accordion-category-tree__link--current'"/>
    <mvt:else>
    <mvt:assign name="l.settings:current:active" value="''"/>
    <mvt:assign name="l.settings:current:child" value="''"/>
    </mvt:if>
    <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-1 &mvte:current:active;">
    <div class="x-accordion-category-tree__summary">
    <a class="x-accordion-category-tree__link &mvte:current:child; u-text-medium" href="&mvte:child:link:uri;">&mvte:child:name;</a>
    <mvt:if expr="l.settings:grandchildren GT 0">
    <button class="x-accordion-category-tree__toggle c-button u-bg-transparent u-font-tiny" data-hook="accordion-toggle" type="button" aria-label="View More &mvte:child:name;"><span class="u-icon-add"></span></button>
    </mvt:if>
    </div>
    <mvt:if expr="l.settings:grandchildren GT 0">
    <ul class="x-accordion-category-tree__row x-accordion-category-tree__details">
    <mvt:foreach iterator="grandchild" array="grandchildren">
    <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
    <mvt:assign name="l.uri:cat_id" value="l.settings:grandchild:id"/>
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:grandchild:link)"/>
    <mvt:if expr="l.settings:grandchild:code EQ l.settings:breadcrumbs:current_item:code">
    <mvt:assign name="l.settings:current:grandchild" value="'x-accordion-category-tree__link--current'"/>
    <mvt:else>
    <mvt:assign name="l.settings:current:grandchild" value="''"/>
    </mvt:if>
    <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-2">
    <a class="x-accordion-category-tree__link &mvte:current:grandchild;" href="&mvte:grandchild:link:uri;">&mvte:grandchild :name;</a>
    </li>
    </mvt:foreach>
    </ul>
    </mvt:if>
    </li>
    </mvt:foreach>
    </ul>
    <mvt:else>
    <mvt:comment>
    <!--
    If the parent category does not have children, show all parent and, applicable,
    child categories in an accordion navigation.
    -->
    </mvt:comment>
    <ul class="x-accordion-category-tree__row">
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent('', l.settings:parent_categories)" />
    <mvt:foreach iterator="parent" array="parent_categories">
    <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
    <mvt:assign name="l.uri:cat_id" value="l.settings:parent:id"/>
    <mvt:assign name="l.settings:children" value="0"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:paren t:code, l.settings:current_parent)"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_parent:id, l.settings:children)"/>
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:parent:link)"/>
    <mvt:foreach iterator="child" array="children">
    <mvt:if expr="l.settings:child:code EQ l.settings:breadcrumbs:current_item:code">
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_ID(l.settings:child:p arent_id, l.settings:parent_category)" />
    </mvt:if>
    </mvt:foreach>
    <mvt:if expr="(l.settings:parent:code EQ l.settings:breadcrumbs:current_item:code) OR (l.settings:parent:code EQ l.settings:parent_category:code)">
    <mvt:assign name="l.settings:current:active" value="'is-active'"/>
    <mvt:assign name="l.settings:current:parent" value="'x-accordion-category-tree__link--current'"/>
    <mvt:else>
    <mvt:assign name="l.settings:current:active" value="''"/>
    <mvt:assign name="l.settings:current:parent" value="''"/>
    </mvt:if>
    <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-1 &mvte:current:active;">
    <div class="x-accordion-category-tree__summary">
    <a class="x-accordion-category-tree__link &mvte:current:parent; u-text-medium" href="&mvte:parent:link:uri;">&mvte:parent:name;</a>
    <mvt:if expr="l.settings:children GT 0">
    <button class="x-accordion-category-tree__toggle c-button u-bg-transparent u-font-tiny" data-hook="accordion-toggle" type="button" aria-label="View More &mvte:parent:name;"><span class="u-icon-add"></span></button>
    </mvt:if>
    </div>
    <mvt:if expr="l.settings:children GT 0">
    <ul class="x-accordion-category-tree__row x-accordion-category-tree__details">
    <mvt:foreach iterator="child" array="children">
    <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
    <mvt:assign name="l.uri:cat_id" value="l.settings:child:id"/>
    <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:child:link)"/>
    <mvt:if expr="l.settings:child:code EQ l.settings:breadcrumbs:current_item:code">
    <mvt:assign name="l.settings:current:child" value="'x-accordion-category-tree__link--current'"/>
    <mvt:else>
    <mvt:assign name="l.settings:current:child" value="''"/>
    </mvt:if>
    <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-2">
    <a class="x-accordion-category-tree__link &mvte:current:child;" href="&mvte:child:link:uri;">&mvte:child:name;</a>
    </li>
    </mvt:foreach>
    </ul>
    </mvt:if>
    </li>
    </mvt:foreach>
    </ul>
    </mvt:if>
    </nav>
    <!-- end .x-accordion-category-tree -->
    Matt Zimmermann

    Miva Web Developer
    Alchemy Web Development
    https://www.alchemywebdev.com
    Site Development - Maintenance - Consultation

    Miva Certified Developer
    Miva Professional Developer

    https://www.dev4web.net | Twitter

    Comment


      #3
      Thanks, Matt Zimmermann - that resolved the Parent Category issue, but it caused the children to go away. I'd like to be able to display at least the first level of child categories.
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        Hi Leslie,

        Sorry, I left a line in that would eliminate the children. Try this:
        Code:
        <nav class="x-accordion-category-tree t-accordion-category-tree">
        <mvt:comment>
        <!-- Check if the current, parent category has any children. -->
        </mvt:comment>
        <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:bread crumbs:links[1]:code, l.settings:current_parent)"/>
        <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_parent:id, l.settings:children)"/>
        <mvt:if expr="l.settings:children GT 0">
        <mvt:comment>
        <!--
        If the parent category has children, show all child and grandchild categories in an accordion navigation.
        -->
        </mvt:comment>
        <mvt:assign name="l.parent_uri:store_id" value="g.Store:id"/>
        <mvt:assign name="l.parent_uri:cat_id" value="l.settings:parent:id"/>
        <mvt:do file="g.Module_Feature_URI_DB" name="l.have_parent_uri" value="URI_Load_Item_Canonical(l.parent_uri, l.settings:parent:link)"/>
        <ul class="x-accordion-category-tree__row">
        <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-1">
        <div class="x-accordion-category-tree__summary">
        <a class="x-accordion-category-tree__link &mvte:current:parent; u-text-medium" href="&mvte:parent:link:uri;">&mvte:parent:name;</a>
        <mvt:if expr="l.settings:children GT 0">
        <button class="x-accordion-category-tree__toggle c-button u-bg-transparent u-font-tiny" data-hook="accordion-toggle" type="button" aria-label="View More &mvte:parent:name;"><span class="u-icon-add"></span></button>
        </mvt:if>
        </div>
        </li>
        <mvt:foreach iterator="child" array="children">
        <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
        <mvt:assign name="l.uri:cat_id" value="l.settings:child:id"/>
        <mvt:assign name="l.settings:grandchildren" value="0"/>
        <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:child :code, l.settings:current_child)"/>
        <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_child:id, l.settings:grandchildren)"/>
        <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:child:link)"/>
        <mvt:foreach iterator="grandchild" array="grandchildren">
        <mvt:if expr="l.settings:grandchild:code EQ l.settings:breadcrumbs:current_item:code">
        <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_ID(l.settings:grandch ild:parent_id, l.settings:parent_category)" />
        </mvt:if>
        </mvt:foreach>
        <mvt:if expr="(l.settings:child:code EQ l.settings:breadcrumbs:current_item:code) OR (l.settings:child:code EQ l.settings:parent_category:code)">
        <mvt:assign name="l.settings:current:active" value="'is-active'"/>
        <mvt:assign name="l.settings:current:child" value="'x-accordion-category-tree__link--current'"/>
        <mvt:else>
        <mvt:assign name="l.settings:current:active" value="''"/>
        <mvt:assign name="l.settings:current:child" value="''"/>
        </mvt:if>
        <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-1 &mvte:current:active;">
        <div class="x-accordion-category-tree__summary">
        <a class="x-accordion-category-tree__link &mvte:current:child; u-text-medium" href="&mvte:child:link:uri;">&mvte:child:name;</a>
        <mvt:if expr="l.settings:grandchildren GT 0">
        <button class="x-accordion-category-tree__toggle c-button u-bg-transparent u-font-tiny" data-hook="accordion-toggle" type="button" aria-label="View More &mvte:child:name;"><span class="u-icon-add"></span></button>
        </mvt:if>
        </div>
        <mvt:if expr="l.settings:grandchildren GT 0">
        <ul class="x-accordion-category-tree__row x-accordion-category-tree__details">
        <mvt:foreach iterator="grandchild" array="grandchildren">
        <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
        <mvt:assign name="l.uri:cat_id" value="l.settings:grandchild:id"/>
        <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:grandchild:link)"/>
        <mvt:if expr="l.settings:grandchild:code EQ l.settings:breadcrumbs:current_item:code">
        <mvt:assign name="l.settings:current:grandchild" value="'x-accordion-category-tree__link--current'"/>
        <mvt:else>
        <mvt:assign name="l.settings:current:grandchild" value="''"/>
        </mvt:if>
        <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-2">
        <a class="x-accordion-category-tree__link &mvte:current:grandchild;" href="&mvte:grandchild:link:uri;">&mvte:grandchild :name;</a>
        </li>
        </mvt:foreach>
        </ul>
        </mvt:if>
        </li>
        </mvt:foreach>
        </ul>
        <mvt:else>
        <mvt:comment>
        <!--
        If the parent category does not have children, show all parent and, applicable,
        child categories in an accordion navigation.
        -->
        </mvt:comment>
        <ul class="x-accordion-category-tree__row">
        <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent('', l.settings:parent_categories)" />
        <mvt:foreach iterator="parent" array="parent_categories">
        <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
        <mvt:assign name="l.uri:cat_id" value="l.settings:parent:id"/>
        <mvt:assign name="l.settings:children" value="0"/>
        <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:paren t:code, l.settings:current_parent)"/>
        <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_parent:id, l.settings:children)"/>
        <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:parent:link)"/>
        <mvt:foreach iterator="child" array="children">
        <mvt:if expr="l.settings:child:code EQ l.settings:breadcrumbs:current_item:code">
        <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_ID(l.settings:child:p arent_id, l.settings:parent_category)" />
        </mvt:if>
        </mvt:foreach>
        <mvt:if expr="(l.settings:parent:code EQ l.settings:breadcrumbs:current_item:code) OR (l.settings:parent:code EQ l.settings:parent_category:code)">
        <mvt:assign name="l.settings:current:active" value="'is-active'"/>
        <mvt:assign name="l.settings:current:parent" value="'x-accordion-category-tree__link--current'"/>
        <mvt:else>
        <mvt:assign name="l.settings:current:active" value="''"/>
        <mvt:assign name="l.settings:current:parent" value="''"/>
        </mvt:if>
        <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-1 &mvte:current:active;">
        <div class="x-accordion-category-tree__summary">
        <a class="x-accordion-category-tree__link &mvte:current:parent; u-text-medium" href="&mvte:parent:link:uri;">&mvte:parent:name;</a>
        <mvt:if expr="l.settings:children GT 0">
        <button class="x-accordion-category-tree__toggle c-button u-bg-transparent u-font-tiny" data-hook="accordion-toggle" type="button" aria-label="View More &mvte:parent:name;"><span class="u-icon-add"></span></button>
        </mvt:if>
        </div>
        <mvt:if expr="l.settings:children GT 0">
        <ul class="x-accordion-category-tree__row x-accordion-category-tree__details">
        <mvt:foreach iterator="child" array="children">
        <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
        <mvt:assign name="l.uri:cat_id" value="l.settings:child:id"/>
        <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:child:link)"/>
        <mvt:if expr="l.settings:child:code EQ l.settings:breadcrumbs:current_item:code">
        <mvt:assign name="l.settings:current:child" value="'x-accordion-category-tree__link--current'"/>
        <mvt:else>
        <mvt:assign name="l.settings:current:child" value="''"/>
        </mvt:if>
        <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-2">
        <a class="x-accordion-category-tree__link &mvte:current:child;" href="&mvte:child:link:uri;">&mvte:child:name;</a>
        </li>
        </mvt:foreach>
        </ul>
        </mvt:if>
        </li>
        </mvt:foreach>
        </ul>
        </mvt:if>
        </nav>
        <!-- end .x-accordion-category-tree -->
        Matt Zimmermann

        Miva Web Developer
        Alchemy Web Development
        https://www.alchemywebdev.com
        Site Development - Maintenance - Consultation

        Miva Certified Developer
        Miva Professional Developer

        https://www.dev4web.net | Twitter

        Comment


          #5
          Thanks but that didn't help, it's still leaving them out.
          Leslie Kirk
          Miva Certified Developer
          Miva Merchant Specialist since 1997
          Previously of Webs Your Way
          (aka Leslie Nord leslienord)

          Email me: [email protected]
          www.lesliekirk.com

          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

          Comment


            #6
            Following up on this. I resolved the issue by using the Category Tree Template from Shadows 2.0.0 plus my own tweak to prevent the display of sub-sub-categories. I have not edited it yet for CSS, this is just the functional code:


            Code:
            <nav class="x-category-tree x-collapsible-content" aria-labelledby="categoryTree-label">
            <div class="x-category-tree__title">
            <h3 id="categoryTree-label" class="x-category-tree__heading c-heading-echo u-text-bold u-text-uppercase">Products and Prices</h3>
            <hr class="c-keyline">
            </div>
            <button class="x-category-tree__label x-collapsible-content__toggle u-text-uppercase" data-a11y-toggle="categoryTree" type="button">Categories <span class="u-icon-add" data-toggle="<" aria-hidden="true"></span></button>
            <ul id="categoryTree" class="x-category-tree__row x-collapsible-content__item">
            <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;" title="&mvte:cattree_category:name;">&mvt:cattree_ category: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;" title="&mvte:cattree_category:name;">&mvt:cattree_ category:name;</a>
            <mvt:else>
            <mvt:if expr="l.settings:cattree_category:customfield_valu es:customfields:NV NE '1'">
            <a class="x-category-tree__link" href="&mvte:cattree_category:link;" title="&mvte:cattree_category:name;">&mvt:cattree_ category:name;</a>
            <mvt:else>
            </mvt:if>
            </mvt:if>
            </li>
            </mvt:foreach>
            </ul>
            </nav>
            <!-- end .x-category-tree -->
            Leslie Kirk
            Miva Certified Developer
            Miva Merchant Specialist since 1997
            Previously of Webs Your Way
            (aka Leslie Nord leslienord)

            Email me: [email protected]
            www.lesliekirk.com

            Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

            Comment


              #7
              I do have some "minor" issues with the cattree in the mobile view - I pretty sure it's the javascript I haven't added. Matt Zimmermann Any hints as to what all I might need?
              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

              Comment


                #8
                Hi Leslie,

                If you are going to try and port Shadows 2 to Colossus, you will need to do some retrofitting. For that category tree structure to work, you will have to add in the toggling functionality: https://github.com/mivaecommerce/rea...s/show-related
                Matt Zimmermann

                Miva Web Developer
                Alchemy Web Development
                https://www.alchemywebdev.com
                Site Development - Maintenance - Consultation

                Miva Certified Developer
                Miva Professional Developer

                https://www.dev4web.net | Twitter

                Comment


                  #9
                  Originally posted by Matt Zimmermann View Post
                  Hi Leslie,

                  If you are going to try and port Shadows 2 to Colossus, you will need to do some retrofitting. For that category tree structure to work, you will have to add in the toggling functionality: https://github.com/mivaecommerce/rea...s/show-related
                  Sorry for the ignorant question(s) - do I add this code to a specific file or create a new resource OR do I have to update the version of Shadows 2.0.0 to a newer version?
                  Leslie Kirk
                  Miva Certified Developer
                  Miva Merchant Specialist since 1997
                  Previously of Webs Your Way
                  (aka Leslie Nord leslienord)

                  Email me: [email protected]
                  www.lesliekirk.com

                  Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                  Comment


                    #10
                    Hi Leslie,

                    Technically, this is not a plug-n-play solution as the components of Shadows 2 are not backwards compatible to Colossus or Shadows 1. You would have to add the styles into your workflow, add the JavaScript file as new, and call it in through your theme.js file. The think you'll have to watch out for is conflict with the existing "show-related" functionality.
                    Matt Zimmermann

                    Miva Web Developer
                    Alchemy Web Development
                    https://www.alchemywebdev.com
                    Site Development - Maintenance - Consultation

                    Miva Certified Developer
                    Miva Professional Developer

                    https://www.dev4web.net | Twitter

                    Comment


                      #11
                      Originally posted by Matt Zimmermann View Post
                      Hi Leslie,

                      Technically, this is not a plug-n-play solution as the components of Shadows 2 are not backwards compatible to Colossus or Shadows 1. You would have to add the styles into your workflow, add the JavaScript file as new, and call it in through your theme.js file. The think you'll have to watch out for is conflict with the existing "show-related" functionality.
                      Yes, I'm working on all of the CSS and I did note that there is an existing show-related - can I name the one from Shadows something other than "show-related"?
                      Leslie Kirk
                      Miva Certified Developer
                      Miva Merchant Specialist since 1997
                      Previously of Webs Your Way
                      (aka Leslie Nord leslienord)

                      Email me: [email protected]
                      www.lesliekirk.com

                      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                      Comment


                        #12
                        Hi Leslie,

                        Sure
                        Matt Zimmermann

                        Miva Web Developer
                        Alchemy Web Development
                        https://www.alchemywebdev.com
                        Site Development - Maintenance - Consultation

                        Miva Certified Developer
                        Miva Professional Developer

                        https://www.dev4web.net | Twitter

                        Comment


                          #13
                          Circling back on this because the curiosity got to me. I'm using this code but the tree is open on at the parent category level. Can it be tweaked to be closed on the parent?

                          Code:
                          <nav class="x-accordion-category-tree t-accordion-category-tree">
                          <mvt:comment>
                          <!-- Check if the current, parent category has any children. -->
                          </mvt:comment>
                          <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:bread crumbs:links[1]:code, l.settings:current_parent)"/>
                          <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_parent:id, l.settings:children)"/>
                          
                          <ul class="x-accordion-category-tree__row">
                          <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent('', l.settings:parent_categories)" />
                          <mvt:foreach iterator="parent" array="parent_categories">
                          <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
                          <mvt:assign name="l.uri:cat_id" value="l.settings:parent:id"/>
                          <mvt:assign name="l.settings:children" value="0"/>
                          <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_Code(l.settings:paren t:code, l.settings:current_parent)"/>
                          <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_Parent(l.settings :current_parent:id, l.settings:children)"/>
                          <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:parent:link)"/>
                          <mvt:foreach iterator="child" array="children">
                          <mvt:if expr="l.settings:child:code EQ l.settings:breadcrumbs:current_item:code">
                          <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_Category_Load_ID(l.settings:child:p arent_id, l.settings:parent_category)" />
                          </mvt:if>
                          </mvt:foreach>
                          <mvt:if expr="(l.settings:parent:code EQ l.settings:breadcrumbs:current_item:code) OR (l.settings:parent:code EQ l.settings:parent_category:code)">
                          <mvt:assign name="l.settings:current:active" value="'is-active'"/>
                          <mvt:assign name="l.settings:current:parent" value="'x-accordion-category-tree__link--current'"/>
                          <mvt:else>
                          <mvt:assign name="l.settings:current:active" value="''"/>
                          <mvt:assign name="l.settings:current:parent" value="''"/>
                          </mvt:if>
                          
                          <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-1 &mvte:current:active;">
                          <div class="x-accordion-category-tree__summary">
                          <a class="x-accordion-category-tree__link &mvte:current:parent; u-text-medium" href="&mvte:parent:link:uri;">&mvt:parent:name;</a>
                          <mvt:if expr="l.settings:children GT 0">
                          <button class="x-accordion-category-tree__toggle c-button u-bg-transparent u-font-tiny" data-hook="accordion-toggle" type="button" aria-label="View More &mvte:parent:name;"><span class="u-icon-add"></span></button>
                          </mvt:if>
                          </div>
                          
                          <mvt:if expr="l.settings:children GT 0">
                          <ul class="x-accordion-category-tree__row x-accordion-category-tree__details">
                          <mvt:foreach iterator="child" array="children">
                          <mvt:assign name="l.uri:store_id" value="g.Store:id"/>
                          <mvt:assign name="l.uri:cat_id" value="l.settings:child:id"/>
                          <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical(l.uri, l.settings:child:link)"/>
                          <mvt:if expr="l.settings:child:code EQ l.settings:breadcrumbs:current_item:code">
                          <mvt:assign name="l.settings:current:child" value="'x-accordion-category-tree__link--current'"/>
                          <mvt:else>
                          <mvt:assign name="l.settings:current:child" value="''"/>
                          </mvt:if>
                          <li class="x-accordion-category-tree__list x-accordion-category-tree__list--level-2">
                          <a class="x-accordion-category-tree__link &mvte:current:child;" href="&mvte:child:link:uri;">&mvt:child:name;</a>
                          </li>
                          </mvt:foreach>
                          </ul>
                          </mvt:if>
                          </li>
                          </mvt:foreach>
                          </ul>
                          </nav>
                          <!-- end .x-accordion-category-tree -->
                          Leslie Kirk
                          Miva Certified Developer
                          Miva Merchant Specialist since 1997
                          Previously of Webs Your Way
                          (aka Leslie Nord leslienord)

                          Email me: [email protected]
                          www.lesliekirk.com

                          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                          Comment


                            #14
                            Hi Leslie,

                            You may be able to remove the "is-active" conditional.
                            Matt Zimmermann

                            Miva Web Developer
                            Alchemy Web Development
                            https://www.alchemywebdev.com
                            Site Development - Maintenance - Consultation

                            Miva Certified Developer
                            Miva Professional Developer

                            https://www.dev4web.net | Twitter

                            Comment

                            Working...
                            X