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
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
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;
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 :
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.
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 :
You're missing a couple of usings.
Fire up the Visual Studio debugger to get more detailed exception messages.
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
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?
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:
If you attach the debugger and step over that line don't you get an error?
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 .
I think there is a problem in checkout config pipeline , which is not passing the basket values
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);
}
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.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.