My CartV2 can’t send confirmation email. In the log file I reactive the following stack trace:
Logging 'Stack Trace':
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at Dynamicweb.LogToFile.Log(String message, String folder, LogType newLogFile, Boolean useExtendedPropertyLogging, LogElements logElements)
at Dynamicweb.Ecom7.Cart.Frontend.LogError(Order order, String message, Object[] params)
at Dynamicweb.Ecom7.Cart.Frontend.CheckoutDone(Order order)
at Dynamicweb.Ecom7.Cart.CheckoutHandler.CheckoutDone(Order order)
at Dynamicweb.Ecom7.Cart.DefaultCheckoutHandler.StartCheckout(Order order)
at Dynamicweb.Ecom7.Cart.Frontend.RenderCheckoutStep(Order order)
at Dynamicweb.Ecom7.Cart.Frontend.GetContent()
at Dynamicweb.Frontend.Content.getModule(DataRow& ParagraphRow)
at Dynamicweb.Frontend.Content.WriteParagraph(ParagraphTemplateJoinClass PTRecord)
at Dynamicweb.Frontend.Content.CreateContent(ParagraphTemplateJoinClass PTRecord)
at Dynamicweb.Frontend.Content.CreateParagraph(StringBuilder strContent, ParagraphTemplateJoinClass PTRecord, Int32& TemplateParagraphsWriten, Int32& TemplateParagraphsNotWriten, Int32& TemplateParagraphsColumn, String& SpaceBeforeParagraph, Template& paragraphSetupTemplate, Properties& ModuleSettings)
at Dynamicweb.Frontend.Content.CreateContentEXE()
at Dynamicweb.Frontend.Content.CreateContent(Int32 PageID)
at Dynamicweb.Frontend.Content.getContent(Int32 PageID)
at Dynamicweb.Frontend.PageView.SetPageTemplateValues()
at Dynamicweb.Frontend.PageView.Output()
at Dynamicweb.Frontend.PageviewControl.ParseControls()
at CITCustomModules.Default.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.default_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\7319c309\59d1e155\App_Web_yu6kwqs8.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
at System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
But when debugging through the dynamicweb.dll I get an exception with the following stacktrace:
at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderLineTemplateExtenders(Order Order, OrderLine OrderLine, Template Template, TemplateExtenderRenderingState RenderingState)
at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderLine(OrderLine OrderLine, Template Template)
at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderLines(OrderLineCollection OrderLines, Template ParentTemplate, String LoopName)
at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderDetails(Template template, Order order, Boolean extendedProperties)
at Dynamicweb.Ecom7.Cart.Frontend.SendMails(Order order, ModuleSettings settings)
at Dynamicweb.Ecom7.Cart.Frontend.CheckoutDone(Order order)
The line generating the exception I marked with red
while (enumerator2.MoveNext())
{
System.Type addInType = (System.Type) enumerator2.get_Current();
OrderLineTemplateExtender extender = (OrderLineTemplateExtender) AddInManager.CreateAddInInstance(addInType);
extender.Order = Order;
extender.OrderLine = OrderLine;
extender.User = this.PageView.User;
extender.ExtendTemplate(Template, RenderingState);
}
This.PageView is null, because the PageView isn’t passed to the Renderer class from the SendMails method.
enumerator3 = source.Distinct<MailAddress>().GetEnumerator();
while (enumerator3.MoveNext())
{
MailAddress address = enumerator3.Current;
MailMessage mailObj = new MailMessage();
mailObj.set_IsBodyHtml(true);
mailObj.set_Subject(current.Subject);
mailObj.set_From(new MailAddress(current.SenderMail, current.SenderName));
mailObj.To.Add(address);
mailObj.set_BodyEncoding(System.Text.Encoding.GetEncoding(current.EncodingCodePage));
Dynamicweb.Templatev2.Template template = new Dynamicweb.Templatev2.Template(current.Template);
template.SetTag("Ecom:Order.ReceiptURL", CartUrl(order));
new Dynamicweb.eCommerce.Frontend.Renderer().RenderOrderDetails(template, order, true);
mailObj.set_Body(template.Output());
EmailHandler.Send(mailObj);
}
Is this a bug or am I doing something wrong?