News:

Looking for documentation? Take a look on our wiki

Main Menu

Error when i change the order status

Started by k2forever, March 13, 2012, 21:26:07 PM

Previous topic - Next topic

k2forever

Hello, i´m having a problem when i change the order status and i tick the option "notify shopper".

Then this error come out:

Fatal error: Call to undefined method VirtuemartViewOrders::renderMailLayout() in /XXXXXXXX/components/com_virtuemart/helpers/shopfunctionsf.php on line 210

and the email has not been send.

Can someone help me please?

Before someone probably ask, here is the shopfunctionsf.php part:


/**
    * With this function you can use a view to sent it by email.
    * Just use a task in a controller todo the rendering of the email.
    *
    * @param string $view for example user, cart
    * @param string $recipient shopper@whatever.com
    * @param bool $vendor true for notifying vendor of user action (e.g. registration)
    */
   private function sendVmMail (&$view, $recipient, $vendor=false) {
      $jlang =& JFactory::getLanguage();
      $jlang->load('com_virtuemart', JPATH_SITE, 'en-GB', true);
      $jlang->load('com_virtuemart', JPATH_SITE, $jlang->getDefault(), true);
      $jlang->load('com_virtuemart', JPATH_SITE, null, true);

      ob_start();
      $view->renderMailLayout($vendor, $recipient); <--- THIS IS THE LINE 210
      $body = ob_get_contents();
      ob_end_clean();

      $subject = (isset($view->subject)) ? $view->subject : JText::_('COM_VIRTUEMART_DEFAULT_MESSAGE_SUBJECT');
      $mailer = JFactory::getMailer();
      $mailer->addRecipient($recipient);
      $mailer->setSubject($subject);
      $mailer->isHTML(VmConfig::get('order_mail_html',true));
      $mailer->setBody($body);

      if(!$vendor){
         $replyto[0]=$view->vendorEmail;
         $replyto[1]= $view->vendor->vendor_name;
         $mailer->addReplyTo($replyto);
      }
//       if (isset($view->replyTo)) {
//          $mailer->addReplyTo($view->replyTo);
//       }

      if (isset($view->mediaToSend)) {
         foreach ((array)$view->mediaToSend as $media) {
            //Todo test and such things.
            $mailer->addAttachment($media);
         }
      }

      return $mailer->Send();
   }