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!!!
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
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.
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?
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.
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.
Re: email order confirmation to third party
Quote:
Originally Posted by
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?
Re: email order confirmation to third party
Quote:
Originally Posted by
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
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.
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:
Code:
$this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL');
becomes this:
Code:
$this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL', array($zf_insert_id, $email_order, $extra_info, $html_msg));
2. Create a new file with the following content:
/includes/classes/observers/class.sendGroupOrderNotices.php
Code:
<?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'));
/**
* 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;
}
/** 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
Code:
<?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');