News:

Looking for documentation? Take a look on our wiki

Main Menu

How To Change Who Recieves Order Notification Emails?

Started by woood77, May 08, 2012, 18:48:46 PM

Previous topic - Next topic

woood77

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.

hkymre

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.

celticwebs

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 ?

Thomas Kuschel

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 ;-)

/**
* 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

celticwebs

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?

celticwebs

#5
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!

Thomas Kuschel

Oh yes, mind the "f" :-). It's the file components/com_virtuemart/helpers/shopfunctionsf.php
You are welcome, ceticwebs.
Thomas

Merry

Quote from: 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.

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

Answer is probably from my VirtueMart 2 User Manual ebook, includes FREE updates. FREE Admin Menu Cheatsheet, Quick Install Guide & 30-Minute Quick Setup Guide http://showmeguides.com/

celticwebs

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

Thomas Kuschel

Hi Merry, thank you for your suggestion too, that's definitely the best way not to change the sources. :D
Regards Thomas
 

Piccoro

Quote from: 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.

Thank you for this solution.
It solves the multi vendor problem in VM 2 perfectly.

fredonline

#11
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.

Jörgen

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

regards

Jörgen @ Kreativ Fotografi

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

fredonline

Virtuemart 3.2.14 on Joomla 3.8.7, CentOS 7.3, PHP 7.0.30

jenkinhill

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.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum