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

    Default Order confirmation to third party email - PROBLEM

    I am trying to set up order confirmations to go to different e-mail addresses dependant on customer group.

    I did get group 1 to work but couldn't get any other group to work. Now no groups are working.

    Here is my code in includes/classes/observers/class.sendGroupOrderNotices.php

    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) {
          
    $this->specialGroupEmailAddress '';
          switch(
    $group_query->fields['customers_group_pricing']) {
            case 
    '1':
              
    $this->specialGroupEmailAddress '[email protected]';
              
    $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_NAMEEMAIL_FROM$html_msg'checkout_extra'$this->attachArray);
        }
      }
    }
    Any help / advice would be much appreciated.

    Many thanks

    Regards

    Mel

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

    Default Re: Order confirmation to third party email - PROBLEM

    As I have had no reply I am guessing no one knows how to do this?

    If somebody could help me with PHP code and ge this working I would be prepared to pay.

    Regards

    Mel

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

    Default Re: Order confirmation to third party email - PROBLEM

    The email addresses you've entered for all the groups don't look like they're real addresses.
    And do your group numbers match the "case" statements in the code? If not, then those scenarios won't trigger, and thus the emails won't be sent.
    .

    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: Order confirmation to third party email - PROBLEM

    Hi DrByte

    I originally tried it and put in proper e-mail addresses but it didn't seem to work, I have just put them back in and no joy.

    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 'melodyw@REAL_SITE_HERE.co.uk';
        
    /**
         * 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) {
          
    $this->specialGroupEmailAddress '';
          switch(
    $group_query->fields['customers_group_pricing']) {
            case 
    '1':
              
    $this->specialGroupEmailAddress 'melody.wootton@REAL_SITE_HERE.co.uk';
              
    $this->orderEmailSubjectPrefix 'Order Fulfillment Request from ' STORE_NAME;
              break;
            case 
    '2':
              
    $this->specialGroupEmailAddress 'stevesham@REAL_SITE_HERE.co.uk';
              
    $this->orderEmailSubjectPrefix 'Order Fulfillment Request from ' STORE_NAME;
              break;
            case 
    '3':
              
    $this->specialGroupEmailAddress 'melodyw@REAL_SITE_HERE.co.uk';
              
    $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_NAMEEMAIL_FROM$html_msg'checkout_extra'$this->attachArray);
        }
      }
    }
    Do you have any idea why this isn't working? I'm sure it's something really silly but I don't really know much PHP and I'm pulling my hair out!

    Thanks in advance.
    Last edited by DrByte; 24 Apr 2013 at 06:41 PM. Reason: altered email addresses for privacy

 

 

Similar Threads

  1. v153 When order is in "Processing" status send email to third party
    By jdlauletta in forum General Questions
    Replies: 0
    Last Post: 6 Nov 2014, 08:07 PM
  2. email order confirmation to third party
    By valnoren in forum General Questions
    Replies: 46
    Last Post: 27 Jan 2014, 11:29 AM
  3. welcome email problem and order confirmation email problems
    By oneelios in forum General Questions
    Replies: 1
    Last Post: 22 Jan 2010, 11:18 AM
  4. Order confirmation email problem
    By hzha in forum General Questions
    Replies: 8
    Last Post: 1 Jan 2008, 10:36 AM
  5. problem email confirmation order
    By peppecol in forum General Questions
    Replies: 2
    Last Post: 9 Sep 2007, 11:18 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