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.

  • Mr A 216 posts 278 karma points
    Jun 01, 2012 @ 13:42
    Mr A
    0

    Razor Error when trying to use razor script for confirmation email

    Hi , 

    I have used a razor script to send a confirmation email , but my confirmation comes up with the error :Error Loading razor script.

    The script i have used is :

     

    @using UCommerce.Runtime
    @{
       var purchaseOrder = SiteContext.Current.OrderContext.GetBasket().PurchaseOrder;
        var address = purchaseOrder.GetBillingAddress();
       var guid = purchaseOrder.OrderGuid;
        var total = purchaseOrder.OrderTotal;
        var city = purchaseOrder.SubTotal;
        var email = purchaseOrder.BillingAddress.EmailAddress;
       var address1 = purchaseOrder.OrderAddresses;
        
    }
    Any ideas where i am getting it wrong i also tried the following script without any success:
    I have tried all other methods within my capability, any assistance or suggestions will be highly appreciated
    thanks
    @using UCommerce.Runtime
     
    <table>
        <th>SKU</th><th>Name</th><th>Qty</th><th>Unit Price</th><th>Total</th>
        @foreach (var orderLine in SiteContext.Current.OrderContext.GetBasket().PurchaseOrder.OrderLines) 
        {
            <tr>
                <td>@orderLine.ProductName</td>
                <td>@orderLine.Quantity</td>
                <td>@orderLine.Price</td>
                <td>@orderLine.Total</td>
            </tr>
        }
    </table>

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 01, 2012 @ 14:50
    Søren Spelling Lund
    0

    You're missing a couple of usings.

    Fire up the Visual Studio debugger to get more detailed exception messages.

  • Mr A 216 posts 278 karma points
    Jun 01, 2012 @ 14:52
    Mr A
    0

    which ones , i am getting all the intellisense using just ucommerce.runtime, have added @using UCommerce.EntitiesV2 , still no difference , and i am not getting any error messages in the debugger

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 01, 2012 @ 14:56
    Søren Spelling Lund
    0

    I'm finding it difficult to figure out how the two scripts you posted related to each other. Are they both in the templete or is it just the last one?

  • Mr A 216 posts 278 karma points
    Jun 01, 2012 @ 14:58
    Mr A
    0

    I mean , i tried both one by one on the email template, but both comes up with the error , Also i have i have noticed, the error comes on the first line:

     var purchaseOrder =SiteContext.Current.OrderContext.GetBasket().PurchaseOrder;
  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 01, 2012 @ 15:06
    Søren Spelling Lund
    0

    If you attach the debugger and step over that line don't you get an error?

  • Mr A 216 posts 278 karma points
    Jun 01, 2012 @ 15:15
    Mr A
    0

    I am running the site live, cant use debugger , is it the issue with SiteContext.Current , the template is not able to get the basket , as i am using paypal and the email is send using the cehckout pipeline once the payment is done successfully. I have no knowledge of XSLT , but i also try to write an email XSLT and manage to get the guid of the order , but cant get any other values like email , below is the template :

     


    xsl:stylesheet [
      
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:uTube.XSLT="urn:uTube.XSLT" xmlns:CommerceLibrary="urn:CommerceLibrary"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets uTube.XSLT CommerceLibrary ">


      <xsl:output method="xml" omit-xml-declaration="yes"/>

      <xsl:param name="currentPage"/>
      <xsl:variable name="orderGuid" select="umbraco.library:RequestQueryString('orderNumber')"/>
      <xsl:variable name="Basket" select="CommerceLibrary:GetBasket()/purchaseOrder/@orderGuid"/>
      <xsl:variable name="cart" select="CommerceLibrary:GetPurchaseOrder($orderGuid)"/>
      <xsl:variable name="email" select="$cart/@emailAddress"/>
      <xsl:variable name="email1" select="$Basket/@emailAddress"/>

      <xsl:template match="/">

        

       

        <table>
          <tr>
            <td>

              <xsl:value-of select="$orderGuid"/>
            td>
            <td>

              
              <xsl:value-of select"$email1" />
            td>
          tr>
         

           
          
          
        table>
        
        
        

      xsl:template>


     
      
    xsl:stylesheet>

     

    Thanks for your assistance so far , any ideas of how to sort out the email issue .

  • Mr A 216 posts 278 karma points
    Jun 01, 2012 @ 18:04
    Mr A
    0

    I think there is a problem in checkout config pipeline , which is not passing the basket values

  • Mr A 216 posts 278 karma points
    Jun 01, 2012 @ 18:50
    Mr A
    0

    The checkout config is sending an email but without purchase order :

    public class SendEmailTask : IPipelineTask<PurchaseOrder>

    {

        public string EmailTypeName;

        public SendEmailTask(string emailTypeName);

        public PipelineExecutionResult Execute(PurchaseOrder purchaseOrder);

    }

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 18, 2012 @ 12:31
    Søren Spelling Lund
    0

    Once the checkout pipeline runs the SiteContext.OrderContext.GetBasket() is reset ready to start a new basket.

    You'll want to use the querystring parameter orderGuid or orderNumber and load an order by CommerceLibrary:GetPurchaseOrder using that order number or guid. 

Please Sign in or register to post replies

Write your reply to:

Draft