I have been banging my head against a brick wall for the last 2 hours.

I am editing app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.pdf.

All I am trying to achieve is a little if statement so that based on a particular payment method I can change what image is used on the invoice header.

I have tried evrything but cannot get the OrderID inside the

protected function insertLogo{}

Any advice would be great.


  • You can't access the orderId from that method, you'd need to rewrite that method and whatever calls it to pass through the order. What are you trying to achieve? There might be a better approach (copying core files to local isn't great practise either)
    – eddhall
    Jul 16, 2018 at 16:58
  • All I am just trying to switch the header image based on the payment method used.
    – Johnny
    Jul 16, 2018 at 17:31
  • I don't understand how it can be so difficult to get an orderID.
    – Johnny
    Jul 17, 2018 at 10:31
  • You could pop it in the registry when it's used in a previous function, then you'd be able to access it. The reason it's so difficult to get the order ID is because it's not required at that point in core, so there's no point in adding extra memory usage etc
    – eddhall
    Jul 18, 2018 at 8:41

1 Answer 1


Okay so I took another tact with this.

I cloned the insertLogo function and named it insertLogo2.

The first had one image and insertLogo2 contained the second.

I then added the if statement to the app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php.

I know it's not pretty but it works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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