Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Nauman 98 posts 118 karma points
    Nov 01, 2010 @ 12:52
    Nauman
    0

    get order items in xslt

    Hi

    I have written following xslt code to get the order / order details and items contained in order.


    <xsl:variable name="orders" select="CommerceLibrary:GetMemberOrderHistory('New order')"/>
      <xsl:if test="$customer/@nodeName!=''" >
        <xsl:for-each select="$orders/purchaseOrders/purchaseOrder">
              Order Number: </span> <xsl:value-of select="@orderNumber"/>    
           // following is written to get the line items of the current order
            <xsl:for-each select="$orders/purchaseOrders/purchaseOrder/lineItems/lineItem">     
               <xsl:value-of select="@productName"/>          
            </xsl:for-each>    
        </xsl:for-each>
      </xsl:if>

     

    But on second foreach statment <xsl:for-each select="$orders/purchaseOrders/purchaseOrder/lineItems/lineItem">, i want to get line items for current order but it gives me products for all the orders. Please guide whats woring in the code / logic.

    Nauman

  • Christian Wendler 46 posts 155 karma points
    Nov 01, 2010 @ 13:06
    Christian Wendler
    2

    You shouldn't access to $orders from inside your first for-each. The latter already points to an purchaseOrder. Just take this and iterate through its lineItems. Your second for-each should read something like this: <xsl:for-each select="lineItems/lineItem"/>

    Best regards

    Christian

  • Nauman 98 posts 118 karma points
    Nov 02, 2010 @ 07:20
    Nauman
    0

    Christian

    Thanks for the tip, but the <xsl:for-each select="$orders/purchaseOrders/purchaseOrder[$position]/lineItems/lineItem"> did the job.

    Nauman

Please Sign in or register to post replies

Write your reply to:

Draft