We have a section of our confirmation email that shows which student (recipient) is registered for each class. For some reason it is returning the same student for every class registered in the order. So, if siblings are registered in the same order it is showing that it all belongs to one of them. The recipient is correct in the order, just an issue of the confirmation email showing the wrong name. I must have missed testing this scenario when we were implementing this.
Any of you able to spot what might be causing the problem? I've highlighted the bit that is displaying the wrong name.
Thanks for any help you can offer!
@if(hasProducts)
{ var perfs = (Model.OrderProductView.Products).Where(x => x.ProductClass.Description == "Performance");
if (perfs != null && perfs.Count() > 0) { <h2>Drama School Registration:</h2> foreach (var product in perfs) { var performance = product.Performance.LineItem.Performance; var urlInventory = "TXN/Performances/" + performance.Id; var inventoryObject = Model.RestClient.AtUrl(urlInventory).Get<Performance>().ResponseObject;
if(!performance.Description.Contains("T-Shirt") && !performance.Description.Contains("Hoodie")) { <b> @recipient has been registered for: </b> <br> @inventoryObject.Text1 <br> @inventoryObject.Text2 <br> @inventoryObject.Text3 <br> @inventoryObject.Text4 <br><br> } } } }
Hey.
Have you got the bit of the template where it first sets @recipient?
I suspect it needs updating on each iteration of the foreach loop you've included above.
I think Alex is right. You have for each loop for perf but no for each loop for recipient within that.
Assuming recipient = student
Also, the loop seems to be on performances rather than individual tickets/SLIs, which is where recipient is assigned.