0

Magento 1.9.3.2

I am trying to save the order PDF right after an order is placed / saved. The event I am using is sales_order_place_after. This is working fine, except for the payment information. That is not printed on the PDF whenever an external payment was made using PayPal+ or eBay.

This is the Observer.php code:

$pdf = Mage::getModel('emailattachments/order_pdf_order')->getPdf(array($order));
$pdf->render();
$pdf->save("my.pdf");

I guess the payment data is not available at this point in the event chain? Is there another event maybe that I can use? I checked, it does not seem so.

Thanks!

1

We are using the event sales_order_invoice_pay to generate a order PDF. See also this question on that event. When that event is dispatched payment information should be available.

2
  • This is not always fired when the order is placed I guess, or is it? I need to create the PDF in the order creation process, no matter if it comes from eBay or the Magento shop. Would that work with that event? – Arnie Dec 2 '19 at 12:30
  • Not immediately I think. It is fired when the payment is complete i.e. when the order transitions from "Pending Payment" to "Complete". Depending on the payment method (e.g. PayPal) this could take some time. – nebulon42 Dec 2 '19 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.