We've received an e-mail from PayPal alerting us that our IPN page is returning a lot of 500 errors. We've investigated the various error logs and found the following error within the /var/log/nginx directory. The full directory path has been removed for obvious reasons.

PHP Fatal error:  Call to a member function save() on a non-object in app/code/core/Mage/Paypal/Model/Ipn.php on line 532"

We're running Magento Enterprise and the method which contains line 532 is located within the following function.

 * Process completed payment (either full or partial)
 * @param bool $skipFraudDetection
protected function _registerPaymentCapture($skipFraudDetection = false)
    if ($this->getRequestData('transaction_entity') == 'auth') {
    $parentTransactionId = $this->getRequestData('parent_txn_id');
    $payment = $this->_order->getPayment();
        ->setShouldCloseParentTransaction('Completed' === $this->getRequestData('auth_status'))
            $skipFraudDetection && $parentTransactionId

    // notify customer
    $invoice = $payment->getCreatedInvoice();
    if ($invoice && !$this->_order->getEmailSent()) {
            Mage::helper('paypal')->__('Notified customer about invoice #%s.', $invoice->getIncrementId())

Line 532 is the save() method called on the $this->_order->sendNewOrderEmail().... towards the bottom of the function. As testing the IPN is ridiculously hard from a local environment I was wondering if anyone had come across this error before? or if they can point me in the right direction of the issue.

  • 1
    sendNewOrdrEmail() is normally overwritten by third party extensions sending transactional emails. Maybe that is your issue there if you have another integration to handle emails. – mbalparda Jan 2 '15 at 13:03
  • I would agree with mbalparda, being that Ebay owns Paypal and Magento best bet is on a 3rd party module. Try disabling community and local code pools to see if the same persists. – B00MER Jan 4 '15 at 8:42
  • @mbalparda thanks for the advice! I never through of that. – Dave Jan 5 '15 at 9:00
  • 1
    If this worked let me know so I can add it as an answer. – mbalparda Jan 5 '15 at 10:51

Since the error appears in the ->save line, it means that setIsCustomerNotified(true) does not return $this (the current object).
The only occurence of setIsCustomerNotified I found is in the class Mage_Sales_Model_Order_Status_History that returns return $this->setData('is_customer_notified', $flag);.

This setData method should return the current object.
So something must be overwritten in you instance by a custom module.
Either the setIsCustomerNotified method or the setData method of the Mage_Sales_Model_Order_Status_History class.

Here is a simple script that can help you find the overrides in your instance. Look in the output for something related to Order or History.

  • Thanks for the detailed response, I shall investigate and report back. Also thanks for linking the script. – Dave Jan 6 '15 at 12:21
  • 1
    We found that Xtento_AdvancedOrderStatus_Model_Sales_Order_Status_History was overriding the Mage_Sales_Model_Order_Status_History class and within this there was an override for the method setIsCustomerNotified which was missing a return in front of parent::setIsCustomerNotified($flag) which would obviously cause this error. Now I'm going to have to start checking all my 3rd party modules and verify the developers have common sense. Thanks! – Dave Jan 6 '15 at 17:37

You issue might be in the sendNewOrderEmail() method. This is usually overwritten by third party extensions handling transactional emails. Check if you have any extension doing that and see if you can disable them for testing.

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.