Hello,


I still have a problem.

I get these two files simply do not mix.

Here the original orders.php which is in the module case. There, the lines 120-191 are simply "left out". But I have in my orders.php precisely in this area entries from other modules are (Cowa and package tracking, for example).

So here's the orders.php which is at the snap_affiliates module here:


PHP Code:
.
.
.
.
.
.
        
$comments zen_db_prepare_input($_POST['comments']);
        
$status = (int)zen_db_prepare_input($_POST['status']);
        if (
$status 1) break;


//-bof-c-snap_affiliates-v2.5.0
/* ----- Processing now handled by separate function -----
        $order_updated = false;
        $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
                                      date_purchased from " . TABLE_ORDERS . "
                                      where orders_id = '" . (int)$oID . "'");

        if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {
          $db->Execute("update " . TABLE_ORDERS . "
                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
                        where orders_id = '" . (int)$oID . "'");

          $customer_notified = '0';
          if (isset($_POST['notify']) && ($_POST['notify'] == '1')) {

            $notify_comments = '';
            if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on') && zen_not_null($comments)) {
              $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n";
            }
            //send emails
            $message =
            EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
            EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
            EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
            $notify_comments .
            EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
            EMAIL_TEXT_STATUS_PLEASE_REPLY;

            $html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
            $html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
            $html_msg['EMAIL_TEXT_INVOICE_URL']  = '<a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') .'">'.str_replace(':','',EMAIL_TEXT_INVOICE_URL).'</a>';
            $html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']);
            $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
            $html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
            $html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
            $html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
            $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);
            $html_msg['EMAIL_PAYPAL_TRANSID'] = '';

            zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');
            $customer_notified = '1';

            // PayPal Trans ID, if any
            $sql = "select txn_id, parent_txn_id from " . TABLE_PAYPAL . " where order_id = :orderID order by last_modified DESC, date_added DESC, parent_txn_id DESC, paypal_ipn_id DESC ";
            $sql = $db->bindVars($sql, ':orderID', $oID, 'integer');
            $result = $db->Execute($sql);
            if ($result->RecordCount() > 0) {
              $message .= "\n\n" . ' PayPal Trans ID: ' . $result->fields['txn_id'];
              $html_msg['EMAIL_PAYPAL_TRANSID'] = $result->fields['txn_id'];
            }

            //send extra emails
            if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') {
              zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra');
            }
          } elseif (isset($_POST['notify']) && ($_POST['notify'] == '-1')) {
            // hide comment
            $customer_notified = '-1';
          }
          
          $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
                      (orders_id, orders_status_id, date_added, customer_notified, comments) 
                      values ('" . (int)$oID . "',
                      '" . zen_db_input($status) . "',
                      now(),
                      '" . zen_db_input($customer_notified) . "',
                      '" . zen_db_input($comments) . "')");

          $order_updated = true;
          
        }
*/
        
$check_status $db->Execute("SELECT orders_status, date_purchased FROM " TABLE_ORDERS " WHERE orders_id = '" . (int)$oID "'");
        
$customer_notified = (isset($_POST['notify']) && ($_POST['notify'] == || $_POST['notify'] == -1)) ? $_POST['notify'] : 0;
        
