Announcement

Collapse
No announcement yet.

Manually set category tree item to active?

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

    Manually set category tree item to active?

    Some more of my baby questions - thanks for bearing with me all these years, will never be a pro.

    I added a category here (COVID-19)

    https://www.allfrom1supply.com/healt...-supplies.html

    that uses the ALT page field to call a redirect to a page

    https://www.allfrom1supply.com/covid...urce-page.html

    I did this because using the ALT page field to directly call the page didn't load a particular section (that used ScotsScripts FastFAQ addon). I knew it worked when I went directly to it so I used the ToolKit callurl method which worked.

    However the category tree is not expanded since the page has no parent, so I was wondering if I could manually expand the category 'Workplace Health & Safety Supplies' so it would appear to the users they are still in that category?

    #2
    You should be able to add an mvt:if statement in the category tree template to expand the category manually.

    Something like:

    //ALREADY EXISTING CODE
    <mvt:if expr="(l.settings:category:id AND l.settings:category:id EQ l.settings:cattree_category:id) OR (l.settings:cattree_category:code EQ l.settings:breadcrumbs:links[1]:code)">
    <mvt:assign name="l.settings:cattree_category:class" value="'active'" />
    <mvt:elseif expr="g.Category_Code AND ISNULL l.settings:category:id AND l.settings:cattree_category:code EQ g.Category_Code">
    <mvt:assign name="l.settings:cattree_category:class" value="'active'" />
    //NEW CODE TO ADD BELOW
    <mvt:elseif expr="g.Screen EQ 'FOO'">
    <mvt:if expr="l.settings.cattree_category:code EQ 'BAR'">
    <mvt:assign name="l.settings:cattree_category:class" value="'active'" />
    </mvt:if>
    </mvt:if>

    FOO being the page code that you want the category tree manually expanded on (COVID-19 Resource Page).
    BAR being the category code that you want expanded (Workplace Health & Safety Supplies).


    There might be a better way to do it, but that should do the trick.
    Last edited by kat_oakos; 07-27-20, 10:40 AM.

    Comment


      #3
      Thank you that looks like it will do it.

      Comment

      Working...
      X