No emails send - Combination Interamind Email Manager

Please post your issues and questions about One Page Checkout for Virtuemart 2 to this forum.

No emails send - Combination Interamind Email Manager

Postby info@.....nl » Sun Nov 18, 2012 11:57 am

Hello,

I use VM 2.0.14 in joomla 2.5.7 and I have installed OPC and Interamind Email Manager.
After installing OPC, no more mails were send to clients and admin.
I asked a question about this in the interamind Support System and they came with this answer.
Could you please help me out here.

Answer from interamind:/b]

Hi stijn,

VM sends the emails from the function renderMail() in the file /components/com_virtuemart/helpers/shopfunctionsf.php. VMEM Pro installation modifies this file to redirect emails to VMEM Pro, and send them from there.

One page checkout somehow overrides this file and the default process for sending emails in VM, so this function is not being called. In previous versions of One page checkout, you could turn off this override but in the new version, as far as I know, it is not possible.

You can:
1. uninstall One Page Checkout
2. Contact OPC developer for instructions how to have VM sending emails again.


[b]What can I do to make emails being send again. I need a solution fast and uninstalling OPC is not an option.
info@.....nl
 
Posts: 3
Joined: Sun Nov 18, 2012 11:53 am

Re: No emails send - Combination Interamind Email Manager

Postby admin » Thu Nov 22, 2012 1:49 pm

Hello, OPC and VMEE works without any known issues. The VMEE sends emails by the function mentioned above and please make sure that if you updated your VM, you also updated the VMEE code in the function.

You have to set up proper filters for the emails, such as order statuses, shopper groups and similar so they are triggered. Keep in mind, that OPC uses both -anonymous- and -default- shopper groups and this can be altered in the OPC backend configuration.

This is how your renderMail function should look like in /components/com_virtuemart/helpers/shopfunctionsf.php
Code: Select all
/**
    * Prepares a view for rendering email, then renders and sends
    *
    * @param object $controller
    * @param string $viewName View which will render the email
    * @param string $recipient shopper@whatever.com
    * @param array $vars variables to assign to the view
    */
   //TODO this is quirk, why it is using here $noVendorMail, but everywhere else it is using $doVendor => this make logic trouble
   static public function renderMail ($viewName, $recipient, $vars=array(),$controllerName = NULL,$noVendorMail = FALSE) {
      if(!class_exists('VirtueMartControllerVirtuemart')) require(JPATH_VM_SITE.DS.'controllers'.DS.'virtuemart.php');
//       $format = (VmConfig::get('order_html_email',1)) ? 'html' : 'raw';

      $lang     = JFactory::getLanguage();
      $tag = $lang->getTag();
      $filename = 'com_virtuemart';
      $lang->load($filename, JPATH_ADMINISTRATOR, $tag, true);
      $lang->load($filename, JPATH_SITE, $tag, true);

      $controller = new VirtueMartControllerVirtuemart();
      //Todo, do we need that? refering to http://forum.virtuemart.net/index.php?topic=96318.msg317277#msg317277
      $controller->addViewPath(JPATH_VM_SITE.DS.'views');

      $view = $controller->getView($viewName, 'html');
      if (!$controllerName) $controllerName = $viewName;
      $controllerClassName = 'VirtueMartController'.ucfirst ($controllerName) ;
      if (!class_exists($controllerClassName)) require(JPATH_VM_SITE.DS.'controllers'.DS.$controllerName.'.php');

      //Todo, do we need that? refering to http://forum.virtuemart.net/index.php?topic=96318.msg317277#msg317277
      $view->addTemplatePath(JPATH_VM_SITE.'/views/'.$viewName.'/tmpl');

      $vmtemplate = VmConfig::get('vmtemplate','default');
      if($vmtemplate=='default'){
         if(JVM_VERSION == 2){
            $q = 'SELECT `template` FROM `#__template_styles` WHERE `client_id`="0" AND `home`="1"';
         } else {
            $q = 'SELECT `template` FROM `#__templates_menu` WHERE `client_id`="0" AND `menuid`="0"';
         }
         $db = JFactory::getDbo();
         $db->setQuery($q);
         $template = $db->loadResult();
      } else {
         $template = $vmtemplate;
      }

      if($template){
         $view->addTemplatePath(JPATH_ROOT.DS.'templates'.DS.$template.DS.'html'.DS.'com_virtuemart'.DS.$viewName);
      } else {
         if(isset($db)){
            $err = $db->getErrorMsg() ;
         } else {
            $err = 'The selected vmtemplate is not existing';
         }
         if($err) vmError('renderMail get Template failed: '.$err);
      }

      foreach ($vars as $key => $val) {
         $view->$key = $val;
      }
//VMEEPRO START
      $user = true;
      $vmempro_args = array();
      $vmempro_trigger = array();
      switch ($viewName){
         //order confirmation, order change status, order download ID
         case 'invoice':
            $vmempro_args['order_id'] = $vars['orderDetails']['details']['BT']->virtuemart_order_id;
            if(   isset($vars['newOrderData']['order_status']) &&
                  isset($vars['newOrderData']['current_order_status']) &&
                  count( $vars['orderDetails']['history']) > 2){
               //indication that this is status changed
               $vmempro_trigger[] = array('trigger'=>'TRIGGER_ORDER_STATUS_CHANGED','type'=>'user');
               if (isset($view->doVendor) && !$noVendorMail) {
                  $vmempro_trigger[] = array('trigger'=>'TRIGGER_ADMIN_ORDER_STATUS_CHANGED','type'=>'admin');
               }
            }
            else{
               //new order
               $vmempro_trigger[] = array('trigger'=>'TRIGGER_ORDER_CONFIRMATION','type'=>'user');
               if (isset($view->doVendor) && !$noVendorMail) {
                  $vmempro_trigger[] = array('trigger'=>'TRIGGER_ADMIN_ORDER_CONFIRMATION','type'=>'admin');
               }
            }
            break;
            //user registration
         case 'user':
            $vmempro_args['user_name'] = $vars['user']->username;
            $vmempro_args['password'] =  $vars['password'];
            $vmempro_trigger[] = array('trigger'=>'TRIGGER_USER_REGISTRATION','type'=>'user');
            if (isset($view->doVendor) && !$noVendorMail) {
               $vmempro_trigger[] = array('trigger'=>'TRIGGER_ADMIN_USER_REGISTRATION','type'=>'admin');
            }
            break;
         //notify customer that product is back in stock
         case 'waitinglist':
            $urlPArams = parse_url($vars['url'],URL_QUERY);
            parse_str($urlPArams);
            $vmempro_args['product_id'] = $virtuemart_product_id;
            $vmempro_args['user_id'] = $vars['user']->id;
            $vmempro_trigger[] = array('trigger'=>'TRIGGER_WAITING_LIST','type'=>'user');
            if (isset($view->doVendor) && !$noVendorMail) {
               $vmempro_trigger[] = array('trigger'=>'TRIGGER_ADMIN_WAITING_LIST','type'=>'admin');
            }
            break;
         //ask question about product
         case 'vendor':
            break;
         // ask question email
         case 'askquestion':
            break;
            //recommend product to a friend
         case 'recommend':
            /*$vmempro_args['product_id'] = $vars['product']->virtuemart_product_id;
            $vmempro_args['user_name'] = $vars['user']['name'];
            $vmempro_args['user_email'] = $vars['user']['email'];
            $vmempro_args['to_mail'] = $recipient;
            $vmempro_args['message'] =  JRequest::getVar('comment',  '');
            $vmempro_trigger[] = array('trigger'=>'TRIGGER_RECOMMEND','type'=>'user');*/
            break;
         default:
            break;
      }

      if(!empty($vmempro_trigger)){
         JPluginHelper::importPlugin('vmeepro');
         $dispatcher =& JDispatcher::getInstance();
         foreach ($vmempro_trigger as $trigger){
            $res = $dispatcher->trigger('OnSendMail',  array($trigger['trigger'],$vmempro_args));
            if($res[0] === false){
               if ($trigger['type'] == 'admin') {
                  self::sendVmMail($view, $view->vendorEmail, true);
               }
               else{
                  $user= self::sendVmMail($view, $recipient,$noVendorMail);
               }
            }
         }
      }
      else{
         $user= self::sendVmMail($view, $recipient,$noVendorMail);
         if (isset($view->doVendor) && !$noVendorMail) {
            self::sendVmMail($view, $view->vendorEmail, true);
         }
      }
   //VMEEPRO END   
      /*
      $user= self::sendVmMail($view, $recipient,$noVendorMail);
      if (isset($view->doVendor) && !$noVendorMail) {
         self::sendVmMail($view, $view->vendorEmail, TRUE);
      }
      */
      
      $lang     = JFactory::getLanguage();
      $tag = $lang->getTag();
      $filename = 'com_virtuemart';
      $lang->load($filename, JPATH_ADMINISTRATOR, $tag, true);
      $lang->load($filename, JPATH_SITE, $tag, true);

      
      return $user ;

   }



