Copied to clipboard

Flag this post as spam?

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


  • Sean Dooley 289 posts 528 karma points
    Oct 12, 2011 @ 17:33
    Sean Dooley
    0

    Custom Products implementation

    Looking at implementing a shop with multiple types of products with their own properties.

    Would this require myself to write my own scripts to output the product information? i.e. productList.xslt and product.xslt

  • Sean Dooley 289 posts 528 karma points
    Oct 12, 2011 @ 17:34
    Sean Dooley
    0

    Currently have a document type setup as follows

    Product
    > Drink
    > Food
    > Clothes 

  • Rune Grønkjær 1372 posts 3103 karma points
    Oct 12, 2011 @ 17:52
    Rune Grønkjær
    0

    Hi Sean,

    I have done that, on one of the shops I'm currently setting up. It really depends on the design you are going to implement

    I created a Document Type for each specific type of product and in my case the changes in design could be done in the same xslt for all products. I would check the "name()" of the product and write different information depending on what type I was dealing with.

    If your design is very different between each product type you might need a different xslt per product. That would'nt be very difficult, just a lot of work :)

    /Rune 

  • Sean Dooley 289 posts 528 karma points
    Oct 12, 2011 @ 17:57
    Sean Dooley
    0

    As a quick example, could I edit productList.xslt and producct.xslt as follows

    === productList.xslt ===

    <xsl:template match="/">
    <div id="products" class="productList">
    <xsl:apply-templates select="$currentPage/Product" />
    <xsl:apply-templates select="$currentPage/Wine" />
    </div>
    </xsl:template>

    === product.xslt ===

    <xsl:template match="/">
    <xsl:apply-templates select="$currentPage [name() = 'Product']" />
    <xsl:apply-templates select="$currentPage [name() = 'Wine']" /> 
    </xsl:template>

  • Rune Grønkjær 1372 posts 3103 karma points
    Oct 13, 2011 @ 08:07
    Rune Grønkjær
    1

    Hi Sean,

    Yes, you could do something like that, but i believe et would be easier eand prettier to do it like this in the product.xslt:

    === product.xslt ===

    <xsl:template match="/">
    <xsl:apply-templates select="$currentPage" />
    </xsl:template>

    <xsl:template match="Product">
    <!-- Your code -->
    </xsl:template>

    <xsl:template match="Wine">
    <!-- Your code -->
    </xsl:template>

Please Sign in or register to post replies

Write your reply to:

Draft