【问题标题】:Fatal error: Call to a member function setMessageBody()致命错误:调用成员函数 setMessageBody()
【发布时间】:2015-05-07 04:34:32
【问题描述】:

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

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

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

请帮忙:

www.tanviherbals.com

【问题讨论】:

    标签: magento-1.9.1


    【解决方案1】:

    改一下

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

    if (false) {
    

    为订单工作,然后注册。

    【讨论】:

      【解决方案2】:

      转到 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;
                                      }
      
                          }
      

      【讨论】:

        猜你喜欢
        • 2011-08-22
        • 2012-09-29
        • 2014-02-05
        • 2014-04-29
        • 2015-09-14
        • 2014-10-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多