Announcement

Collapse
No announcement yet.

Listing Sub-Sections Within Each Main Section

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

    Listing Sub-Sections Within Each Main Section

    This code will create a list of sections and sub-sections (first depth of sub-sections only) into your store in the following style:

    First Section
    Subsection 1, Subsection 2

    Second Section
    Sub section 1, Subsection 2, Subsection 3

    Paste the following code just above the </head> tag in your overall page layout:

    HTML Code:
    <actinic:variable value="All Data From All Sections" name="JavaScriptArray" />
    
    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
    function YahooSections(ar)
    {
    var strIDs = '';
    for (var i=1;i<=ar.length;i++)
    {
    if (ar[i].sURL !=null)
    {
    strIDs += '<a href="' + ar[i].sURL + '"><span class="actregular">' + ar[i].sName + '</span></a><br>';
    {
    if (ar[i].pChild)
    {
    for (var j=1;j<=ar[i].pChild.length;j++)
    {
    if (j < ar[i].pChild.length)
    {
    strIDs += '<a href="' + ar[i].pChild[j].sURL + '"><span class="actxsmall">' + ar[i].pChild[j].sName + '</span></a>, ';
    }
    else
    {
    strIDs += '<a href="' + ar[i].pChild[j].sURL + '"><span class="actxsmall">' + ar[i].pChild[j].sName + '</span></a>, ...';
    }
    }
    }
    }
    strIDs += '<br><br>'
    }
    }
    return strIDs
    }
    //-->
    </SCRIPT>
    And then insert the following code in the main body of the page where you want the list to appear.

    HTML Code:
    <script language=Javascript1.2>
    
    document.write(YahooSections(section_tree))
    
    </script>
Working...
X