Send order status notification to multiple people

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
11 years 3 months ago #119660

You can try to add instead that line of code at the beginning of the email then:

<?php $this->mailer->addBCC('myemail@mywebsite.com'); ?>

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 12
11 years 2 months ago #123817

Hi,

Adding the folowing code did not work for me.

<?php $this->mailer->addBCC('myemail@mywebsite.com'); ?>

I pasted it in ORDER_CREATION_NOTIFICATION_SUBJECT in System->Emails

Is it for joomla 2.5?

I really can use this so hopefully someone can help.
Thanks.

Last edit: 11 years 2 months ago by SG.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 2 months ago #123899

Hi,

It is for Joomla 1.5, 2.5 and 3.x
The code add the address "This email address is being protected from spambots. You need JavaScript enabled to view it." in blind carbon copy for the email.
For most I know, it should work.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 12
11 years 2 months ago #123983

Hi,

Strange that it doesn't work for me.
I've put the code on top as you can see below:

<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.1.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>

<?php
      $this->mailer->addBCC('xxxxxxxx@gmail.com');
?>

Is there a way to see what could be the problem?
Can I PM you the login and password so you can see if there is something wrong in my code in mail template.
Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 2 months ago #124055

Hi,

Thanks to try with:

$mail->addBCC('xxxxxxxx@gmail.com');
Instead of:
$this->mailer->addBCC('xxxxxxxx@gmail.com');

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 12
11 years 2 months ago #124092

Hi,

I tried it with $mail->addBCC instead of $this->mailer->addBCC like suggested but I got an error (see below).

The beginning of the Order Creation Notification mail looks like this with the new code:

<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.1.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>

<?php
      $mail->addBCC('xxxxxxx@gmail.com');
?>

Like I said I got the following error:
Fatal error: Call to undefined method stdClass::addBCC() in /home/xxxxxxxx/public_html/site/media/com_hikashop/mail/order_creation_notification.html.modified.php on line 13

Line 13 is $mail->addBCC('This email address is being protected from spambots. You need JavaScript enabled to view it.');

Any advice?
It would really be great to get this working.
Thanks by the way for trying to help. It's always appreciated.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 2 months ago #124117

I just checked and the correct code is as Jerome said: $this->mailer->addBCC('This email address is being protected from spambots. You need JavaScript enabled to view it.');
In the email parameters have you enabled the HTML version ? (Send HTML option)

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 12
11 years 2 months ago #124128

Hi,

I changed it back to jerome's code.
Below you see a printscreen and SEND HTML is enabled.



But it's still not working.
(I've send a pm with login and password so you can maybe see if something else is wrong?)

Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 2 months ago #124233

Another solution could be to create a little plugin which add the bcc to the emails.

It must be plugged on the function: onBeforeMailSend(&$mail,&$mailer)
Where mail is the current $email and $mailer the Joomla mail instance.

Something like:

function onBeforeMailSend(&$mail,&$mailer){
    $mailer->addBCC(' xxxxxxxx@gmail.com');
}

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 12
11 years 2 months ago #124291

Hi,

I created a folder bccmail under plugins/hikashop/ and I made bccmail.xml and bccmail.php
In bccmail.php I added the following code:

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.1.3
 * @author	hikashop.com
 * @copyright	(C) 2010-2013 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');

class plgHikashopBccMail extends JPlugin
{
	function plgHikashopBccMail(&$subject, $config){
		parent::__construct($subject, $config);
		if(!isset($this->params)){
			$plugin = JPluginHelper::getPlugin('hikashop', 'bccmail');
			if(version_compare(JVERSION,'2.5','<')){
				jimport('joomla.html.parameter');
				$this->params = new JParameter($plugin->params);
			} else {
				$this->params = new JRegistry($plugin->params);
			}
		}
	}

	function onBeforeMailSend(&$mail,&$mailer){
    	$mailer->addBCC('xxxxxxx@gmail.com');
	}	
}

What do I need to do so that this plugin is triggered in the Order creation notification.
Do I need to add some code in the "Order creation notification" email?
I'm not sure how this plugin knows when to get executed.

Thanks.

EDIT: I did not make anything else like an installation file since I have no experience with making plugins.

Last edit: 11 years 2 months ago by SG.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 2 months ago #124346

You just have to zip this two files, and then install it via the Joomla extensions installer, then publish the plugin.

The following user(s) said Thank You: csymmonds, SG

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 12
11 years 2 months ago #124388

Hi,

Great!!!!!
I can confirm that it works to add BCC this way.
Thanks Xavier!!!

Please Log in or Create an account to join the conversation.

  • Posts: 91
  • Thank you received: 0
11 years 1 month ago #125739

where can i find these zip files?

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 1 month ago #125887

Hi,

You can't find any zip file. You have to create it.
SG created a Joomla plugin and Nicolas explained him how install it easily in his website : by zipping the two files (php and xml) into a zip.
You can see more about how creating a joomla plugin in the official joomla documentation.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 2
11 years 1 month ago #126712

Hi

I have written the plugin based on SG's code, with modifications to allow multiple addresses.

WARNING: I am not familiar with programming, hence the code may be amateurish. Test it out before using it on the production site.

On a side note, how do I target only specific emails. Right now it seemed like all the emails have bcc appended to it.

EDIT: It seemed like after uploading the file, the forum changes the name of my file. Does the name of the zip file matter in plugins?

Attachments:
Last edit: 11 years 1 month ago by caveman.
The following user(s) said Thank You: khotso, csymmonds

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
11 years 1 month ago #126837

The name of the zip doesn't matter.

You can do a test on $mail->mail_name
For example :
if($mail->mail_name!='order_status_notification') return true;
//code after is only for the order status notification email which is sent when orders are confirmed

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
10 years 5 months ago #162114

Please note that BCC might not work on some web servers so if the plugin doesn't work for you, I would recommend to try the email modifications on the first page of this thread which will add the email address directly in the "to" of the email.

Please Log in or Create an account to join the conversation.

  • Posts: 171
  • Thank you received: 9
10 years 4 months ago #162806

Do we have any option to set sending the order notification mail to the additional email address(es) just if the order changed to "Confirmed"? Of course the main (default) user should get all the notification email in all kind of cases.

Thanks,
PePe

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 4 months ago #162813

Hi,

You should be able to add a check on "$mail->order->order_status", something like:

if($mail->order->order_status == 'confirmed'){
  // add the bcc email
}

Please Log in or Create an account to join the conversation.

  • Posts: 171
  • Thank you received: 9
10 years 4 months ago #163655

Xavier wrote: Hi,

You should be able to add a check on "$mail->order->order_status", something like:

if($mail->order->order_status == 'confirmed'){
  // add the bcc email
}


If anyone needs the same, I got it to work by taking these lines to the mail's PHP (preload version):
if($data->order->order_status == 'confirmed'){
$this->mailer->addBCC('This email address is being protected from spambots. You need JavaScript enabled to view it.');
}

Thanks again.

Please Log in or Create an account to join the conversation.

Time to create page: 0.132 seconds
Powered by Kunena Forum