Forums / General Questions / email order confirmation to third party

email order confirmation to third party

Views: 11,287

Results 1 to 20 of 47
26 May 2010, 6:35 PM
#1
valnoren avatar

valnoren

New Zenner

Join Date:
Mar 2006
Posts:
63
Plugin Contributions:
0

email order confirmation to third party

I am trying to figure out how I can get orders placed by customers belonging to a certain company or group to receive an order confirmation when the customer places an order.

Im a php newbie...
Is there a way to get zencart to do the following... (if customer is from company "ACME , or belongs to the "ACME" group then ...send the order confirmation to "[email protected]")... All other orders email site admim

Any help would be WONDERFUL!!!

26 May 2010, 6:38 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: email order confirmation to third party

Admin >>> Email...

you can insert several addresses ( just follow the protocol shown ).

HOWEVER... sorting the email by the manner you propose may not be possible without some heavy coding

20 years a Zencart User

26 May 2010, 7:03 PM
#3
valnoren avatar

valnoren

New Zenner

Join Date:
Mar 2006
Posts:
63
Plugin Contributions:
0

Re: email order confirmation to third party

Yes I know the Admin>Email Unfortunately that sends an email to as many emails as you want on EVERY order. What I need is only ACME customers to have an order notification sent to a third party.

26 May 2010, 7:07 PM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: email order confirmation to third party

What if an order consists of SEVERAL products, of which ONE is from ACME and the others are from somewhere else?

20 years a Zencart User

26 May 2010, 7:25 PM
#5
valnoren avatar

valnoren

New Zenner

Join Date:
Mar 2006
Posts:
63
Plugin Contributions:
0

Re: email order confirmation to third party

No the customer is from the company/organization "ACME" they can order whatever they want but I have to have the orders placed for this company/organization "ACME" sent to an administrative email from the ACME company for approval they then email be back a P.O. Number .... (the company has multiple locations) but a single approval person that issues P.O's for the invoice.

I just need the person who handle the P.O's to get the order when someone from that organization places an order.

26 May 2010, 7:56 PM
#6
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: email order confirmation to third party

I posted the same request (third-party email by customer) in the Commercial Help Wanted forum a while back and got a couple of replies that didn't seem unreasonable, cost-wise. I wasn't able to follow up, but you might try there.

26 May 2010, 9:01 PM
#7
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: email order confirmation to third party

valnoren:

No the customer is from the company/organization "ACME" they can order whatever they want but I have to have the orders placed for this company/organization "ACME" sent to an administrative email from the ACME company for approval they then email be back a P.O. Number .... (the company has multiple locations) but a single approval person that issues P.O's for the invoice.

I just need the person who handle the P.O's to get the order when someone from that organization places an order.

Ah... that's a little more straightforward, and I would suggest a solution that has nothing to do with zencart.

If you are using an email client (Outlook), build a RULE that will automatically forward YOUR receipt of the acme-specific confirmation, to the someone from Acme.

So... you will be receiving ALL order confirmations, regardless of the customer... Just configure Outlook to have a rule that says:

"If an order confirmation comes in with @acme.com in the whatever field, forward a copy to [email protected]"

I'm sure you will know how to set up rules in Outlook?

20 years a Zencart User

26 May 2010, 9:25 PM
#8
valnoren avatar

valnoren

New Zenner

Join Date:
Mar 2006
Posts:
63
Plugin Contributions:
0

Re: email order confirmation to third party

schoolboy:

Ah... that's a little more straightforward, and I would suggest a solution that has nothing to do with zencart.

If you are using an email client (Outlook), build a RULE that will automatically forward YOUR receipt of the acme-specific confirmation, to the someone from Acme.

So... you will be receiving ALL order confirmations, regardless of the customer... Just configure Outlook to have a rule that says:

"If an order confirmation comes in with @acme.com in the whatever field, forward a copy to [email protected]"

I'm sure you will know how to set up rules in Outlook?

LOL schoolboy I thought of that myself but the client had this set up in an old OScommerce site and wants it the same way for the new zencart site...
Its a long story. In short theres a special category of products which are password protected. for a certain group.
this group adds an item to shopping cart.
then clicks checkout and instead of continuing to the shipping /login page it goes to a special form page that sends the info to the main Org's headqurters that approve the order and send the order back to the client.

Screwy I know...
I have the old form page which will probably function in zencart but how to get from the shopping cart page to the special ordering page ????? so it sends the form to the Org's HQ is where Im stuck

26 May 2010, 9:56 PM
#9
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: email order confirmation to third party

Sounds like a Government Department in a Banana Republic.

It may be an idea to get someone to look at the osCommerce code... while it will definitely NOT work in ZC, the functional parameters will be obvious to a knowledgeable coder and it may speed up the dev of a ZC version, and therefore be cheaper.

20 years a Zencart User

26 May 2010, 10:34 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: email order confirmation to third party

valnoren, using Zen Cart v1.3.9x, it's very simple.

You could hard-code lotsa stuff into the orders class, or you could go with a more sophisticated approach using notifiers/observers as I've outlined below:

  1. Edit /includes/classes/order.php and change just one line near the very end of the file:$this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL');becomes this:```
    $this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'[B], array($zf_insert_id, $email_order, $extra_info, $html_msg)[/B]);

2. Create a new file with the following content:
/includes/classes/observers/class.sendGroupOrderNotices.php
<?php /** * observer class to send custom extra order emails to supplier based on customer group membership * * @package classes * @copyright Copyright 2003-2010 Zen Cart Development Team * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: class.sendGroupOrderNotices.php 2010-05-26 20:05:22Z drbyte $ */ class sendGroupOrderNotices extends base { /** constructor method ! * * Attach observer class to the global $zco_notifier and watch for a single notifier event. */ function sendGroupOrderNotices() { $this->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL')); [B] /** * Set the specialGroupId to the number of the customer-group assigned in your admin */ $this->specialGroupId = 1; /** * Set the proper email address for the additional copy of order confirmations to be sent to */ $this->specialGroupEmailAddress = 'noreply@mail_domain.com'; /** * Set the email subject line for the messages being sent to the external supplier * Use EMAIL_TEXT_SUBJECT for the default subject, or replace with 'My Custom Subject Line' instead. */ $this->orderEmailSubjectPrefix = 'Order Fulfillment Request from ' . STORE_NAME;[/B] } /** Actual Method that does the desired activity * * Called by observed class when any of the notifiable events occur * * @param object $class * @param string $eventID */ function update(&$class, $eventID, $paramsArray = array()) { global $db; list($zf_insert_id, $email_order, $extra_info, $html_msg) = $paramsArray; $group_query = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'"); if (!$group_query->EOF && $group_query->fields['customers_group_pricing'] == $this->specialGroupId) { zen_mail('', $this->specialGroupEmailAddress, $this->orderEmailSubjectPrefix . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray); } } } ```You can **customize the section in red, as needed. ** 3. Create a new file with the following content: /includes/auto_loaders/config.sendGroupOrderNotices.php``` <?php /** * autoloader activation point for custom group order email notices * * @package initSystem * @copyright Copyright 2003-2010 Zen Cart Development Team * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: config.sendGroupOrderNotices.php 2010-05-26 20:05:22Z drbyte $ */ /** * Autoloader to instantiate observer class */ $autoLoadConfig[90][] = array('autoType'=>'class', 'loadFile'=>'observers/class.sendGroupOrderNotices.php'); $autoLoadConfig[90][] = array('autoType'=>'classInstantiate', 'className'=>'sendGroupOrderNotices', 'objectName'=>'sendGroupOrderNotices'); ```

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

28 May 2010, 2:47 PM
#11
valnoren avatar

valnoren

New Zenner

Join Date:
Mar 2006
Posts:
63
Plugin Contributions:
0

Re: email order confirmation to third party

WOW DrByte you rock!! I was looking at that area but I was banging my head against the wall.I am going to try this today!

28 May 2010, 2:48 PM
#12
valnoren avatar

valnoren

New Zenner

Join Date:
Mar 2006
Posts:
63
Plugin Contributions:
0

Re: email order confirmation to third party

schoolboy:

Sounds like a Government Department in a Banana Republic.

It may be an idea to get someone to look at the osCommerce code... while it will definitely NOT work in ZC, the functional parameters will be obvious to a knowledgeable coder and it may speed up the dev of a ZC version, and therefore be cheaper.

LOL thats funny because it is for a government organization!

21 Apr 2012, 6:35 PM
#13
kapil_sb avatar

kapil_sb

New Zenner

Join Date:
Apr 2012
Posts:
17
Plugin Contributions:
0

Re: email order confirmation to third party

Hi,

I know I am trying to awake a very old thread, but this has been a great information from your side, and helped me a lot.

Now I have a question, what if I want emails to go to different email ids for different groups.

I am novice at any coding :(

24 Apr 2012, 5:36 AM
#14
kapil_sb avatar

kapil_sb

New Zenner

Join Date:
Apr 2012
Posts:
17
Plugin Contributions:
0

Re: email order confirmation to third party

kapil_sb:

Hi,

I know I am trying to awake a very old thread, but this has been a great information from your side, and helped me a lot.

Now I have a question, what if I want emails to go to different email ids for different groups.

I am novice at any coding :(

Dr Byte,

I need your expertise advise on my problem.

I have used your observer and Notifiers , as adviced in this post earlier. This works like a Dream for me! Thanks very much.

Now I need this functionality for mutiple Group IDs for sending mail to different email ids.. Is there a way to change the above code and use it?

I tried using If statement but gives a blank page on opening my website, or 500 error.

Thanks!

29 Apr 2012, 10:36 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: email order confirmation to third party

Try changing this:if (!$group_query->EOF && $group_query->fields['customers_group_pricing'] == $this->specialGroupId) { zen_mail('', $this->specialGroupEmailAddress, $this->orderEmailSubjectPrefix . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray); }to this:```
if (!$group_query->EOF) {
$this->specialGroupEmailAddress = '';
switch($group_query->fields['customers_group_pricing']) {
case '1':
$this->specialGroupEmailAddress = 'email_address_for_group_1@e_mail.com';
$this->orderEmailSubjectPrefix = 'Order Fulfillment Request from ' . STORE_NAME;
break;
case '2':
$this->specialGroupEmailAddress = 'email_address_for_group_2@e_mail.com';
$this->orderEmailSubjectPrefix = 'Order Fulfillment Request from ' . STORE_NAME;
break;
case '3':
$this->specialGroupEmailAddress = 'email_address_for_group_3@e_mail.com';
$this->orderEmailSubjectPrefix = 'Order Fulfillment Request from ' . STORE_NAME;
break;
default:
}
if ($this->specialGroupEmailAddress != '')
zen_mail('', $this->specialGroupEmailAddress,
$this->orderEmailSubjectPrefix . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
}

And then customize the numbers and email addresses as needed.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

4 May 2012, 5:39 AM
#16
kapil_sb avatar

kapil_sb

New Zenner

Join Date:
Apr 2012
Posts:
17
Plugin Contributions:
0

Re: email order confirmation to third party

Dr Byte,

Thanks for all your valuable support.

15 Jun 2012, 5:00 AM
#17
kapil_sb avatar

kapil_sb

New Zenner

Join Date:
Apr 2012
Posts:
17
Plugin Contributions:
0

Re: email order confirmation to third party

Sir one more question,

If I need to send mail to two or more email ids for same Group ID. In that case what shall I Do?

15 Jun 2012, 4:20 PM
#18
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: email order confirmation to third party

Change this:$this->specialGroupEmailAddress = 'email_address_for_group_3@e_mail.com';to this:```
$this->specialGroupEmailAddress = 'Name1<email_address_1@e_mail.com>, Name2<email_address_2@e_mail.com>';

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Jul 2012, 5:11 PM
#19
kapil_sb avatar

kapil_sb

New Zenner

Join Date:
Apr 2012
Posts:
17
Plugin Contributions:
0

Re: email order confirmation to third party

DrByte:

Try changing this:if (!$group_query->EOF && $group_query->fields['customers_group_pricing'] == $this->specialGroupId) { zen_mail('', $this->specialGroupEmailAddress, $this->orderEmailSubjectPrefix . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray); }to this:```
if (!$group_query->EOF) {
$this->specialGroupEmailAddress = '';
switch($group_query->fields['customers_group_pricing']) {
case '1':
$this->specialGroupEmailAddress = 'email_address_for_group_1@e_mail.com';
$this->orderEmailSubjectPrefix = 'Order Fulfillment Request from ' . STORE_NAME;
break;
case '2':
$this->specialGroupEmailAddress = 'email_address_for_group_2@e_mail.com';
$this->orderEmailSubjectPrefix = 'Order Fulfillment Request from ' . STORE_NAME;
break;
case '3':
$this->specialGroupEmailAddress = 'email_address_for_group_3@e_mail.com';
$this->orderEmailSubjectPrefix = 'Order Fulfillment Request from ' . STORE_NAME;
break;
default:
}
if ($this->specialGroupEmailAddress != '')
zen_mail('', $this->specialGroupEmailAddress,
$this->orderEmailSubjectPrefix . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
}

> And then customize the numbers and email addresses as needed.

Dr Byte ,

When I use this code, It throws my CSS out of order, and my website shifts completely to left.

Also all my center boxes also fall out of order.

Please help.
10 Jul 2012, 9:30 PM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: email order confirmation to third party

You must use all the code, in context. Just that snippet alone won't work.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.