Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 5 of 5

Thread: Limit category to show only 5 sub-categories

  1. #1
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Question Limit category to show only 5 sub-categories

    At the moment on our home page we show all the categories with subcategories listed.

    However we only want to show the first 5 subcategories for each parent category.

    C#/VB.NET Code:
     <xsl:choose>
                                            <
    xsl:when test="count(/root/EntityHelpers/*[$scName]/descendant::Entity[ParentEntityID=$subCategoryId]) = 0">
                                              <
    a href="{aspdnsf:EntityLink(EntityID, SEName, 'c', 0, '')}">List All Products</a>
                                            </
    xsl:when>
                                            <
    xsl:otherwise>
                                              <
    xsl:for-each select="/root/EntityHelpers/*[$scName]/descendant::Entity[ParentEntityID=$subCategoryId]">
                                                <
    a href="{aspdnsf:EntityLink(EntityID, SEName, 'c', 0, '')}">
                                                  <
    xsl:value-of select="Name" disable-output-escaping="yes" />
                                                </
    a>
                                                <
    br />
                                              </
    xsl:for-each>
                                            </
    xsl:otherwise>
                                          </
    xsl:choose
    I could not see how to get it to work.

    Anyone got any ideas? Thanks a lot in advance.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  2. #2
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    Quote Originally Posted by e-tradecounter View Post
    At the moment on our home page we show all the categories with subcategories listed.

    However we only want to show the first 5 subcategories for each parent category.

    C#/VB.NET Code:
     <xsl:choose>
                                            <
    xsl:when test="count(/root/EntityHelpers/*[$scName]/descendant::Entity[ParentEntityID=$subCategoryId]) = 0">
                                              <
    a href="{aspdnsf:EntityLink(EntityID, SEName, 'c', 0, '')}">List All Products</a>
                                            </
    xsl:when>
                                            <
    xsl:otherwise>
                                              <
    xsl:for-each select="/root/EntityHelpers/*[$scName]/descendant::Entity[ParentEntityID=$subCategoryId]">
                                                <
    a href="{aspdnsf:EntityLink(EntityID, SEName, 'c', 0, '')}">
                                                  <
    xsl:value-of select="Name" disable-output-escaping="yes" />
                                                </
    a>
                                                <
    br />
                                              </
    xsl:for-each>
                                            </
    xsl:otherwise>
                                          </
    xsl:choose
    I could not see how to get it to work.

    Anyone got any ideas? Thanks a lot in advance.
    I haven't tried it, but something like this should work :-
    C#/VB.NET Code:
    <xsl:for-each select="/root/EntityHelpers/*[$scName]/descendant::Entity[ParentEntityID=$subCategoryId][position() &lt; 6]"

    TTFN

    BFG

  3. #3
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    Thanks BFG
    Worked like a charm.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  4. #4
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    for some reason it doesn't pull the categories in the correct order.
    We have set the order we want the categories in however they are not displayed in that order.

    they are not even displayed in order of category id. Is there anyway we can force the categories to display in a set order?

    Ideally we want to set our poplar categories our self by numbering them 1-5 respectably and all others we would number as say 9.

    C#/VB.NET Code:
    <xsl:for-each select="/root/EntityHelpers/*[$scName]/descendant::Entity[ParentEntityID=$subCategoryId][position() &lt; 5]"
    could we change this so we know it will pull all with an order number say under 6? and then display them in the correct order.

    Many thanks in advance!
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  5. #5
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    Not to worry we got it all fixed. Turns out it was to do with the cashe.

    Thanks again BFG.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience