VirtueMart Forum

VirtueMart 2 + 3 => Administration & Configuration => Topic started by: woood77 on May 08, 2012, 18:48:46 pm

Title: How To Change Who Recieves Order Notification Emails?
Post by: woood77 on May 08, 2012, 18:48:46 pm
Hello,

I pulling my hair out trying to figure out how to change where order notification emails are sent to.  Right now they come to the Super Admin account.  I want to change this to one of the Administrators on the site.  How can I do this?

Thank you for the help.
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: hkymre on May 18, 2012, 10:07:34 am
I've been having similar problems with the emails coming to me instead of the store owner.

I think I've fixed it with phpmyadmin

In the table   `jos_virtuemart_vmusers` the field virtuemart_vendor_id was set to 1 for my user (and most other users)

I've set this to 0 for all users, except for the store owner, and now when I check the shop - /index.php?option=com_virtuemart&view=user&task=editshop the email address listed under additional info is the correct one.
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: celticwebs on June 02, 2012, 20:58:25 pm
I had a similar issue which i fixed in the same way as you did, I just changed who was the vendor and it emailed them correctly. 

Problem I now have is I want to email more than one person with notification of a new order.  Anybody know wher ethe file that sends emails is?  I'll manually edit it to add an extra email into it like we used to have to in VM1.


Anyone got any idea which file it is ?
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: Thomas Kuschel on June 02, 2012, 21:53:09 pm
Hi ceticwebs,

I've added some stuff to the mailing (see http://forum.virtuemart.net/index.php?topic=100367.0 )
add "vendor" addresses - hack with e.g. myemailaddress1@example.com, myemailaddress2@example.com,... to the
shopfunctionsf.php: - it is _really_ a hack and awful ;-)

Code: [Select]
/**
* 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)
* @return true if successful
*/
private function sendVmMail (&$view, $recipient, $vendor=false ) {
$jlang =JFactory::getLanguage();
if(VmConfig::get('enableEnglish', 1)){
$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);
$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);

$mailfrom = array();
if($vendor){   //this is the mail to the vendor!

$mailer->addRecipient('myemailaddress1@example.com');
$mailer->addRecipient('myemailaddress2@example.com');

$mail_from_recipient = VmConfig::get('mail_from_recipient','0');
if ($mail_from_recipient =='1'){
if(isset($view->user)){
$mailfrom[0] = $view->user['email'];
$mailfrom[1] = $view->user['name'];
}else{
$user = JFactory::getUser(); //fallback
if (!empty($user->id)) {
$mailfrom[0] = $user->email;
$mailfrom[1] = $user->name;
}
}
} //else fetch the Joomla setup email address
}else{
$mailfrom[0]=$view->vendorEmail;
$mailfrom[1]= $view->vendor->vendor_name;
}
if(!empty($mailfrom)){
$mail_from_setSender = VmConfig::get('mail_from_setsender','0');
if ($mail_from_setSender=='0') {
$mailer->addReplyTo($mailfrom);
}else {
$mailer->setSender($mailfrom);
}
}

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

return $mailer->Send();
}

not tested, but it should work. (hope there's no typo)

Thomas
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: celticwebs on June 06, 2012, 15:59:05 pm
Hi Thomas,

Thanks for the reply and apologies for the delayed reply, I keep forgetting to click notify!  I'll have to go set it as default so I get notifications, I bet lots of posts go dead because the poster didn't realise a post had been replied to.

With the above function, do I just add it to functions.php in admin and change the emails to the ones I want to receive order emails?
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: celticwebs on June 06, 2012, 16:03:49 pm
Ooops!  I misse dteh f, no wonder I couldn’t find the function!  It's in the site side files not the admin ones :)

I just updated the fucntion with your setup, about to test it :)

***UPDATE***

It worked perfectly :)

thanks Thomas!
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: Thomas Kuschel on June 06, 2012, 19:46:08 pm
Oh yes, mind the "f" :-). It's the file components/com_virtuemart/helpers/shopfunctionsf.php
You are welcome, ceticwebs.
Thomas
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: Merry on June 06, 2012, 21:45:59 pm
Hello,