If this is set up correctly, the OPC does not alter this function no way. The code above fixes a VMEE bug which changes language to english when you are using any other language in your joomla front end.

Best Regards,
Stan
admin
Site Admin
 
Posts: 2624
Joined: Wed Jan 06, 2010 11:43 pm

Re: No emails send - Combination Interamind Email Manager

Postby petrigabor » Sat Apr 01, 2017 11:50 pm

Hello,

I use VM Email Manager for different purposes in our webshop and it worked with OPC without any problem – until now. Do you know about any issues that change the email rendering function? I was told that the sending email issues may be caused by two things: either the conflicting changes in OPC functions, or the changes made in the shopfunctionsf.php file in newest version of Virtuemart (3.2.1). I don't know what causes the problem. Unfortunately, I cannot appeal Interamind support because the development of VM Email Manager was discontinued, and the company ceased any support for the product.
I don't really know what to do to have the emails be sent again, but I need help and I need both components: uninstalling OPC is not an option as well as VM Email Manager is an absolute 'must have' and I can't afford just to get rid of it.
Could you help with the above mentioned shopfunctionsf.php file even if the problem is not with OPC but it is in the shopfunctions of the new VM version?

Thank you.

Best regards,
Gábor
petrigabor
 
Posts: 1
Joined: Sat Apr 01, 2017 11:02 pm

Re: No emails send - Combination Interamind Email Manager

Postby admin » Thu Apr 06, 2017 12:31 pm

hello gabor, this part of the forum is for VM2 where VMEE and OPC works without problem.

on VM3.0.18+ the VMEE needs lot's of modifications:
- it needs the shopfunctionsf modified
- it needs futher modification as described here:
viewtopic.php?f=7&t=1421

there may be further modifications needed and i am not sure if we could release an updated installer of VMEE due to it's licensing...

best regards, stan
admin
Site Admin
 
Posts: 2624
Joined: Wed Jan 06, 2010 11:43 pm


Return to One Page Checkout for Virtuemart 2

cron