Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2010
    Posts
    32
    Plugin Contributions
    0

    Default Copy of orders to different email addresses?

    We have a requirement whereby when an engineer places an order an e-mail copy of the order needs to be sent to his line manager, therefore there will be numerous line managers with different e-mail addresses.

    Does anyone know if this is possible and how I would go about it?

    Thank you

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: Copy of orders to different email addresses?

    I don't think there's any way to do that in Zencart. We did something similar by assigning email addresses to users which had forwarders set up to send to the user's actual email address and to his manager. This assumes that all your engineers are internal and Zencart accounts are set up for them.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Copy of orders to different email addresses?

    Here's the basic concept --- you'll have to work out your own way of determining what the line-manager's email address is. You didn't mention how the store would know the correct email address. Simply add that logic into the code below.

    1. /includes/classes/observers/class.sendLineManagerOrderNotices.php
    PHP Code:
    <?php
    /**
     * observer class to send custom extra order emails
     *
     * @package classes
     * @copyright Copyright 2003-2013 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: class.sendLineManagerOrderNotices.php   $
     */
    class sendLineManagerOrderNotices extends base {

     
    /**  constructor method !
       *
       * Attach observer class to the global $zco_notifier and watch for a single notifier event.
       */
      
    function __construct() {
        
    $this->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'));
      }


     
    /**   Actual Method that does the desired activity
       *
       * Called by observed class when any of the notifiable events occur
       *
       * @param object $class
       * @param string $eventID
       * @param array $paramsArray
       */
      
    function update(&$class$eventID$paramsArray = array()) {
        list(
    $zf_insert_id$email_order$extra_info$html_msg) = $paramsArray;

        
    $manager_email_address $this->lookup_manager_email_address($_SESSION['customer_id']);

        if (
    $manager_email_address != '') {
          
    zen_mail(''$manager_email_address,
              
    EMAIL_ORDER_NUMBER_SUBJECT $zf_insert_id,
              
    $email_order $extra_info['TEXT'], STORE_NAMEEMAIL_FROM$html_msg'checkout_extra');
        }
      }

      function 
    lookup_manager_email_address($employee_id) {
        global 
    $db;
        
    $sql "put your SQL query here -- needs to look up the destination manager's email address based on supplied $employee_id"
        
    $result $db->Execute($sql);
        
    $email_address $result->fields['manager_email'];
        return 
    $email_address;
      }

    }
    2. /includes/auto_loaders/config.sendLineManagerOrderNotices.php
    PHP Code:
    <?php
    /**
     * autoloader activation point for custom group order email notices
     *
     * @package initSystem
     * @copyright Copyright 2003-2013 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: config.sendLineManagerOrderNotices.php $
     */
    /**
     * Autoloader to instantiate observer class
     */
    $autoLoadConfig[90][] = array('autoType'=>'class',
                                  
    'loadFile'=>'observers/class.sendLineManagerOrderNotices.php');
    $autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
                                  
    'className'=>'sendLineManagerOrderNotices',
                                  
    'objectName'=>'sendLineManagerOrderNotices');
    Adapted from http://www.zen-cart.com/showthread.p...507#post889507 ... which may also be worth a read
    .

    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. #4
    Join Date
    Feb 2010
    Posts
    32
    Plugin Contributions
    0

    Default Re: Copy of orders to different email addresses?

    Thank you for your help.

    At this stage I'm not sure how the store will know which e-mail address to send the order to. I'm wondering if I can add an extra field to customer details.

    At least I now know this can be achievable.

  5. #5
    Join Date
    Jun 2010
    Location
    Austria
    Posts
    115
    Plugin Contributions
    0

    Default Re: Copy of orders to different email addresses?

    I think you're on the right track. I'd make the line manager email a customer field so it's part of their account (same as their own email), assuming that the line manager email remains fairly static and does not change with each order. They enter it when they create an account & then order emails go to both.

  6. #6
    Join Date
    Feb 2010
    Posts
    32
    Plugin Contributions
    0

    Default Re: Copy of orders to different email addresses?

    Hi

    I want to add a field to customer accounts called Line Manager's email address and I will need the order confirmation also to go to this e-mail address.

    Any help would be much appreciated as I don't know how to go about this.

    Many thanks

    Regards

    Mel

 

 

Similar Threads

  1. orders and email addresses
    By DarkAngel in forum General Questions
    Replies: 2
    Last Post: 12 Apr 2011, 12:55 AM
  2. Possible to send orders to different email addresses?
    By alliemay in forum Managing Customers and Orders
    Replies: 1
    Last Post: 15 Nov 2009, 02:24 AM
  3. Different Email Addresses for Outgoing Emails???
    By Griff1324 in forum General Questions
    Replies: 1
    Last Post: 25 Apr 2008, 07:26 AM
  4. Orders go to different email addresses
    By Scarlet in forum General Questions
    Replies: 2
    Last Post: 13 Jul 2007, 03:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR