Inhalte aufrufen

Profilbild

Why is my order confirmation PDF failing?


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
6 Antworten zu diesem Thema

#1 altmoola

altmoola

    Advanced Member

  • Members
  • 53 Beiträge

Geschrieben: 16 October 2020 - 14:57

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



#2 altmoola

altmoola

    Advanced Member

  • Members
  • 53 Beiträge

Geschrieben: 16 October 2020 - 15:09

I believe it only fails if you checkout as a guest. How do I resolve this?



#3 altmoola

altmoola

    Advanced Member

  • Members
  • 53 Beiträge

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 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3577 Beiträge

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.


Schöne Grüße aus Düsseldorf,
Marcus Gesing


#5 altmoola

altmoola

    Advanced Member

  • Members
  • 53 Beiträge

Geschrieben: 16 October 2020 - 16:18

That makes sense I suppose. Do you have a link to the github fix?



#6 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3577 Beiträge

Geschrieben: 16 October 2020 - 16:59

Here it is.


Schöne Grüße aus Düsseldorf,
Marcus Gesing


#7 altmoola

altmoola

    Advanced Member

  • Members
  • 53 Beiträge

Geschrieben: 16 October 2020 - 19:05

Great, works now. Thanks.