PayPal IPN for Easy Export

Joseph McMurry
support@mcmwebsite.com
Donations accepted at above email address using PayPal (USD, no checks)

This modules uses the Holding Orders Contrib to Store PayPal orders separately until payment is confirmed by PayPal IPN. This allows PayPal orders to work better with many export systems, including Stone Edge's Order Manager (this contrib is not by, nor is supported by Stone Edge.) and others.

HOLDING ORDERS FOR OSCOMMERCE

Original version 1.1b by Dave
- Support for this program will be offered via email at support@puddled.co.uk
- Donations kindly accepted at dave@puddled.co.uk (paypal / nochex)

2.1 Updated by vexiphne@hotmail.com
Added block of code for transferring data from HOLDING_ORDERS_PRODUCTS_DOWNLOAD table to ORDERS_PRODUCTS_DOWNLOAD
updated a few blocks of code that are supposed to empty the holding tables but left out the DOWNLOAD table

Updated version 2.0 for MS2.2 compatibility by Carine Bruyndoncx (info@calimeross.com)
V2.0 Changes
- edit admin/held_orders.php and replace tep_array_merge with just array_merge
- edit admin/includes/classes/confirm_held_order uncomment the ip_address field as this is not part of the standard install, alternatively, you could add the field to the orders table and lookup the remainder of the installation instructions for the ip tracking contribution.
- catalog/includes/application_top.php and admin/includes/application_top.php changes need to be applied to the database_tables.php and filenames.php files (standard MS2 file changes)
- correction of filename define for packingslip in instructions
- correction of english and addition of dutch language file

New! in V1.1 version, facility to restore held orders to main orders tables, including all status / status histories / attributes and the like

This package is designed to allow the storing of orders in a holding table, just in case the order is not completed correctly.

All orders in the holding tables are available to edit via the admin console in the same way, normal orders are

This package is still in beta version, so please ensure you have adequate backups in place before attempting to install.

CLEAN INSTALLATION.

BACKUP ALL YOUR FILES AND DATABASE. INSTALL AND TEST IN A DEVELOPMENT DIRECTORY BEFORE MAKING LIVE!!!

1, Run the enclosed sql query on the database to create the required additional tables.

2. Add the following defines to catalog/includes/database_tables.php

define('TABLE_HOLDING_ORDERS', 'holding_orders');
define('TABLE_HOLDING_ORDERS_PRODUCTS', 'holding_orders_products');
define('TABLE_HOLDING_ORDERS_TOTAL', 'holding_orders_total');
define('TABLE_HOLDING_ORDERS_STATUS', 'holding_orders_status');
define('TABLE_HOLDING_ORDERS_PRODUCTS_ATTRIBUTES', 'holding_orders_products_attributes');
define('TABLE_HOLDING_ORDERS_PRODUCTS_DOWNLOAD', 'holding_orders_products_download');
define('TABLE_HOLDING_ORDERS_STATUS_HISTORY', 'holding_orders_status_history');

3.a. Add the following defines to admin/includes/database_tables.php

define('TABLE_HOLDING_ORDERS', 'holding_orders');
define('TABLE_HOLDING_ORDERS_PRODUCTS', 'holding_orders_products');
define('TABLE_HOLDING_ORDERS_TOTAL', 'holding_orders_total');
define('TABLE_HOLDING_ORDERS_STATUS', 'holding_orders_status');
define('TABLE_HOLDING_ORDERS_PRODUCTS_ATTRIBUTES', 'holding_orders_products_attributes');
define('TABLE_HOLDING_ORDERS_PRODUCTS_DOWNLOAD', 'holding_orders_products_download');
define('TABLE_HOLDING_ORDERS_STATUS_HISTORY', 'holding_orders_status_history');

3.b. Add the following defines to admin/includes/filenames.php

DEFINE('FILENAME_HELD_ORDERS', 'held_orders.php');
define('FILENAME_HELD_ORDERS_INVOICE', 'invoice.php');
define('FILENAME_HELD_ORDERS_PACKINGSLIP', 'packingslip.php');

4. Open admin/includes/boxes/customers.php

and add the following before the last '<a href statement

'<a href="' . tep_href_link(FILENAME_HELD_ORDERS, '', 'NONSSL') . '" class="menuBoxContentLink">Held Orders</a><br>' .

5. Upload (if you're not using a stock/unmodified osCommerce store, be careful overwritting existing files, especial the checkout ones) all the files enclosed in the zip file to their respective directories.

6)

In includes/application_top.php add the following before the final ?>

if (tep_session_is_registered('held_order'))
{
// Check if the user is in the checkout area
$oscTestForCheckout_url = strtoupper($_SERVER['PHP_SELF']);
$findString = "CHECKOUT";
$pos = strpos($oscTestForCheckout_url, $findString);

if ($pos == 0)
{
// If not, then delete this held order. It has been abandoned by the user.
tep_db_query("delete from " . TABLE_HOLDING_ORDERS . " where orders_id = '" . $held_order . "'");
tep_db_query("delete from " . TABLE_HOLDING_ORDERS_PRODUCTS . " where orders_id = '" . $held_order . "'");
tep_db_query("delete from " . TABLE_HOLDING_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . $held_order . "'");
tep_db_query("delete from " . TABLE_HOLDING_ORDERS_PRODUCTS_DOWNLOAD . " where orders_id = '" . $held_order . "'");
tep_db_query("delete from " . TABLE_HOLDING_ORDERS_STATUS_HISTORY . " where orders_id = '" . $held_order . "'");
tep_db_query("delete from " . TABLE_HOLDING_ORDERS_TOTAL . " where orders_id = '" . $held_order . "'");
tep_session_unregister('held_order');
}
}



Released under the GNU General Public License This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License published by the Free Software Foundation; You may not change or alter any portion of this comment or credits of supporting developers from this source code or any supporting source code which is considered copyrighted (c) material of the original comment or credit authors. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (see gpl-2.0.txt)