Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2012
    Posts
    405
    Plugin Contributions
    0

    Default Extra order email when order contains certain products

    Dr. Byte,
    I need to send an extra order email when the order contains certain products. I'm trying to use the technique you suggested in thread 205086 but I get a white page with the following PHP Warnings:

    [27-Apr-2013 22:22:31] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /Applications/MAMP/htdocs/Costore/includes/auto_loaders/config.sendSpecialOrderConfirmationCopies.php:1) in /Applications/MAMP/htdocs/Costore/includes/functions/sessions.php on line 113
    [27-Apr-2013 22:22:31] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /Applications/MAMP/htdocs/Costore/includes/auto_loaders/config.sendSpecialOrderConfirmationCopies.php:1) in /Applications/MAMP/htdocs/Costore/includes/functions/sessions.php on line 113
    [27-Apr-2013 22:22:31] PHP Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/Costore/includes/auto_loaders/config.sendSpecialOrderConfirmationCopies.php:1) in /Applications/MAMP/htdocs/Costore/includes/init_includes/init_templates.php on line 78

    and

    [27-Apr-2013 22:22:49] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /Applications/MAMP/htdocs/Costore/includes/auto_loaders/config.sendSpecialOrderConfirmationCopies.php:1) in /Applications/MAMP/htdocs/Costore/includes/functions/sessions.php on line 113
    [27-Apr-2013 22:22:49] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /Applications/MAMP/htdocs/Costore/includes/auto_loaders/config.sendSpecialOrderConfirmationCopies.php:1) in /Applications/MAMP/htdocs/Costore/includes/functions/sessions.php on line 113
    [27-Apr-2013 22:22:49] PHP Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/Costore/includes/auto_loaders/config.sendSpecialOrderConfirmationCopies.php:1) in /Applications/MAMP/htdocs/Costore/includes/functions/functions_general.php on line 45

    I have used your code but changed the file names, name of the class/object, changed the email address variable, and deleted the email address lookup function and call as it is not needed for this application. The address is fake for the purposes of this post. Note that I have not yet installed the code to check whether the order contains the products requiring the extra email. I'm taking one small step at a time.

    Code follows:
    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.sendSpecialOrderConfirmationCopies.php   $
     */
    class sendSpecialOrderConfirmationCopies 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;
    
        $email_address = "test######################";
    
        if ($email_address != '') {
          zen_mail('', $email_address,
              EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
              $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra');
        }
      }
    
    }
    and

    Code:
     <?php
    /**
     * autoloader activation point for custom order confirmation 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.sendSpecialOrderConfirmationCopies.php $
     */
    /**
     * Autoloader to instantiate observer class
     */
    $autoLoadConfig[90][] = array('autoType'=>'class',
                                  'loadFile'=>'observers/class.sendSpecialOrderConfirmationCopies.php');
    $autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
                                  'className'=>'sendSpecialOrderConfirmationCopies',
                                  'objectName'=>'sendSpecialOrderConfirmationCopies');
    Can you point me in the right direction to resolve these errors?

    I'm working on a development system originally setup with v1.5 and later upgraded to v1.5.1. Add-ons include admin_new_customer_1, admin_new_orders_2, edit_orders_v4.0.4, Product_Cost_Display, Shipping_By_Quote_2.3, and super orders_5. The errors did not occur until the above code was installed.

    Thanks for any help you can provide,

    Dave

  2. #2
    Join Date
    Jun 2012
    Posts
    405
    Plugin Contributions
    0

    Default Re: Extra order email when order contains certain products

    Found it! Extra space at the beginning of each file on line 1. Sorry to bother everyone.

    Dave (looking sheepish)

 

 

Similar Threads

  1. v139h Extra Order Fee not apply to certain products?
    By leevalentine001 in forum Built-in Shipping and Payment Modules
    Replies: 21
    Last Post: 29 Oct 2012, 09:02 PM
  2. v138a Hide shipping method when order exceeds certain value of order
    By staudrak in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 17 Jun 2012, 05:22 PM
  3. Add Order Information in EXTRA CC ORDER email
    By DigitalGuard in forum General Questions
    Replies: 5
    Last Post: 24 Mar 2010, 07:45 PM
  4. free shipping if order contains certain product
    By ianhg in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 17 Nov 2009, 07:22 PM
  5. Replies: 0
    Last Post: 23 Jan 2009, 09:59 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