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.

  • Lasse Kofoed 49 posts 177 karma points
    Jan 20, 2012 @ 16:36
    Lasse Kofoed
    0

    Custom orderfields values read/write

    Hi, 

    I am rookie, when it comes to xslt, so need a little help here.
    I want to add extra fields to the order object. And found this article,http://www.publicvoid.dk/default,date,2011-08-10.aspx. now the question is.

    <xsl:variable name="EAN" select="CommerceLibrary:SetOrderProperty('EAN','')"/>
    <label>EAN Nummer</label>
    <input type="text" name="EANInput">
        <xsl:attribute name="value">
            <xsl:value-of select="$EAN" />
        </xsl:attribute>
    </input>

    The field EAN is added to the order, when completed, but has no value ?

    If i put in 

    <xsl:variable name="EAN" select="CommerceLibrary:SetOrderProperty('EAN','TEST')"/>

    the value TEST is shown.

    Have tried different combination of a new variables, but they seam to return FAIL or SUCCESSES, thinking this is if the variable is created to the order.
    What am i doing wrong ?

    Second when the value is added to the order, how to i read the value doing the basket flow, in a different step ?

    Like in my summery page

     <xsl:param name="currentPage"/>
     <xsl:variable name="basket" select="CommerceLibrary:GetBasket()"></xsl:variable>
     <xsl:variable name="billingAddress" select="$basket/billingAddress/address" />
     <xsl:variable name="shipmentAddress" select="$basket/shipments/shipment/address" />
    
    <xsl:value-of select="$basket/@EAN"/> // NOT WORKING
    
    

    Is there a way to output all varibles in eg. $basket or $billingAddress and so on ? just for testing and knowing what elements are available in context.

    Best regards
    Lasse Kofoed

  • Christopher W. Brandsdal 72 posts 133 karma points
    Feb 23, 2012 @ 12:16
    Christopher W. Brandsdal
    0

    Anyone on this? I have the same challange.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Mar 05, 2012 @ 10:07
    Søren Spelling Lund
    0

    You'll want to set the value of the dynamic order property immediately when you call CommerceLibrary:SetOrderProperty. The return value of SetOrderProperty is not the value, but rather the result of the adding it, i.e. OK or not OK.

    Order properties are added to the orderProperties element on the order:

    <purchaseOrder>
    <orderProperties>
    <orderProperty key="myProp" value="myVal" />
    </orderProperties>
    </purchaseOrder>

    You can grab the value of a specific dynamic order property using:

    <xsl:variable name="basket" select="CommerceLibrary:GetBasket()"/>
    <xsl:variable name="myVar" select="$basket/purchaseOrder/orderProperties/orderProperty[@key = 'myProp']/@value"/>

    To make it easier you can output the entire order XML structure and take a look at it using

    <textarea>
      <xsl:copy-of select="$basket"/>
    </textarea>
Please Sign in or register to post replies

Write your reply to:

Draft