Instructions for editing orders.php

----------------------------------------------------------------------------
1.a YOUR_ZENCART_FOLDER/admin/orders.php                            LINE 592 (614 for 1.3.9h)
==============================
REPLACE:

   <td valign="top"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
          </tr>
        </table></td>

WITH:

            <td valign="top"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
            <!-- googlecheckout Tracking Number -->
<?php
// orders_status == STATE_PROCESSING -> Processing before delivery
    if($order->info['payment_module_code'] == 'googlecheckout' && $order->info['orders_status'] == GC_STATE_PROCESSING){
            echo '<td><table border="0" cellpadding="3" cellspacing="0" width="100%">  
                <tbody>
                    <tr> 
                        <td style="border-top: 2px solid rgb(255, 255, 255); border-right: 2px solid rgb(255, 255, 255);" nowrap="nowrap" colspan="2">
                                <b>Shipping Information</b> 
                        </td> 
                    </tr>
                    <tr> 
                        <td nowrap="nowrap" valign="middle" width="1%"> 
                            <font size="2"> 
                                <b>Tracking:</b> 
                            </font> 
                        </td> 
                        <td style="border-right: 2px solid rgb(255, 255, 255); border-bottom: 2px solid rgb(255, 255, 255);" nowrap="nowrap">  
                            <input name="tracking_number" style="color: rgb(0, 0, 0);" id="trackingBox" size="20" type="text">  
                        </td> 
                    </tr> 
                    <tr> 
                        <td nowrap="nowrap" valign="middle" width="1%"> 
                            <font size="2"> 
                                <b>Carrier:</b> 
                            </font> 
                        </td> 
                        <td style="border-right: 2px solid rgb(255, 255, 255);" nowrap="nowrap"> 
               <select name="carrier_select" style="color: rgb(0, 0, 0);" id="carrierSelect"> 
                                 <option style="color: rgb(111, 111, 111);" selected="" value="select">Carrier...</option>
                 <option style="color: rgb(0, 0, 0);" value="DHL">DHL</option>
                 <option style="color: rgb(0, 0, 0);" value="FedEx">FedEx</option>
                 <option style="color: rgb(0, 0, 0);" value="UPS">UPS</option>
                 <option style="color: rgb(0, 0, 0);" value="UPS Mail Innovations">UPS Mail Innovations</option>
                 <option style="color: rgb(0, 0, 0);" value="USPS">USPS</option>
                 <option style="color: rgb(0, 0, 0);" value="Other">Other</option>
                            </select> 
                        </td> 
                    </tr>    
                </tbody>
            </table></td>';

    }
?>
<!-- end googlecheckout Tracking Number -->
          </tr>
        </table></td>


----------------------------------------------------------------------------
1.b YOUR_ZENCART_FOLDER/admin/orders.php                             LINE 94 - 95
============================================================================
REPLACE:

        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 . "'");

          $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 = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" .
          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);

          $customer_notified = '0';
          if (isset($_POST['notify']) && ($_POST['notify'] == 'on')) {
            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';

            //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');
            }
          }

          $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;
        }

WITH:


        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 . "'");

// ** GOOGLE CHECKOUT **
          chdir("./..");
          require_once(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/googlecheckout.php');
          $payment_value= MODULE_PAYMENT_GOOGLECHECKOUT_TEXT_TITLE;
          $result = $db->Execute("select google_order_number from google_orders where orders_id= ". (int)$oID);
          $num_rows = $result->RecordCount();

          if($num_rows != 0) {
            $customer_notified = google_checkout_state_change($check_status, $status, $oID,
                               (@$_POST['notify']=='on'?1:0),
                               (@$_POST['notify_comments']=='on'?$comments:''));
          }
          $customer_notified = isset($customer_notified)?$customer_notified:'0';
// ** END GOOGLE CHECKOUT **
          if (isset($_POST['notify']) && ($_POST['notify'] == 'on')) {
            $notify_comments = '';
            if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on') && zen_not_null($comments)) {
              $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n";
            }
// ** GOOGLE CHECKOUT **
            $force_email = false;
            if($num_rows != 0 && (strlen(htmlentities(strip_tags($notify_comments))) > GOOGLE_MESSAGE_LENGTH && MODULE_PAYMENT_GOOGLECHECKOUT_USE_CART_MESSAGING == 'True')) {
              $force_email = true;
              $messageStack->add_session(GOOGLECHECKOUT_WARNING_SYSTEM_EMAIL_SENT, 'warning');         
            }
            $message = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" .
            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);

            if($num_rows == 0 || $force_email) {
  //send emails, not a google order or configured to use both messaging systems
                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';
    //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');
              $messageStack->add_session(GOOGLECHECKOUT_SUCCESS_SEND_ADMIN_COPY_EMAIL, 'success');   
            }
// ** END GOOGLE CHECKOUT **
          }

          $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;
        }