致命错误:调用成员函数setMessageBody()

时间:2015-05-07 04:34:33

标签: magento-1.9.1

更新到最新的Magento 1.9.1后,我开始遇到多个错误:

致命错误:在第410行的/home/tanviherbals/public_html/app/code/core/Mage/Core/Model/Email/Template.php中的非对象上调用成员函数setMessageBody()

我通过联系我们表格,在线咨询表格,发送跟踪订单信息,从后端向客户发送电子邮件来发送数据时出现此错误。

请帮助:

www.tanviherbals.com

2 个答案:

答案 0 :(得分:1)

只需更改此

if ($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue) {

if (false) {

为订单工作,并注册。

答案 1 :(得分:0)

转到410行并将其放入

if(Mage::app()->getRequest()->getControllerName()=='index')
            {
                               if (($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue)) {
                                    /** @var $emailQueue Mage_Core_Model_Email_Queue */
                                    $emailQueue = $this->getQueue();
                                    $emailQueue->setMessageBody($text);
                                    $emailQueue->setMessageParameters(array(
                                            'subject'           => $subject,
                                            'return_path_email' => $returnPathEmail,
                                            'is_plain'          => $this->isPlain(),
                                            'from_email'        => $this->getSenderEmail(),
                                            'from_name'         => $this->getSenderName(),
                                            'reply_to'          => $this->getMail()->getReplyTo(),
                                            'return_to'         => $this->getMail()->getReturnPath(),
                                        ))
                                        ->addRecipients($emails, $names, Mage_Core_Model_Email_Queue::EMAIL_TYPE_TO)
                                        ->addRecipients($this->_bccEmails, array(), Mage_Core_Model_Email_Queue::EMAIL_TYPE_BCC);
                                    $emailQueue->addMessageToQueue();

                                    return true;
                                }
                    }
                    else
                    {
                                           if (!($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue)) {
                                    /** @var $emailQueue Mage_Core_Model_Email_Queue */
                                    $emailQueue = $this->getQueue();
                                    $emailQueue->setMessageBody($text);
                                    $emailQueue->setMessageParameters(array(
                                            'subject'           => $subject,
                                            'return_path_email' => $returnPathEmail,
                                            'is_plain'          => $this->isPlain(),
                                            'from_email'        => $this->getSenderEmail(),
                                            'from_name'         => $this->getSenderName(),
                                            'reply_to'          => $this->getMail()->getReplyTo(),
                                            'return_to'         => $this->getMail()->getReturnPath(),
                                        ))
                                        ->addRecipients($emails, $names, Mage_Core_Model_Email_Queue::EMAIL_TYPE_TO)
                                        ->addRecipients($this->_bccEmails, array(), Mage_Core_Model_Email_Queue::EMAIL_TYPE_BCC);
                                    $emailQueue->addMessageToQueue();

                                    return true;
                                }

                    }