We have a problem when trying to send order confirmation email in Litium 7 Accelerator Mvc. We get a NullReferenceException in MailServiceImpl.cs on row 81
var page = pageMail.Page;
var pageUrl = _urlService.GetUrl(page, new PageUrlArgs(pageMail.ChannelSystemId) { AbsoluteUrl = true });
because this method in OrderConfirmationEmail.cs returns null
public override Page Page
{
get
{
if (_page == null)
{
IoC.Resolve<PageByFieldTemplateCache<OrderConfirmationPageByFieldTemplateCache>>().TryFindPage(orderConfirmation =>
{
_page = orderConfirmation;
return true;
});
}
return _page;
}
}
It seems page is not found in cache. Any ideas why? The order confirmation page is published and active on the channel.
Ok, but I still don’t understand how to solve it, I can’t change channel id in code. I dont have a problem in
public override string GetOrderConfirmationPageUrl(OrderCarrier orderCarrier)
{
var website = _websiteService.Get(orderCarrier.WebSiteID);
var pointerPage = website.Fields.GetValue<PointerPageItem>(AcceleratorWebsiteFieldNameConstants.OrderConfirmationPage);
return _urlService.GetUrl(_pageService.Get(pointerPage.EntitySystemId), new PageUrlArgs(pointerPage.ChannelSystemId));
}
Yes.
Visitors has read access to order confirmation page.
Page is published and active on swedish channel.
We also get redirected to order confirmation page after purchase.
The class OrderConfirmationPageByFieldTemplateCache is part of accelerator so that can be modified with your needs, after a quick check my feeling is that the cache only is working for web-requests, not background execution like sending mail.