System.InvalidOperationException: The content type of the e-mail attachment must be 'application/pdf'
Path: /Order/Print/489888?pdf=True
ContentType: text/html; charset=utf-8
Why is my order confirmation PDF failing?
Eröffnet von
altmoola
, Oct 16 2020 02:57
6 Antworten zu diesem Thema
#1
Geschrieben: 16 October 2020 - 14:57
#2
Geschrieben: 16 October 2020 - 15:09
I believe it only fails if you checkout as a guest. How do I resolve this?
#3
Geschrieben: 16 October 2020 - 15:24
I believe it's due to this section of code and what appears to be happening is that the customer Id is changing from order to order pdf creation so the check fails. Why would this be occurring?
private bool IsUnauthorizedOrder(Order order) { if (!Services.Permissions.Authorize(StandardPermissionProvider.ManageOrders)) return order == null || order.CustomerId != Services.WorkContext.CurrentCustomer.Id; else return order == null; }
#4
Geschrieben: 16 October 2020 - 15:39
Sounds like "Fixed InvalidOperationException in CreatePdfInvoiceAttachment when an order is placed by a guest". It has been fixed in 4.0.0.
Marcus Gesing
Smartstore AG
#5
Geschrieben: 16 October 2020 - 16:18
That makes sense I suppose. Do you have a link to the github fix?
#7
Geschrieben: 16 October 2020 - 19:05
Great, works now. Thanks.