$osh_record_added zen_update_orders_history($oID$commentsnull$status$customer_notified, (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on'));
        
$order_updated = ($osh_record_added == -1) ? false true;

//-eof-c-snap_affiliates-v2.5.0

        // trigger any appropriate updates which should be sent back to the payment gateway:
        
$order = new order((int)$oID);
        if (
$order->info['payment_module_code']) {
          if (
file_exists(DIR_FS_CATALOG_MODULES 'payment/' $order->info['payment_module_code'] . '.php')) {
            require_once(
DIR_FS_CATALOG_MODULES 'payment/' $order->info['payment_module_code'] . '.php');
            require_once(
DIR_FS_CATALOG_LANGUAGES $_SESSION['language'] . '/modules/payment/' $order->info['payment_module_code'] . '.php');
            
$module = new $order->info['payment_module_code'];
            if (
method_exists($module'_doStatusUpdate')) {
              
$response $module->_doStatusUpdate($oID$status$comments$customer_notified$check_status->fields['orders_status']);
            }
          }
        }

.
.
.
.





And here is my orders.php:





PHP Code:
.
.
.
..

        
$comments zen_db_prepare_input($_POST['comments']);
        
$status = (int)zen_db_prepare_input($_POST['status']);
        if (
$status 1) break;

        
$order_updated false;
        
$check_status $db->Execute("select customers_name, customers_email_address, orders_status,
                                      date_purchased, COWOA_order from " 
TABLE_ORDERS "
                                      where orders_id = '" 
. (int)$oID "'");

        
// BOF rl_incoice3                                       
        
$rlStat explode('|'RL_INVOICE3_SEND_ORDERSTATUS_CHANGE);
        
$rl_invoice3_send in_array($status$rlStat);
        if ( (
$check_status->fields['orders_status'] != $status  && $status==RL_INVOICE3_ORDERSTATUS)  || ($rl_invoice3_send == true)){
            require_once (
DIR_FS_CATALOG DIR_WS_INCLUDES 'classes/class.rl_invoice3.php');     
            require_once (
'../' DIR_WS_LANGUAGES $_SESSION['language'] . '/extra_definitions/rl_invoice3.php');
            
$paper rl_invoice3::getDefault(RL_INVOICE3_PAPER, array('format' => 'A4''unit' => 'mm''orientation' => 'P'));
            
$pdfT = new rl_invoice3($oID$paper['orientation'], $paper['unit'], $paper['format']);
            
$pdfT->createPdfFile(true);
            
$attach $pdfT->getPDFAttachments('ALL');
        } else {
            
$attach null;
        }
        
// EOF rl_incoice3
        
if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {
          
$db->Execute("update " TABLE_ORDERS "
                        set orders_status = '" 
zen_db_input($status) . "', last_modified = now()
                        where orders_id = '" 
. (int)$oID "'");

          
$customer_notified '0';
          if (isset(
$_POST['notify']) && ($_POST['notify'] == '1')) {
          
$notify_comments '';
      
// Begin Paket Tracking 2.1
        
if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on')) {
        if (
zen_not_null($comments)) {
        
                
$notify_comments EMAIL_TEXT_COMMENTS_UPDATE $comments "\n\n";
              }
              if (
zen_not_null($track_id1)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " CARRIER_NAME_1 " Tracking ID " .PT_EMAIL_YOURIDIS ." " $track_id1 " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" CARRIER_LINK_1 $track_id1 "\n\n<br />" .PT_EMAIL_24HOURS ."" "\n\n<br />"; }
              if (
zen_not_null($track_id2)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " CARRIER_NAME_2 " Tracking ID " .PT_EMAIL_YOURIDIS ." " $track_id2 " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" CARRIER_LINK_2 $track_id2 "\n\n<br />" .PT_EMAIL_24HOURS ."" "\n\n<br />"; }
              if (
zen_not_null($track_id3)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " CARRIER_NAME_3 " Tracking ID " .PT_EMAIL_YOURIDIS ." " $track_id3 " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" CARRIER_LINK_3 $track_id3 "\n\n<br />" .PT_EMAIL_24HOURS ."" "\n\n<br />"; }
              if (
zen_not_null($track_id4)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " CARRIER_NAME_4 " Tracking ID " .PT_EMAIL_YOURIDIS ." " $track_id4 " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" CARRIER_LINK_4 $track_id4 "\n\n<br />" .PT_EMAIL_24HOURS ."" "\n\n<br />"; }
              if (
zen_not_null($track_id5)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " CARRIER_NAME_5 " Tracking ID " .PT_EMAIL_YOURIDIS ." " $track_id5 " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" CARRIER_LINK_5 $track_id5 "\n\n<br />" .PT_EMAIL_24HOURS ."" "\n\n<br />"; }
// End Paket Tracking 2.1
          
}
          
//send emails
// BOF COWOA SEND ORDER_STATUS EMAIL
if (COWOA_ORDER_STATUS == 'true') {
    if (
$check_status->fields['COWOA_order'] == 1)  {
  
            
$message =
            
EMAIL_TEXT_ORDER_NUMBER ' ' $oID "\n\n" .
            
EMAIL_TEXT_COWOA_URL ' ' zen_catalog_href_link(FILENAME_ORDER_STATUS'order_id=' $oID'SSL') . "\n\n" .
            
EMAIL_TEXT_DATE_ORDERED ' ' zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
      
strip_tags($notify_comments) .
      
EMAIL_TEXT_STATUS_UPDATED sprintf(EMAIL_TEXT_STATUS_LABEL$orders_status_array[$status] ) .
      
EMAIL_TEXT_STATUS_PLEASE_REPLY;

          
$html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
          
$html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER ' ' $oID;
          
$html_msg['EMAIL_TEXT_INVOICE_URL']  = '<a href="' zen_catalog_href_link(FILENAME_ORDER_STATUS'order_id=' $oID'SSL') .'">'.str_replace(':','',EMAIL_TEXT_COWOA_URL).'</a>';
          
$html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED ' ' zen_date_long($check_status->fields['date_purchased']);
          
$html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
          
$html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n',''EMAIL_TEXT_STATUS_UPDATED);
          
$html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n',''sprintf(EMAIL_TEXT_STATUS_LABEL$orders_status_array[$status] ));
          
$html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
          
$html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n',''EMAIL_TEXT_STATUS_PLEASE_REPLY);

            
zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT ' #' $oID$messageSTORE_NAMEEMAIL_FROM$html_msg'order_status');
            
$customer_notified '1';
          }
    } 
if (
COWOA_ORDER_STATUS == 'false') {
      if (
$check_status->fields['COWOA_order'] == 1)  {

          
$htmlInvoiceURL='';
          
$htmlInvoiceValue='';
          
$message =
          
EMAIL_TEXT_ORDER_NUMBER ' ' $oID "\n\n" .
          
EMAIL_TEXT_DATE_ORDERED ' ' zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
          
strip_tags($notify_comments) .
          
EMAIL_TEXT_STATUS_UPDATED sprintf(EMAIL_TEXT_STATUS_LABEL$orders_status_array[$status] ) .
          
EMAIL_TEXT_STATUS_PLEASE_REPLY;
          
$html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
          
$html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER ' ' $oID;
          
$html_msg['INTRO_URL_TEXT']        = '';
          
$html_msg['INTRO_URL_VALUE']       = '';
          
$html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED ' ' zen_date_long($check_status->fields['date_purchased']);
          
$html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
          
$html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n',''EMAIL_TEXT_STATUS_UPDATED);
          
$html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n',''sprintf(EMAIL_TEXT_STATUS_LABEL$orders_status_array[$status] ));
          
$html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
          
$html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n',''EMAIL_TEXT_STATUS_PLEASE_REPLY);

            
zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT ' #' $oID$messageSTORE_NAMEEMAIL_FROM$html_msg'order_status');
            
$customer_notified '1';
          }    
    }
// EOF COWOA SEND ORDER_STATUS EMAIL    
    
if ($check_status->fields['COWOA_order'] != 1)  {
            
$message =
            
EMAIL_TEXT_ORDER_NUMBER ' ' $oID "\n\n" .
            
EMAIL_TEXT_INVOICE_URL ' ' zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO'order_id=' $oID'SSL') . "\n\n" .
            
EMAIL_TEXT_DATE_ORDERED ' ' zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
      
strip_tags($notify_comments) .
      
EMAIL_TEXT_STATUS_UPDATED sprintf(EMAIL_TEXT_STATUS_LABEL$orders_status_array[$status] ) .
      
EMAIL_TEXT_STATUS_PLEASE_REPLY;

          
$html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
          
$html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER ' ' $oID;
          
$html_msg['EMAIL_TEXT_INVOICE_URL']  = '<a href="' zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO'order_id=' $oID'SSL') .'">'.str_replace(':','',EMAIL_TEXT_INVOICE_URL).'</a>';
          
$html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED ' ' zen_date_long($check_status->fields['date_purchased']);
          
$html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
          
$html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n',''EMAIL_TEXT_STATUS_UPDATED);
          
$html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n',''sprintf(EMAIL_TEXT_STATUS_LABEL$orders_status_array[$status] ));
          
$html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
          
$html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n',''EMAIL_TEXT_STATUS_PLEASE_REPLY);
          
$html_msg['EMAIL_PAYPAL_TRANSID'] = '';

            
zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT ' #' $oID$messageSTORE_NAMEEMAIL_FROM$html_msg'order_status');
            
$customer_notified '1';

            
// PayPal Trans ID, if any
            
$sql "select txn_id, parent_txn_id from " TABLE_PAYPAL " where order_id = :orderID order by last_modified DESC, date_added DESC, parent_txn_id DESC, paypal_ipn_id DESC ";
            
$sql $db->bindVars($sql':orderID'$oID'integer');
            
$result $db->Execute($sql);
            if (
$result->RecordCount() > 0) {
              
$message .= "\n\n" ' PayPal Trans ID: ' $result->fields['txn_id'];
              
$html_msg['EMAIL_PAYPAL_TRANSID'] = $result->fields['txn_id'];
            }

            
//send extra emails
            
if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') {
              
zen_mail(''SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TOSEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT ' ' EMAIL_TEXT_SUBJECT ' #' $oID$messageSTORE_NAMEEMAIL_FROM$html_msg'order_status_extra');
            }
          } elseif (isset(
$_POST['notify']) && ($_POST['notify'] == '-1')) {
            
// hide comment
            
$customer_notified '-1';
          }

// Begin Paket Tracking 2.1
          
$db->Execute("insert into " TABLE_ORDERS_STATUS_HISTORY "
                      (orders_id, orders_status_id, date_added, customer_notified, track_id1, track_id2, track_id3, track_id4, track_id5, comments)
                      values ('" 
. (int)$oID "',
                      '" 
zen_db_input($status) . "',
                      now(),
                      '" 
zen_db_input($customer_notified) . "',
                      '" 
zen_db_input($track_id1) . "',
                      '" 
zen_db_input($track_id2) . "',
                      '" 
zen_db_input($track_id3) . "',
                      '" 
zen_db_input($track_id4) . "',
                      '" 
zen_db_input($track_id5) . "',
                      '" 
zen_db_input($comments)  . "')");
          
$order_updated true;
        }
// End Paket Tracking 2.1
        // trigger any appropriate updates which should be sent back to the payment gateway:
        
$order = new order((int)$oID);
        if (
$order->info['payment_module_code']) {
          if (
file_exists(DIR_FS_CATALOG_MODULES 'payment/' $order->info['payment_module_code'] . '.php')) {
            require_once(
DIR_FS_CATALOG_MODULES 'payment/' $order->info['payment_module_code'] . '.php');
            require_once(
DIR_FS_CATALOG_LANGUAGES $_SESSION['language'] . '/modules/payment/' $order->info['payment_module_code'] . '.php');
            
$module = new $order->info['payment_module_code'];
            if (
method_exists($module'_doStatusUpdate')) {
              
$response $module->_doStatusUpdate($oID$status$comments$customer_notified$check_status->fields['orders_status']);
            }
          }
        }

.
.. 


I would be grateful for any help.

greetings
Manfred