cancel
Showing results for 
Search instead for 
Did you mean: 

Fatal error: Call to a member function setEntityId() on a non-object in Order.php

Fatal error: Call to a member function setEntityId() on a non-object in Order.php

I have the most bizzare issue that I cannot figure out...

 

Almost all emails send from the system from the Admin panel within an Order. Except the initial invoice is not sent and a fatal error occurs at the final step of checkout.

 

I am using paypal to capture the funds.

 

Process is like this:

User selects products > clicks checkout > redirected to paypal for payment and shipping info > redirected to my site from paypal for final acceptance > user selects "Process order" button

 

One the user selects the process button, the order is fully processed, the invoice email is sent to the user with a BCC to me and payment is made. However the user is greeted with a blank screen and the following error :

 

Fatal error: Call to a member function setEntityId() on a non-object in app/code/core/Mage/Sales/Model/Order.php Line 1355 or 1455

 

I get this same error ONLY when trying to add notes to an order and have the customer notified.

 

The code from the Order.php file that is erroring is here:

 

// Set all required params and send emails
        $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
        $mailer->setStoreId($storeId);
        $mailer->setTemplateId($templateId);
        $mailer->setTemplateParams(array(
            'order'        => $this,
            'billing'      => $this->getBillingAddress(),
            'payment_html' => $paymentBlockHtml
        ));

        /** @var $emailQueue Mage_Core_Model_Email_Queue */
        $emailQueue = Mage::getModel('core/email_queue');
        $emailQueue->setEntityId($this->getId())
            ->setEntityType(self::ENTITY)
            ->setEventType(self::EMAIL_EVENT_NAME_NEW_ORDER)
            ->setIsForceCheck(!$forceMode);

        $mailer->setQueue($emailQueue)->send();

        $this->setEmailSent(true);
        $this->_getResource()->saveAttribute($this, 'email_sent');

        return $this;
    }

 

 

So far, everything else including all other emails work fine.

3 REPLIES

Re: Fatal error: Call to a member function setEntityId() on a non-object in Order.php

Anyone have any ideas?

Re: Fatal error: Call to a member function setEntityId() on a non-object in Order.php

Is that error resolved. I am facing same issue. Interestingly very few people facing same problem but there is no resolution.

 

Thanks.

Re: Fatal error: Call to a member function setEntityId() on a non-object in Order.php

Hi, did you happen to get this resolved? I'm having the same problem and cant find much information about it.