Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin Vingaard 39 posts 60 karma points
    Sep 12, 2011 @ 09:26
    Martin Vingaard
    0

    Product catalog seperat from page

    I've got an issue that is beyond my skills.

    At the moment i have a structure of the homepage as this.

    www.whatever.com
    -Language 01
    --Home
    --Buy
    ---ProductList
    ----Product
    --Sell

    -Language 02
    *same as above*

    -Products
    --Category
    ---Type
    ----Item
    --Category
    *same as above*

    The thing i wish to do it.

    • 1)
    • Create a macro for the Buy page that gathers all the Categories and Types from the Products subnodes (got this to work)
    • The listed Types should link to the subpage of Buy page(subnodes of the current page) adding a Querystring of the specific type clicked (carrying the nodeName).

     

    • 2)
    • On the ProductList page I want to list all the Items of the Type. Figured ill do this by displaying children of the node with the nodeName equal to the Querystring.
    • Also the listed products should link to the subpage of ProductList page(subnode of the current page)  with a Querystring of the specific item clicked (carrying the nodeName).

     

    • 3)
    • Show the item = to the querystring

     

    First off I recon my "way" of thinking and structuring this could be wrong.

    The whole purpose of this is to list the products and generate links to subnodes and further information, while keeping the navigation within the current language of the page.

     

    The code I’ve been messing with so far

    <xsl:variable name="source" select="1714"/> <!-- /macro/source -->
    <xsl:variable name="depth" select="4"/>
        
        
      <xsl:template match="/">
        <xsl:call-template name="drawNodes">  
          <xsl:with-param name="parent" select="umbraco.library:GetXmlNodeById($source)"/>  
        </xsl:call-template>
      </xsl:template>

      <xsl:template name="drawNodes">
      <xsl:param name="parent"/>

      <xsl:for-each select="$parent/* [@isDoc and @level &lt;= $depth]"
        
        <xsl:choose>
          
          <!--  when ducument type = Category -->
          <xsl:when test="self::Category">
            
            <!-- returns page -->
            <href="{umbraco.library:NiceUrl(@id)}">
              <img alt="{@nodeName}" src="{umbraco.library:GetMedia(categotyImage,0)/umbracoFile}" />
            </a>
            <xsl:if test="count(./* [@isDoc and @level &lt;= $depth]) &gt; 0">      
              <xsl:call-template name="drawNodes">    
                <xsl:with-param name="parent" select="."/>    
              </xsl:call-template>   
            </xsl:if>   
          </xsl:when>
          
            
          
    <!-- if document type = Type -->
    <xsl:when test="self::Type">
            <!-- Query link builder -->
            <xsl:for-each select="self::node()[@isDoc and child::ProductList]">
                <xsl:variable name="displayPath" select="umbraco.library:NiceUrl(@id)" />
                Xpath test <!-- want to return link to subpage + query of clicked Type -->
            </xsl:for-each>
              <xsl:value-of select="@nodeName" />
            <br />
            <!-- returns page -->
            <xsl:if test="count(./* [@isDoc and @level &lt;= $depth]) &gt; 0">  
              <xsl:call-template name="drawNodes">    
                <xsl:with-param name="parent" select="."/>    
              </xsl:call-template>   
            </xsl:if>
          </xsl:when>
            
          <!-- if choose test returns nothing -->
          <xsl:otherwise>
          </xsl:otherwise>
          
        </xsl:choose
        
      </xsl:for-each

    I hope that this gives you an idea of what my intentions and purpose of this is.

    I might attack this from a wrong angle.

    I apriciate any pointers, links, guides, corrections and flames

     

  • Martin Vingaard 39 posts 60 karma points
    Sep 12, 2011 @ 11:09
    Martin Vingaard
    0

    My question is basically.

    Am Ii approaching this from the right angle?

Please Sign in or register to post replies

Write your reply to:

Draft