About this Plug-in

Contents of Installation and Configuration Guide

  1. Introduction
  2. Pre-Requisites
  3. Installation: Existing osCommerce v2.2 RC2 installation and fresh FBA plug-in
  4. Important Links

Introduction

The Fulfillmet By Amazon Plug-in v1.0 for osCommerce v2.2 RC2 supports the following features

  1. Creates fulfillment order through your osCommerce admin portal. If the order is available at your Amazon stock you can invoke the shipment.
  2. You can also see your inventory on your Amazon stock in your osCommerce admin.

Pre-Requisites

To use this plug-in, you must have pre-installed the following software and account:

Installation: Existing osCommerce v2.2 RC2 installation and fresh FBA Plug-in

Please follow the steps below to install the FBA Plug-in for the first time, if you have an existing installation of osCommerce v2.2 RC2 which is modified according to your requirements. Otherwise please install osCommerce system first.

  1. Backup
  2. If you have customized osCommerce according to your needs or if you have other modules installed on your osCommerce installation, replacing files might break your existing installation. Please follow the steps below to modify an existing installation to support Fulfillment by Amazon. You will need to install few new files and modify a few existing osCommerce files. Before installing the Fulfillment by Amazon osCommerce Plugin v1.0, it is highly recommended to backup your existing osCommerce installation and database. The Fulfillment by Amazon osCommerce plugin v1.0 will not add tables to your database when it is installed in the admin UI.

  3. FBA Plug-in Files to be manually edited

    1. Modifications to new_files/Amazon/.config.inc.php
    2. The following code has to be changed with regards to your AWS account

      Modify, ~line 9-10:

      CODE BEFORE MODIFICATION
       define('AWS_ACCESS_KEY_ID', '<Your Access Key ID>');
      define('AWS_SECRET_ACCESS_KEY', '<Your Secret Access Key>');

  4. Directory to be copied
    1. new_files/Amazon to catalog/admin/

  5. Files to be copied (All files should be copied)
    1. new_files/ to catalog/admin/
    2. new_files/ to catalog/admin/includes/boxes/
    3. new_files/languages/german/ to catalog/admin/includes/languages/german/
    4. new_files/languages/german/images/ to catalog/admin/includes/languages/german/images/buttons
  6. Files to be manually edited or to be copied, if you didn't modify your osCommerce configuration

    The following files should be manually edited. Please follow the instructions below for details regarding specific files.
    You can also copy the files from modified_files/ in your specific directory in your osCommerce system.

          catalog/admin/includes/
            1. column_left.php
            2. filenames.php

          catalog/admin/includes/languages/ PLEASE CHOOSE YOUR LANGUAGE. (E.G. WITH GERMAN)
            3. german.php

          catalog/admin/includes/languages/ PLEASE CHOOSE YOUR LANGUAGE. (E.G. WITH GERMAN) /
            4. orders.php

          catalog/admin/
            5. orders.php

          catalog/admin/includes/classes/
            6. order.php

    1. Modifications to "catalog/admin/includes/column_left.php"
    2. The following code has to be added to catalog/admin/includes/column_left.php

      Add, ~line 20:

      CODE BEFORE ADDITION
        require(DIR_WS_BOXES . 'configuration.php');
      require(DIR_WS_BOXES . 'catalog.php');
      require(DIR_WS_BOXES . 'modules.php');
      require(DIR_WS_BOXES . 'customers.php');
      require(DIR_WS_BOXES . 'taxes.php');
      require(DIR_WS_BOXES . 'localization.php');
      require(DIR_WS_BOXES . 'reports.php');
      require(DIR_WS_BOXES . 'tools.php');
      CODE TO BE ADDED
        require(DIR_WS_BOXES . 'amazon.php');
      CODE AFTER ADDITION
        require(DIR_WS_BOXES . 'configuration.php');
      require(DIR_WS_BOXES . 'catalog.php');
      require(DIR_WS_BOXES . 'modules.php');
      require(DIR_WS_BOXES . 'customers.php');
      require(DIR_WS_BOXES . 'taxes.php');
      require(DIR_WS_BOXES . 'localization.php');
      require(DIR_WS_BOXES . 'reports.php'); require(DIR_WS_BOXES . 'amazon.php');
      require(DIR_WS_BOXES . 'tools.php');

    3. Modifications to catalog/admin/includes/filenames.php
    4. The following code has to be added to catalog/admin/includes/filenames.php

      Add, ~line 15:

      CODE BEFORE ADDITION
      // define the filenames used in the project
      define('FILENAME_ADMINISTRATORS', 'administrators.php');
      define('FILENAME_BACKUP', 'backup.php');
      define('FILENAME_BANNER_MANAGER', 'banner_manager.php');
      CODE TO BE ADDED
        define('FILENAME_AMAZON_STOCK','amazon_stock.php');
        define('FILENAME_AMAZON_FULFILLMENTORDER','amazon_fulfillmentorder.php');
      define('FILENAME_AMAZON_SHIPMENT','amazon_shipment.php');
      CODE AFTER ADDITION
      // define the filenames used in the project
      define('FILENAME_ADMINISTRATORS', 'administrators.php');
      define('FILENAME_AMAZON_STOCK','amazon_stock.php'); define('FILENAME_AMAZON_FULFILLMENTORDER','amazon_fulfillmentorder.php');
      define('FILENAME_AMAZON_SHIPMENT','amazon_shipment.php');
      define('FILENAME_BACKUP', 'backup.php');
      define('FILENAME_BANNER_MANAGER', 'banner_manager.php');

    5. Modifications to catalog/admin/languages/PLEASE CHOOSE YOUR LANGUAGE. (E.G. WITH GERMAN).php
    6. The following code has to be added to catalog/admin/languages/PLEASE CHOOSE YOUR LANGUAGE. (E.G. WITH GERMAN).php

       Add, ~line 99:

      CODE BEFORE ADDITION
      // reports box text in includes/boxes/reports.php
        define('BOX_HEADING_REPORTS', 'Berichte');
      define('BOX_REPORTS_PRODUCTS_VIEWED', 'besuchte Artikel');
      define('BOX_REPORTS_PRODUCTS_PURCHASED', 'gekaufte Artikel');
      define('BOX_REPORTS_ORDERS_TOTAL', 'Kunden-Bestellstatistik'); // tools text in includes/boxes/tools.php
      define('BOX_HEADING_TOOLS', 'Hilfsprogramme');
      define('BOX_TOOLS_BACKUP', 'Datenbanksicherung');
      define('BOX_TOOLS_BANNER_MANAGER', 'Banner Manager');
      define('BOX_TOOLS_CACHE', 'Cache Steuerung');
      CODE TO BE ADDED
      // reports box text in includes/boxes/amazon.php
      define('BOX_HEADING_AMAZON', 'Amazon');
      define('BOX_AMAZON_STOCK', 'Lagerbestand'); define('BOX_AMAZON_FULFILLMENTORDER', 'Fulfillmentauftr&auml;ge');
      CODE AFTER ADDITION
      // reports box text in includes/boxes/reports.php
        define('BOX_HEADING_REPORTS', 'Berichte');
      define('BOX_REPORTS_PRODUCTS_VIEWED', 'besuchte Artikel');
      define('BOX_REPORTS_PRODUCTS_PURCHASED', 'gekaufte Artikel');
      define('BOX_REPORTS_ORDERS_TOTAL', 'Kunden-Bestellstatistik'); // reports box text in includes/boxes/amazon.php
      define('BOX_HEADING_AMAZON', 'Amazon');
      define('BOX_AMAZON_STOCK', 'Lagerbestand'); define('BOX_AMAZON_FULFILLMENTORDER', 'Fulfillmentauftr&auml;ge'); // tools text in includes/boxes/tools.php
      define('BOX_HEADING_TOOLS', 'Hilfsprogramme');
      define('BOX_TOOLS_BACKUP', 'Datenbanksicherung');
      define('BOX_TOOLS_BANNER_MANAGER', 'Banner Manager');
      define('BOX_TOOLS_CACHE', 'Cache Steuerung');

      Add, ~line 230:

      CODE BEFORE ADDITION
        define('IMAGE_ORDERS_INVOICE', 'Rechnung');
      define('IMAGE_ORDERS_PACKINGSLIP', 'Lieferschein');
      define('IMAGE_PREVIEW', 'Vorschau');
      define('IMAGE_RESET', 'Zur&uuml;cksetzen');
      CODE TO BE ADDED
        define('IMAGE_ORDERS_AMAZON', 'Fulfillment by Amazon');
        define('IMAGE_SHIPMENT_CONFIRM', 'Versand best&auml;tigen');
      CODE AFTER ADDITION
        define('IMAGE_ORDERS_INVOICE', 'Rechnung');
      define('IMAGE_ORDERS_PACKINGSLIP', 'Lieferschein');
      define('IMAGE_ORDERS_AMAZON', 'Fulfillment by Amazon'); define('IMAGE_SHIPMENT_CONFIRM', 'Versand best&auml;tigen');
      define('IMAGE_PREVIEW', 'Vorschau');
      define('IMAGE_RESET', 'Zur&uuml;cksetzen');

    7. Modifications to catalog/admin/includes/languages/ PLEASE CHOOSE YOUR LANGUAGE. (E.G. WITH GERMAN) /orders.php
    8. The following code has to be added to catalog/admin/includes/includes/ PLEASE CHOOSE YOUR LANGUAGE. (E.G. WITH GERMAN) /orders.php

      Add, ~line 35:

      CODE BEFORE ADDITION
        define('TABLE_HEADING_CUSTOMER_NOTIFIED', 'Kunde benachrichtigt');
      define('TABLE_HEADING_DATE_ADDED', 'hinzugef&uuml;gt am:');
      CODE TO BE ADDED
        define('TABLE_HEADING_SHIPMENT_AMAZON', 'Versand durch Amazon');
      CODE AFTER ADDITION
        define('TABLE_HEADING_CUSTOMER_NOTIFIED', 'Kunde benachrichtigt');
      define('TABLE_HEADING_DATE_ADDED', 'hinzugef&uuml;gt am:');
      define('TABLE_HEADING_SHIPMENT_AMAZON', 'Versand durch Amazon');

    9. Modifications to catalog/admin/orders.php
    10. The following code has to be added to catalog/admin/orders.php

      Add, ~line 15:

      CODE BEFORE ADDITION
      require('includes/application_top.php');
      
      require(DIR_WS_CLASSES . 'currencies.php');
      $currencies = new currencies(); 
      CODE TO BE ADDED
      include_once ('Amazon/functions.inc.php');
      CODE AFTER ADDITION
      require('includes/application_top.php');
      
      include_once ('Amazon/functions.inc.php');
      
      require(DIR_WS_CLASSES . 'currencies.php');
      $currencies = new currencies(); 

      Add, ~line 30:

      CODE BEFORE ADDITION
      $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '')
      
      if (tep_not_null($action)) {
        switch ($action) {
      CODE TO BE ADDED
      $amazon = (isset($HTTP_GET_VARS['amazon']) ? $HTTP_GET_VARS['amazon'] : '');
      CODE AFTER ADDITION
      $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '')
      $amazon = (isset($HTTP_GET_VARS['amazon']) ? $HTTP_GET_VARS['amazon'] : '');
      
      if (tep_not_null($action)) {
        switch ($action) {

      Add, ~line 35:

      CODE BEFORE ADDITION
      if (tep_not_null($action)) {
        switch ($action) {
          case 'update_order':
              $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
      $status = tep_db_prepare_input($HTTP_POST_VARS['status']);
      $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
      CODE TO BE ADDED
      if ($amazon == 'confirm'){
      $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
      $status = tep_db_prepare_input('3');
      $comments = tep_db_prepare_input(TABLE_HEADING_SHIPMENT_AMAZON);

      include_once ('Amazon/functions.inc.php');

      //Array with all MerchantSKU's for every item in order
      $array = array (); $order = new order($oID);

      for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $array[] = $order->products[$i]['products_id'];

      }

      $MerchantSKUArray = array ('MerchantSKU' => $array,
      'ResponseGroup' => 'Basic');

      $requestInventory = new Amazon_FWSInventory_Model_GetInventorySupplyRequest($MerchantSKUArray);

      //OrderItem buildup
      $orderItems = array();

      for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $CreateFulfillmentOrderItem = new Amazon_FWSOutbound_Model_CreateFulfillmentOrderItem();
      $CreateFulfillmentOrderItem->setMerchantSKU($order->products[$i]['products_id']);
      $CreateFulfillmentOrderItem->setMerchantFulfillmentOrderItemId($order->products[$i]['orders_products_id']);
      $CreateFulfillmentOrderItem->setQuantity($order->products[$i]['qty']);
      $orderItems[$i] = $CreateFulfillmentOrderItem;

      }

      //true, if order is avaiable at amazon
      $available = invokeGetInventorySupply($serviceInventory, $requestInventory, $orderItems);

      //CreateFulfillmentOrder request
      $requestOrder = new Amazon_FWSOutbound_Model_CreateFulfillmentOrder();
      $requestOrder->setMerchantFulfillmentOrderId($order->products[0]['orders_id']);
      $requestOrder->setDisplayableOrderId($order->products[0]['orders_id']);
      $requestOrder->setDisplayableOrderDateTime(date("c"));
      $requestOrder->setDisplayableOrderComment("Danke für Ihre Bestellung!");
      $requestOrder->setShippingSpeedCategory("Standard");

      //Address buildup
      $Address = new Amazon_FWSOutbound_Model_Address();
      $Address->setName($order->delivery['delivery_name']);
      $Address->setLine1($order->delivery['delivery_street_address']);
      $Address->setLine2($order->delivery['delivery_suburb']);
      $Address->setCity($order->delivery['delivery_city']);
      $Address->setStateOrProvinceCode($order->delivery['delivery_state']);
      $Address->setPostalCode($order->delivery['delivery_postcode']);
      $Address->setCountryCode("DE");
      $Address->setPhoneNumber($order->customer['telephone']);
      $requestOrder->setDestinationAddress($Address);

      $requestOrder->setItem($orderItems);

      invokeCreateFulfillmentOrder($serviceOutbound, $requestOrder);
      }

      else {

      $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
      if ($amazon == 'confirm'){
      $status = tep_db_prepare_input(3);
      }
      else {
      $status = tep_db_prepare_input($HTTP_POST_VARS['status']);
      }
      $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
      }
      CODE AFTER ADDITION
      if (tep_not_null($action)) {
        switch ($action) {
          case 'update_order':
      
            if ($amazon == 'confirm'){
      $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
      $status = tep_db_prepare_input('3');
      $comments = tep_db_prepare_input(TABLE_HEADING_SHIPMENT_AMAZON);

      include_once ('Amazon/functions.inc.php');

      //Array with all MerchantSKU's for every item in order
      $array = array (); $order = new order($oID);

      for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $array[] = $order->products[$i]['products_id'];

      }

      $MerchantSKUArray = array ('MerchantSKU' => $array,
      'ResponseGroup' => 'Basic');

      $requestInventory = new Amazon_FWSInventory_Model_GetInventorySupplyRequest($MerchantSKUArray);

      //OrderItem buildup
      $orderItems = array();

      for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $CreateFulfillmentOrderItem = new Amazon_FWSOutbound_Model_CreateFulfillmentOrderItem();
      $CreateFulfillmentOrderItem->setMerchantSKU($order->products[$i]['products_id']);
      $CreateFulfillmentOrderItem->setMerchantFulfillmentOrderItemId($order->products[$i]['orders_products_id']);
      $CreateFulfillmentOrderItem->setQuantity($order->products[$i]['qty']);
      $orderItems[$i] = $CreateFulfillmentOrderItem;

      }

      //true, if order is avaiable at amazon
      $available = invokeGetInventorySupply($serviceInventory, $requestInventory, $orderItems);

      //CreateFulfillmentOrder request
      $requestOrder = new Amazon_FWSOutbound_Model_CreateFulfillmentOrder();
      $requestOrder->setMerchantFulfillmentOrderId($order->products[0]['orders_id']);
      $requestOrder->setDisplayableOrderId($order->products[0]['orders_id']);
      $requestOrder->setDisplayableOrderDateTime(date("c"));
      $requestOrder->setDisplayableOrderComment("Danke für Ihre Bestellung!");
      $requestOrder->setShippingSpeedCategory("Standard");

      //Address buildup
      Address = new Amazon_FWSOutbound_Model_Address();
      $Address->setName($order->delivery['delivery_name']);
      $Address->setLine1($order->delivery['delivery_street_address']);
      $Address->setLine2($order->delivery['delivery_suburb']);
      $Address->setCity($order->delivery['delivery_city']);
      $Address->setStateOrProvinceCode($order->delivery['delivery_state']); $Address->setPostalCode($order->delivery['delivery_postcode']); $Address->setCountryCode("DE");
      $Address->setPhoneNumber($order->customer['telephone']);
      $requestOrder->setDestinationAddress($Address);

      $requestOrder->setItem($orderItems);

      invokeCreateFulfillmentOrder($serviceOutbound($requestOrdest);
      }

      else {

      $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
      if ($amazon == 'confirm'){
      $status = tep_db_prepare_input(3);
      }
      else {
      $status = tep_db_prepare_input($HTTP_POST_VARS['status']);
      }
      $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
      }

      Add, ~line 126:

      CODE BEFORE ADDITION
      $customer_notified = '0';
      if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
      $notify_comments = ''; if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) { $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n"; } $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]); tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); $customer_notified = '1'; } tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); $order_updated = true;
      CODE TO BE ADDED
      if ($amazon == 'confirm'){
        	$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, 'Amazon mit Versand beauftragt.') . "\n\n";
      		$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n"
                    . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 
                    'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' 
                    . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments 
                    . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
      
           tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, 
                    $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
      
           $customer_notified = '1';
      }
      else {
         if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
            $notify_comments = '';
            if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {
           	$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
            }
      
            $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" 
                     . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 
                     'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' 
                     . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments 
                     . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
      
            tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, 
                     $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
      
            $customer_notified = '1';
         }
      }
      tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, 
                    customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', 
                    now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "')");
      CODE AFTER ADDITION
      $customer_notified = '0';
      
      
      if ($amazon == 'confirm'){
        	$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, 'Amazon mit Versand beauftragt.') . "\n\n";
      		$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n"
                    . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 
                    'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' 
                    . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments 
                    . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
      
           tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, 
                    $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
      
           $customer_notified = '1';
      }
      else {
         if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
            $notify_comments = '';
            if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {
           	$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
            }
      
            $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" 
                     . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 
                     'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' 
                     . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments 
                     . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
      
            tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, 
                     $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
      
            $customer_notified = '1';
         }
      }
      tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, 
                    customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', 
                    now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "')");
      
      $order_updated = true;
      

      Add, ~line 389:

      CODE BEFORE ADDITION
      <tr>
      <td class="main"><br><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>
      </tr>
      <tr>
      <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
      </tr>
      <tr><?php echo tep_draw_form('status', FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=update_order'); ?>
      <td class="main"><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
      </tr>
      <tr>
      <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
      <tr>
      <td><table border="0" cellspacing="0" cellpadding="2">
      <tr>
      <td><table border="0" cellspacing="0" cellpadding="2">
      <tr>
      <td class="main"><b><?php echo ENTRY_STATUS; ?></b> <?php echo tep_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']); ?></td>
      </tr>
      <tr>
      <td class="main"><b><?php echo ENTRY_NOTIFY_CUSTOMER; ?></b> <?php echo tep_draw_checkbox_field('notify', '', true); ?></td>
      <td class="main"><b><?php echo ENTRY_NOTIFY_COMMENTS; ?></b> <?php echo tep_draw_checkbox_field('notify_comments', '', true); ?></td>
      </tr>
      </table></td>
      <td valign="top"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
      </tr>
      </table></td>
      </form></tr>
      CODE AFTER ADDITION
      <tr>
      <td class="main"><br><b><?php $check_status_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = " . (int)$oID . " and comments = 'Versand durch Amazon'"); $check_status = tep_db_fetch_array($check_status_query); if ( ($check_status['comments'] == 'Versand durch Amazon') || tep_not_null($check_status)){
      echo ENTRY_STATUS . "</b> Versand bereits eingeleitet. ";
      }
      else{
      echo TABLE_HEADING_COMMENTS . "</b> </td> </tr>
      <tr>
      <td>" . tep_draw_separator('pixel_trans.gif', '1', '5') . "</td>
      </tr>
      <tr>" . tep_draw_form('status', FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=update_order') . "
      <td class=\"main\">" . tep_draw_textarea_field('comments', 'soft', '60', '5') . "</td>
      </tr>
      <tr>
      <td>" . tep_draw_separator('pixel_trans.gif', '1', '10') . "</td>
      </tr>
      <tr>
      <td><table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
      <tr>
      <td><table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
      <tr>
      <td class=\"main\"><b>" . ENTRY_STATUS . "</b>" . tep_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']) . "</td>
      </tr>
      <tr>
      <td class=\"main\"><b>" . ENTRY_NOTIFY_CUSTOMER . "</b> " . tep_draw_checkbox_field('notify', '', true) . "</td>
      <td class=\"main\"><b>" . ENTRY_NOTIFY_COMMENTS . "</b> " . tep_draw_checkbox_field('notify_comments', '', true) . "</td>
      </tr>
      </table></td>
      <td valign=\"top\">" . tep_image_submit('button_update.gif', IMAGE_UPDATE); } ?> </td>
      </tr>
      </table></td>
      </form></tr>

      Add, ~line 428:

      CODE BEFORE ADDITION
      <tr>
        <td colspan="2" align="right"><?php  echo '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' 
         . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">'        . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) 
         . '</a><a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">'         
         . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>         <a href="' 
         . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">'         
         . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>';  ?></td>
      </tr>
      CODE TO BE ADDED
      <?php echo '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">'        
                 . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a>         ';   
      
      //Array with all MerchantSKU's for every item in order
      $array = array ();

      for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $array[] = $order->products[$i]['products_id'];

      } $MerchantSKUArray = array ('MerchantSKU' => $array,
      'ResponseGroup' => 'Basic'); $requestInventory = new Amazon_FWSInventory_Model_GetInventorySupplyRequest($MerchantSKUArray); //OrderItem buildup
      $orderItems = array(); for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $CreateFulfillmentOrderItem = new Amazon_FWSOutbound_Model_CreateFulfillmentOrderItem();
      $CreateFulfillmentOrderItem->setMerchantSKU($order->products[$i]['products_id']);
      $CreateFulfillmentOrderItem->setMerchantFulfillmentOrderItemId($order->products[$i]['orders_products_id']);
      $CreateFulfillmentOrderItem->setQuantity($order->products[$i]['qty']);
      $orderItems[$i] = $CreateFulfillmentOrderItem;

      } //hide the button amazon_shipment_confirm if products aren't in the amazon stock
      if (invokeGetInventorySupply($serviceInventory, $requestInventory, $orderItems) && $order->info['orders_status'] != 3) { echo '<a href="' . tep_href_link(FILENAME_AMAZON_SHIPMENT, 'oID=' . $HTTP_GET_VARS['oID']) . '">' . tep_image_button('button_amazon.gif', IMAGE_ORDERS_AMAZON) . '</a> ';
      }

      echo '<a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>';
      ?>
      CODE AFTER ADDITION
      <tr>
        <td colspan="2" align="right">
      
        <?php echo '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">'        
                   . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a>         ';   
      
      //Array with all MerchantSKU's for every item in order
      $array = array ();

      for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $array[] = $order->products[$i]['products_id'];

      } $MerchantSKUArray = array ('MerchantSKU' => $array,
      'ResponseGroup' => 'Basic'); $requestInventory = new Amazon_FWSInventory_Model_GetInventorySupplyRequest($MerchantSKUArray); //OrderItem buildup
      $orderItems = array(); for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $CreateFulfillmentOrderItem = new Amazon_FWSOutbound_Model_CreateFulfillmentOrderItem();
      $CreateFulfillmentOrderItem->setMerchantSKU($order->products[$i]['products_id']);
      $CreateFulfillmentOrderItem->setMerchantFulfillmentOrderItemId($order->products[$i]['orders_products_id']);
      $CreateFulfillmentOrderItem->setQuantity($order->products[$i]['qty']);
      $orderItems[$i] = $CreateFulfillmentOrderItem;

      } //hide the button amazon_shipment_confirm if products aren't in the amazon stock
      if (invokeGetInventorySupply($serviceInventory, $requestInventory, $orderItems) && $order->info['orders_status'] != 3) { echo '<a href="' . tep_href_link(FILENAME_AMAZON_SHIPMENT, 'oID=' . $HTTP_GET_VARS['oID']) . '">' . tep_image_button('button_amazon.gif', IMAGE_ORDERS_AMAZON) . '</a> ';
      }

      echo '<a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>';
      ?>
      </td> </tr>

      Add, ~line 553:

      CODE BEFORE ADDITION
      $contents[] = array('align' => 'center', 'text' => 
       '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' 
        . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> 
        <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' 
        . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>');
      
      $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased));  
      CODE TO BE ADDED
      //Array with all MerchantSKU's for every item in order
      $array = array (); $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
      $order = new order($oID); for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $array[] = $order->products[$i]['products_id'];

      } $MerchantSKUArray = array ('MerchantSKU' => $array,
      'ResponseGroup' => 'Basic'); $requestInventory = new Amazon_FWSInventory_Model_GetInventorySupplyRequest($MerchantSKUArray); //OrderItem buildup
      $orderItems = array();
      $products_query_raw = "select products_id, orders_products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $oInfo->orders_id . "'";
      $products_query = tep_db_query($products_query_raw);
      while ($products = tep_db_fetch_array($products_query)) { $CreateFulfillmentOrderItem = new Amazon_FWSOutbound_Model_CreateFulfillmentOrderItem();
      $CreateFulfillmentOrderItem->setMerchantSKU($products['products_id']);
      $CreateFulfillmentOrderItem->setMerchantFulfillmentOrderItemId($products['orders_products_id']);
      $CreateFulfillmentOrderItem->setQuantity($products['products_quantity']);
      $orderItems[] = $CreateFulfillmentOrderItem; } $status_sql = "select orders_status from " . TABLE_ORDERS . " where orders_id = '" . $oInfo->orders_id . "'";
      $status_query = mysql_query($status_sql) or die(mysql_error());
      while($status_result = mysql_fetch_assoc($status_query))
      {
      $status = $status_result['orders_status'];
      } //hide the button amazon_shipment_confirm if products aren't in the amazon stock
      if (invokeGetInventorySupply($serviceInventory, $requestInventory, $orderItems) && $status != 3) {
      $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_AMAZON_SHIPMENT, 'oID=' . $oInfo->orders_id) . '">' . tep_image_button('button_amazon.gif', IMAGE_ORDERS_AMAZON) . '</a>');
      }
      CODE AFTER ADDITION
      $contents[] = array('align' => 'center', 'text' => 
       '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' 
        . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> 
        <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' 
        . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>');
      
      //Array with all MerchantSKU's for every item in order
      $array = array (); $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
      $order = new order($oID); for ($i=0, $n=sizeof($order->products); $i<$n; $i ) {

      $array[] = $order->products[$i]['products_id'];

      } $MerchantSKUArray = array ('MerchantSKU' => $array,
      'ResponseGroup' => 'Basic'); $requestInventory = new Amazon_FWSInventory_Model_GetInventorySupplyRequest($MerchantSKUArray); //OrderItem buildup
      $orderItems = array();
      $products_query_raw = "select products_id, orders_products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $oInfo->orders_id . "'";
      $products_query = tep_db_query($products_query_raw);
      while ($products = tep_db_fetch_array($products_query)) { $CreateFulfillmentOrderItem = new Amazon_FWSOutbound_Model_CreateFulfillmentOrderItem();
      $CreateFulfillmentOrderItem->setMerchantSKU($products['products_id']);
      $CreateFulfillmentOrderItem->setMerchantFulfillmentOrderItemId($products['orders_products_id']);
      $CreateFulfillmentOrderItem->setQuantity($products['products_quantity']);
      $orderItems[] = $CreateFulfillmentOrderItem; } $status_sql = "select orders_status from " . TABLE_ORDERS . " where orders_id = '" . $oInfo->orders_id . "'";
      $status_query = mysql_query($status_sql) or die(mysql_error());
      while($status_result = mysql_fetch_assoc($status_query))
      {
      $status = $status_result['orders_status'];
      } //hide the button amazon_shipment_confirm if products aren't in the amazon stock
      if (invokeGetInventorySupply($serviceInventory, $requestInventory, $orderItems) && $status != 3) {
      $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_AMAZON_SHIPMENT, 'oID=' . $oInfo->orders_id) . '">' . tep_image_button('button_amazon.gif', IMAGE_ORDERS_AMAZON) . '</a>');
      } $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased));

    11. Modifications to catalog/admin/includes/classes/order.php
    12. The following code has to be added to catalog/admin/includes/classes/order.php

      Add, ~line 80-87:

      CODE BEFORE ADDITION
      &orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, 
        products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " 
        where orders_id = '" . (int)$order_id . "'");
      while ($orders_products = tep_db_fetch_array($orders_products_query)) {
      $this->products[$index] = array('qty' => $orders_products['products_quantity'],
      'name' => $orders_products['products_name'],
      'model' => $orders_products['products_model'],
      'tax' => $orders_products['products_tax'],
      'price' => $orders_products['products_price'],
      'final_price' => $orders_products['final_price']);
      CODE AFTER ADDITION
      &orders_products_query = tep_db_query("select products_id, orders_products_id, orders_id, products_name, products_model, 
        products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " 
        where orders_id = '" . (int)$order_id . "'");
      while ($orders_products = tep_db_fetch_array($orders_products_query)) {
      $this->products[$index] = array('products_id' => $orders_products['products_id'], 'orders_products_id' => $orders_products['orders_products_id'],
      'orders_id' => $orders_products['orders_id'], 'qty' => $orders_products['products_quantity'],
      'name' => $orders_products['products_name'],
      'model' => $orders_products['products_model'],
      'tax' => $orders_products['products_tax'],
      'price' => $orders_products['products_price'],
      'final_price' => $orders_products['final_price']);

                           

  1. osCommerce Website
  2. Amazon.de - Warehousing and Fulfillment
  3. Amazon Fulfillment Web Services
  4. FBA Plug-in for osCommerce Download
  5. Project Documentation (German)
  6. Institute for Information Systems in Saarbrücken
  7. German Research Center for Artificial Intelligence