I pulling my hair out trying to figure out how to change where order notification emails are sent to.  Right now they come to the Super Admin account.  I want to change this to one of the Administrators on the site.  How can I do this?

Thank you for the help.

There are many ways to do this, but here is the easy way for site administrators using the Admin and your mail host:

1. At the web host (cPanel, Gmail or similar) set up a mail forward named orders@yourdomainname.com and forward to everyone who needs a copy.
2. In JOOMLA (Not VirtueMart) top navigation menu click USERS - User Management - Super User - Account Details - EMAIL and change that email address to orders@yourdomainname.com. Be sure to click top right SAVE Button.

Best regards,
Merry

Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: celticwebs on June 06, 2012, 23:24:06 pm
Hi Merry,

Thanks for the suggestion, I had already tried that one but I actually only wanted orders to be sent to it not all the admin email so that didn't quite work as I wanted.

Thanks again for the suggestion though :)

I don't suppose either of you have any knowledge of the issue I'm having with paypal delivery addresses do you ?  The thread is here http://forum.virtuemart.net/index.php?topic=103513
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: Thomas Kuschel on June 07, 2012, 16:14:13 pm
Hi Merry, thank you for your suggestion too, that's definitely the best way not to change the sources. :D
Regards Thomas
 
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: Piccoro on July 09, 2012, 18:54:05 pm
I've been having similar problems with the emails coming to me instead of the store owner.

I think I've fixed it with phpmyadmin

In the table   `jos_virtuemart_vmusers` the field virtuemart_vendor_id was set to 1 for my user (and most other users)

I've set this to 0 for all users, except for the store owner, and now when I check the shop - /index.php?option=com_virtuemart&view=user&task=editshop the email address listed under additional info is the correct one.

Thank you for this solution.
It solves the multi vendor problem in VM 2 perfectly.
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: fredonline on May 22, 2018, 20:09:58 pm
I've got to say, this is about the worst method I've seen for managing order notification email.

Whose idea was this? To (silently) send orders to the superadmin...with nothing mentioned anywhere about this...and no way to change this?

Horrible!

I would be speechless, except I wasted so much time on this. And my user/store owner (who is NOT the superadmin!!!) is not getting order confirmations.

Who made the assumption that the superadmin that designed the site would be the same as the store owner? How about web designer vs. store owner. NOT THE SAME PERSON!

This is actually inexcusable.
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: Jörgen on May 22, 2018, 20:24:47 pm
Hello Fredonline

Take it down a notch and think before You speak. This is configurable, but I can´t help You much more than this, the batteries in my magic lamp are out. :(

http://forum.virtuemart.net/index.php?topic=79799.0 (http://forum.virtuemart.net/index.php?topic=79799.0)

regards

Jörgen @ Kreativ Fotografi

Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: fredonline on May 22, 2018, 22:51:11 pm
Virtuemart 3.2.14 on Joomla 3.8.7, CentOS 7.3, PHP 7.0.30
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: jenkinhill on May 22, 2018, 23:39:15 pm
Fred it is a very simple configuration issue - and always has been. I do wonder, though, why you add your comment to a six year old thread.
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: Jack Stiles on September 11, 2018, 21:23:54 pm
Fred it is a very simple configuration issue - and always has been. I do wonder, though, why you add your comment to a six year old thread.

Yeah I wonder too why he commented to an old thread but since he already - I don't see any real solution here...so...what is it? If its so simple it should be written somewhere right?

For example - I am on latest J! 3.something and latest VM 3 and I didnt find a way to do this yet :-(
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: GJC Web Design on September 11, 2018, 23:25:20 pm
to the vendor - not the J Super user
Title: Re: How To Change Who Recieves Order Notification Emails?
Post by: Jack Stiles on September 12, 2018, 09:57:08 am
to the vendor - not the J Super user

Nice thanks - I have noticed this settings but for some reason I thought that its the sender's adress not the recipient ;-) Thank you!