Skip to main content

Send order status notification to multiple people

More
13 years 2 months ago #119660 by nicolas
You can try to add instead that line of code at the beginning of the email then:
Code:
<?php $this->mailer->addBCC('myemail@mywebsite.com'); ?>

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

More
13 years 1 month ago - 13 years 1 month ago #123817 by SG
Hi,

Adding the folowing code did not work for me.
Code:
<?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: 13 years 1 month ago by SG.

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

More
13 years 1 month ago #123899 by Jerome
Hi,

It is for Joomla 1.5, 2.5 and 3.x
The code add the address "myemail@mywebsite.com" 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.

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

More
13 years 1 month ago #123983 by SG
Hi,

Strange that it doesn't work for me.
I've put the code on top as you can see below:
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 $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.

More
13 years 1 month ago #124055 by Xavier
Hi,

Thanks to try with:
Code:
$mail->addBCC('xxxxxxxx@gmail.com');
Instead of:
Code:
$this->mailer->addBCC('xxxxxxxx@gmail.com');

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

More
13 years 1 month ago #124092 by SG
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:
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:
Code:
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('xxxxxxx@gmail.com');

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.

More
13 years 1 month ago #124117 by Xavier
I just checked and the correct code is as Jerome said: $this->mailer->addBCC('xxxxxxxx@gmail.com');
In the email parameters have you enabled the HTML version ? (Send HTML option)

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

More
13 years 1 month ago #124128 by SG
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.

More
13 years 1 month ago #124233 by Xavier
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:
Code:
function onBeforeMailSend(&$mail,&$mailer){ $mailer->addBCC(' xxxxxxxx@gmail.com'); }

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

More
13 years 1 month ago - 13 years 1 month ago #124291 by SG
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:
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: 13 years 1 month ago by SG.

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

More
13 years 1 month ago #124346 by Xavier
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.

More
13 years 1 month ago #124388 by SG
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.

More
13 years 3 weeks ago #125739 by ces
where can i find these zip files?

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

More
13 years 3 weeks ago #125887 by Jerome
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.

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

More
13 years 3 weeks ago - 13 years 3 weeks ago #126712 by caveman
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?
Last edit: 13 years 3 weeks ago by caveman.
The following user(s) said Thank You: khotso, csymmonds

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

More
13 years 2 weeks ago #126837 by nicolas
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.

More
12 years 4 months ago #162114 by nicolas
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.

More
12 years 3 months ago #162806 by pepecortez
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.

More
12 years 3 months ago #162813 by Xavier
Hi,

You should be able to add a check on "$mail->order->order_status", something like:
Code:
if($mail->order->order_status == 'confirmed'){ // add the bcc email }

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

More
12 years 3 months ago #163655 by pepecortez

Xavier wrote: Hi,

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

Code:
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('xxxx@gmail.com');
}

Thanks again.

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

Time to create page: 0.549 seconds
Powered by Kunena Forum