IPB

HomeProject WebsiteTeam Members

Welcome Guest ( Log In | Register )

5 Pages V   1 2 3 > »   
Reply to this topicStart new topic
> [CONTRIBUTION]Protx Direct / SagePay Direct
tomh
post Nov 24 2008, 11:46 PM
Post #1


Development Team
Group Icon

Group: Team Member
Posts: 594
Joined: 7-August 07
From: Wales
Member No.: 25



File Name: Protx Direct / SagePay Direct
File Submitter: tomh
File Submitted: 25 Nov 2008
File Updated: 29 May 2009
File Category: Payment Methods

This module is an updated version of the Protx Direct module for osCommerce (last version was v4.4). The most important feature of this version is a major improvement in the customer experience of the payment process. This version uses the open source jQuery and Thickbox packages to bring a "Web 2.0" AJAX interface to the payment process, with a noticeable improvement particularly with the 3D-Secure phase of the process.
The module has been carefully developed to retain compatibility with JavaScript disabled in the customer's browser, albeit with a more clunky interface.

Changes since v4.4
  • Catalog Side:
    • Card payment fields moved from checkout_payment.php to checkout_confirmation.php for increased security
    • Start date and issue number fields hidden unless Maestro or Solo card types are selected
    • CVV help popup now in a "ThickBox" window
    • Upon clicking "Confirm" a "ThickBox" window appears in a new layer overlying checkout_confirmation.php. The remainder of the payment process including the 3D-Secure (Verified By Visa / MasterCard SecureCode) takes place in this layer
    • Checks for a successful transaction before allowing the order to be recorded - thus securing against the publicised payment hack
    • Minor bug fixes (error with complex database names; not showing error messages due to & instead of & in URL
  • Admin Side:
    • Variable amount for RELEASEing DEFERRED transactions
    • Check live transaction status (e.g. settlement status, batch id etc)

Requirements
  • SSL Cert (shared or dedicated)
  • cURL with OpenSSL support compiled into PHP

Works with
  • osCommerce v2.2 RC2a
  • osCommerce v2.2 MS2 17-08-2006
  • FireFox 3.0
  • IE 6.0
  • IE 7.0
  • Google Chrome 0.2.149.30
  • Safari 3.1.2


v5.1 Update - This supports the new v2.23 protocol and the new SagePay URLs

Click here to download this file
Go to the top of the page
 
+Quote Post
martinstan
post Nov 25 2008, 11:49 AM
Post #2


Newbie
*

Group: Members
Posts: 5
Joined: 24-November 08
Member No.: 1,638



Add the following lines to /includes/languages/english.php


CODE
define('MODULE_PAYMENT_PROTX_DIRECT_TEXT_ERROR', 'Credit Card Error!');
define('MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_ERROR', 'Unfortunately there has been a technical problem. Please try again and if the problem persists please contact us');


(Sorry I missed them out of the install file!)

The error:


QUOTE
Sorry, your order could not be processed as no payment transaction was found (No record). Please try again or contact the store owner.

only appears if the payment has not been recorded in the database (i.e. a hack attempt) - if you are seeing it in normal use then something is wrong. Please check your protx_direct databae table and see what (if anything) is being recorded there.




QUOTE
If I select 3D AUTH then I get this:
Example Cusotmer 3D-Authentication Page

At this stage in the payment process you have successfully registered a VSP Direct 3D-Authenticated transaction and redirected your customer to their Card Issuing bank to complete their authentication. They will be presented with a screen like the one below.

That is exactly what should happen. You then click one of the buttons to simulate the response you want to test.


Hi Tom
I've tried finding out the problem myself but keep hitting dead ends.
I'm pretty certain I've installed the module correctly. It seemed quite straight forward and I've installed things way more complicated than this module but of course I know enough to know I may have overlooked something in the process.

Now that I've added the code to english.php I'm obviously getting a proper error:
Credit Card Error!
Sorry, your order could not be processed as no payment transaction was found (No record). Please try again or contact the store owner
.

I've checked the database and without really knowing exactly what I'm looking for I can see no indication of any records in the protx_direct table and there are certainly no pending orders in the admin area.

Help much appreciated
Martin
Go to the top of the page
 
+Quote Post
tomh
post Nov 25 2008, 01:43 PM
Post #3


Development Team
Group Icon

Group: Team Member
Posts: 594
Joined: 7-August 07
From: Wales
Member No.: 25



Ok.

To explain why you are getting this error: Once the module has processed the payment (successfully) the customer is redirected to checkout_process.php, before this page records the order it calls the payment module's before_process() function. In the case of the protx module this function looks in the protx_direct table in the database to check that there is an entry with the status OK and the correct protx transaction ID - this is to prevent any hack attempts from placing an order.

You say the protx_direct table is empty, so here lies the problem - it should contain details of both failed and successful transactions. The difficulty is why it is not recording the transactions in the database.

Are you getting any other errors at all during the checkout procedure?
Go to the top of the page
 
+Quote Post
martinstan
post Nov 25 2008, 02:09 PM
Post #4


Newbie
*

Group: Members
Posts: 5
Joined: 24-November 08
Member No.: 1,638



No Tom there don't seem to be any other errors. I originally had the previous version of the module installed, before the (final) version which I have now. That's the only thing I can say that may have some influence but if it's not relevant do you think I should just go for a fresh install and see if I can trace anything that I may have missed? I really hope it's just not me being dumb.
Go to the top of the page
 
+Quote Post
FWR Media
post Nov 25 2008, 05:44 PM
Post #5


Contributor
***

Group: Contributors
Posts: 1,731
Joined: 19-December 07
From: Stowmarket - Suffolk - UK
Member No.: 749



Well Tom is the expert here I've just dabbled a bit but try the following . .

Find (includes/modules/payment/protx_direct.php)..

tep_db_perform(TABLE_PROTX_DIRECT, $data);
$this->protx_id = tep_db_insert_id();

Change TEMPORARILY to ..

CODE
// BOF - REMOVE ME
die('<pre>' . print_r($responses) . print_r($data) . '</pre>');
// EOF - REMOVE ME
    tep_db_perform(TABLE_PROTX_DIRECT, $data);
    $this->protx_id = tep_db_insert_id();


Now this won't repair anything .. in fact the payment system cannot work with this in place .. however it may give Tom or me some info to go on.

It should print out some info when you try to go through a sale which you need to copy and add to this post.

Then REMOVE THE CODE

Also REMOVE ANY SECURITY CODE info before posting the arrays .. put --REMOVED-- in its place or something.


--------------------
www.fwrmedia.co.uk
Don't like what we are doing? tell us! Think we're great? Tell everyone! (bit 70s but still)
Go to the top of the page
 
+Quote Post
tomh
post Nov 25 2008, 09:46 PM
Post #6


Development Team
Group Icon

Group: Team Member
Posts: 594
Joined: 7-August 07
From: Wales
Member No.: 25



Thanks Rob.

martinstan kindly gave me access details to site site I've I've picked up on a bug which presents in the manner he is describing but only when the module is set to take payments in "AUTHENTICATE" mode.

The problem is the following line in includes/modules/payment/protx_direct.php :
CODE
$trans_query = tep_db_query("SELECT status FROM ".TABLE_PROTX_DIRECT." WHERE id='".$this->protx_id."' AND status='OK'");


It needs to be:
CODE
$trans_query = tep_db_query("SELECT status FROM ".TABLE_PROTX_DIRECT." WHERE id='".$this->protx_id."' AND (status='OK' OR status='REGISTERED' OR status='AUTHENTICATED')");


I'll be updating the download later to reflect this.
Go to the top of the page
 
+Quote Post
FWR Media
post Nov 25 2008, 10:29 PM
Post #7


Contributor
***

Group: Contributors
Posts: 1,731
Joined: 19-December 07
From: Stowmarket - Suffolk - UK
Member No.: 749



Nice .. well done Tom

But I'm still confused .. I would have thought something along the same line as you like .. "missing protx_id in session" .. or .. "no result from status query" but I dumped those ideas as the user said there was nothing in the protx table.


--------------------
www.fwrmedia.co.uk
Don't like what we are doing? tell us! Think we're great? Tell everyone! (bit 70s but still)
Go to the top of the page
 
+Quote Post
tomh
post Nov 25 2008, 10:39 PM
Post #8


Development Team
Group Icon

Group: Team Member
Posts: 594
Joined: 7-August 07
From: Wales
Member No.: 25



There were actually quite a few entries in the table which seeing helped to solve it.
Go to the top of the page
 
+Quote Post
FWR Media
post Nov 25 2008, 11:00 PM
Post #9


Contributor
***

Group: Contributors
Posts: 1,731
Joined: 19-December 07
From: Stowmarket - Suffolk - UK
Member No.: 749



QUOTE(tomh @ Nov 25 2008, 10:39 PM) *
There were actually quite a few entries in the table which seeing helped to solve it.


Aaah .. wrong symptoms === wrong diagnosis.


--------------------
www.fwrmedia.co.uk
Don't like what we are doing? tell us! Think we're great? Tell everyone! (bit 70s but still)
Go to the top of the page
 
+Quote Post
scchristie
post Nov 26 2008, 02:56 PM
Post #10


Member
**

Group: Contributors
Posts: 44
Joined: 7-February 08
From: London, UK
Member No.: 806



Aha!

That explains the issue I was having a few weeks back. I never had a chance to finish investigating fully.

Well done.
Go to the top of the page
 
+Quote Post
tomh
post Nov 27 2008, 09:37 PM
Post #11


Development Team
Group Icon

Group: Team Member
Posts: 594
Joined: 7-August 07
From: Wales
Member No.: 25



New version (v5.0b) uploaded containing the fix outlined above for AUTHENTICATE mode transactions
Go to the top of the page
 
+Quote Post
mr bikes
post Dec 9 2008, 07:46 PM
Post #12


Newbie
*

Group: Members
Posts: 6
Joined: 9-December 08
Member No.: 1,718



HI,
I've just tried to update my older version with the 5.0b version and I keep getting the error

Credit Card Error!
Sorry, your order could not be processed as no payment transaction was found (No record). Please try again or contact the store owner.

After inputing a valid card
The info is going into the database, see below
CODE
2409 28 3636 3636-XXXXX75085008813925039387XXXX PAYMENT 34.4200 {85CA104D-1F0C-9181-09F6-FF224FD7A3F2} OK 0000 : The Authorisation was Successful. 124672463 V2ILTVXXXX ALL MATCH MATCHED MATCHED MATCHED NOAUTH 2008-12-09 18:24:29

(replaced some info with XXXX)

Could it be something to do with this line in the checkout_confirmation.php
CODE
echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER, 'id="confirm_button"') . '</form>' . "\n";


As I couldnt see the id="confirm_button part in the install, but it was in my file. Do I need to change the javascript in the protx_process files toinclude this id= for the submit button?

Hope someone has an idea
Go to the top of the page
 
+Quote Post
Joop
post Dec 9 2008, 09:12 PM
Post #13


Member
**

Group: Banned
Posts: 21
Joined: 26-November 07
Member No.: 720



Never mind.
Go to the top of the page
 
+Quote Post
tomh
post Dec 10 2008, 12:35 AM
Post #14


Development Team
Group Icon

Group: Team Member
Posts: 594
Joined: 7-August 07
From: Wales
Member No.: 25



@mr_bikes: The problem is not related to the confirmation button. It sounds like the internal id (normally held in the session) is getting lost. Do you have any modifications to the checkout process?

Can you edit includes/modules/payment/protx_direct.php:
find
CODE
function before_process()
{
  // Payment should be complete by this stage - if not abort order
  if (tep_session_is_registered('protx_id') && $_SESSION['protx_id'] > 0)
  {
      $this->protx_id = (int)$_SESSION['protx_id'];
      tep_session_unregister('protx_id');
  }
  else
  {
    tep_redirect(str_replace('&amp','&', tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=protx_direct&error='.urlencode('Sorry, your order could not be processed as no payment transaction was found (ID Missing). Please try again or contact the store owner.'), 'SSL')));
  }
  $trans_query = tep_db_query("SELECT status FROM ".TABLE_PROTX_DIRECT." WHERE id='".$this->protx_id."' AND (status='OK' OR status='REGISTERED' OR status='AUTHENTICATED')");
  if (tep_db_num_rows($trans_query) == 0)
  {
    tep_redirect(str_replace('&amp','&', tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=protx_direct&error='.urlencode('Sorry, your order could not be processed as no payment transaction was found (No record). Please try again or contact the store owner.'), 'SSL')));
  }
}

and change to
CODE
function before_process()
{
  // Payment should be complete by this stage - if not abort order
  if (tep_session_is_registered('protx_id') && $_SESSION['protx_id'] > 0)
  {
      $this->protx_id = (int)$_SESSION['protx_id'];
      tep_session_unregister('protx_id');
  }
  else
  {
    tep_redirect(str_replace('&amp','&', tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=protx_direct&error='.urlencode('Sorry, your order could not be processed as no payment transaction was found (ID Missing). Please try again or contact the store owner.'), 'SSL')));
  }
  $trans_query = tep_db_query("SELECT status FROM ".TABLE_PROTX_DIRECT." WHERE id='".$this->protx_id."' AND (status='OK' OR status='REGISTERED' OR status='AUTHENTICATED')");
  
  // TEMPORARY DEBUG CODE
    echo '<pre>$this->protx_id=' . $this->protx_id . "\n" .
         '$_SESSION[\'protx_id\']=' . $_SESSION['protx_id'] . "\n" .
         'num_rows=' . tep_db_num_rows($trans_query) . '</pre>';
    exit();
  // END DEBUG CODE
  
  if (tep_db_num_rows($trans_query) == 0)
  {
    tep_redirect(str_replace('&amp','&', tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=protx_direct&error='.urlencode('Sorry, your order could not be processed as no payment transaction was found (No record). Please try again or contact the store owner.'), 'SSL')));
  }
}


then try a transaction and paste the info here.
Go to the top of the page
 
+Quote Post
mr bikes
post Dec 11 2008, 07:34 PM
Post #15


Newbie
*

Group: Members
Posts: 6
Joined: 9-December 08
Member No.: 1,718



Hi, I added the above code, but cant see any difference. It still takes the money (I can see the transaction in protx) but bumps you back to the
checkout_payment.php?payment_error=protx_direct&error=Sorry%2C+your+order+could+not+be+processed+as+no+payment+transaction+was+found+%28ID+Missing%29.+Please+try+again+or+contact+the+store+owner.

Saying
Sorry, your order could not be processed as no payment transaction was found (ID Missing). Please try again or contact the store owner.
here is the code for my checkout_confirmation.php
CODE
<?php
/*
$Id: checkout_confirmation.php,v 1.139 2003/06/11 17:34:53 hpdl Exp $

Modified for MVS V1.0 2006/03/25 JCK/CWG
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

require('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}

// if there is nothing in the customers cart, redirect them to the shopping cart page
if ($cart->count_contents() < 1) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}

// avoid hack attempts during the checkout procedure by checking the internal cartID
if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
if ($cart->cartID != $cartID) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
}

// if no shipping method has been selected, redirect the customer to the shipping method selection page
if (!tep_session_is_registered('shipping')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}

if (!tep_session_is_registered('payment')) tep_session_register('payment');
if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];

if (!tep_session_is_registered('comments')) tep_session_register('comments');
if (tep_not_null($HTTP_POST_VARS['comments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
}

// load the selected payment module
require(DIR_WS_CLASSES . 'payment.php');
// ################# Added CGV Contribution ##################"
if ($credit_covers) $payment='';
// ################# End Added CGV Contribution ##################"
$payment_modules = new payment($payment);
// ################# Added CGV Contribution ##################"
require(DIR_WS_CLASSES . 'order_total.php');
// ################# End Added CGV Contribution ##################"

require(DIR_WS_CLASSES . 'order.php');
$order = new order;

$payment_modules->update_status();

// ################# Added CGV Contribution ##################"
// CCGV Contribution
$order_total_modules = new order_total;
$order_total_modules->collect_posts();
$order_total_modules->pre_confirmation_check();


if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
}

if (is_array($payment_modules->modules)) {
$payment_modules->pre_confirmation_check();
}

//MVS start
// load the selected shipping module
/* Modify MVS and batch print for Oscommerce begin */
if (SELECT_VENDOR_SHIPPING == 'true'){
// if (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'true')){
/* Modify MVS and batch print for Oscommerce end */
include(DIR_WS_CLASSES . 'vendor_shipping.php');
/* Modify MVS and batch print for Oscommerce begin */
} else {
//} elseif (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'false')){
/* Modify MVS and batch print for Oscommerce end */
include(DIR_WS_CLASSES . 'shipping.php');
}
///edited auctionblox $shipping_modules = new shipping($shipping);
//+++AUCTIONBLOX.COM
require(DIR_WS_MODULES . 'auctionblox/includes/classes/abxShipping.php');
$shipping_modules = new abxShipping;
//+++AUCTIONBLOX.COM
//MVS End

//require(DIR_WS_CLASSES . 'order_total.php');
//$order_total_modules = new order_total;

// Stock Check
$any_out_of_stock = false;
if (STOCK_CHECK == 'true') {
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
$any_out_of_stock = true;
}
}
// Out of Stock
if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}
}

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script type="text/javascript" src="<?php echo DIR_WS_INCLUDES;?>jquery-latest.pack.js"></script>
<script type="text/javascript" src="<?php echo DIR_WS_INCLUDES;?>thickbox.js"></script>
<link rel="stylesheet" href="<?php echo DIR_WS_INCLUDES;?>thickbox.css" type="text/css" media="screen" />
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_confirmation.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<?php
if ($sendto != false) {
?>
<td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr><!-- PWA BOF -->
<td class="main"><?php echo '<b>' . HEADING_DELIVERY_ADDRESS . '</b>' . (($customer_id>0 || (defined('PURCHASE_WITHOUT_ACCOUNT_SEPARATE_SHIPPING') && PURCHASE_WITHOUT_ACCOUNT_SEPARATE_SHIPPING=='yes') )? ' <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>':''); ?></td>
</tr><!-- PWA EOF -->
<tr>
<td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>
</tr>
<?php
if ($order->info['shipping_method']) {
?>
<tr>
<td class="main"><?php echo '<b>' . HEADING_SHIPPING_METHOD . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
</tr>
<tr>
<td class="main"><?php echo $order->info['shipping_method']; ?></td>
</tr>
<?php
}
?>
</table></td>
<?php
}
?>
<td width="<?php echo (($sendto != false) ? '70%' : '100%'); ?>" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
if (sizeof($order->info['tax_groups']) > 1) {
?>
<tr>
<td class="main" colspan="2"><?php echo '<b>' . HEADING_PRODUCTS . '</b> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
<td class="smallText" align="right"><b><?php echo HEADING_TAX; ?></b></td>
<td class="smallText" align="right"><b><?php echo HEADING_TOTAL; ?></b></td>
</tr>
<?php
} else {
?>
<tr>
<td class="main" colspan="3"><?php echo '<b>' . HEADING_PRODUCTS . '</b> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
</tr>
<?php
}

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
echo ' <tr>' . "\n" .
' <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
' <td class="main" valign="top">' . $order->products[$i]['name'];

if (STOCK_CHECK == 'true') {
echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);
}

if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
}
}

echo '</td>' . "\n";

if (sizeof($order->info['tax_groups']) > 1) echo ' <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";

echo ' <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "\n" .
' </tr>' . "\n";
}
?>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo HEADING_BILLING_INFORMATION; ?></b></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr><!-- PWA BOF -->
<td class="main"><?php echo '<b>' . HEADING_BILLING_ADDRESS . '</b> <a href="' . (($customer_id==0)?tep_href_link(FILENAME_CREATE_ACCOUNT, 'guest=guest', 'SSL'):tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
</tr><!-- PWA EOF -->
<tr>
<td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>
</tr>
<tr>
<td class="main"><?php echo '<b>' . HEADING_PAYMENT_METHOD . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
</tr>
<tr>
<td class="main"><?php echo $order->info['payment_method']; ?></td>
</tr>
</table></td>
<td width="70%" valign="top" align="right"><table border="0" cellspacing="0" cellpadding="2">
<?php
if (MODULE_ORDER_TOTAL_INSTALLED) {
$order_total_modules->process();
echo $order_total_modules->output();
}
?>
</table></td>
</tr>
</table></td>
</tr>
<?php
if (is_array($payment_modules->modules)) {
if ($confirmation = $payment_modules->confirmation()) {
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo HEADING_PAYMENT_INFORMATION; ?></b></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main" colspan="4"><?php echo $confirmation['title']; ?></td>
</tr>
<?php
for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {
?>
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td class="main"><?php echo $confirmation['fields'][$i]['title']; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td class="main"><?php echo $confirmation['fields'][$i]['field']; ?></td>
</tr>
<?php
}
?>
</table></td>
</tr>
</table></td>
</tr>
<?php
}
}
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
if (tep_not_null($order->info['comments'])) {
?>
<tr>
<td class="main"><?php echo '<b>' . HEADING_ORDER_COMMENTS . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="right" class="main">
<?php
if (isset($$payment->form_action_url)) {
$form_action_url = $$payment->form_action_url;
} else {
$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
}

echo tep_draw_form('checkout_confirmation', $form_action_url, 'post', 'onsubmit="document.getElementById(\'confirm_button\').disabled=true;"');

// ################# Added CGV
echo tep_draw_hidden_field('gv_redeem_code', $HTTP_POST_VARS['gv_redeem_code']);
// ################# End Added CGV

if (is_array($payment_modules->modules)) {
echo $payment_modules->process_button();
}

if ($payment_modules->selected_module !== 'protx_direct')
{
echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER, 'id="confirm_button"') . "\n";
} ?>
</form>


</td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
</tr>
</table></td>
<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
<td><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
</tr>
</table></td>
<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
<td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_PAYMENT . '</a>'; ?></td>
<td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
</tr>
</table></td>
</tr>
</table></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
</tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br><script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2377781-4";
urchinTracker();
</script>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Also here is my checkout process

as that may be the problem?
CODE
<?php
/*
$Id: checkout_process.php,v 1.128 2003/05/28 18:00:29 hpdl Exp $

Modified for MVS V1.0 2006/03/25 JCK/CWG
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright © 2006 osCommerce

Released under the GNU General Public License
*/

include('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}

if (!tep_session_is_registered('sendto')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}

if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}

// avoid hack attempts during the checkout procedure by checking the internal cartID
if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
if ($cart->cartID != $cartID) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
}

include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

// load selected payment module
require(DIR_WS_CLASSES . 'payment.php');
// #################### Added CCGV ######################
if ($credit_covers) $payment=''; //ICW added for CREDIT CLASS
// #################### End Added CGV ######################

$payment_modules = new payment($payment);

//MVS start
// load the selected shipping module
/* Modify MVS and batch print for Oscommerce begin */
if (SELECT_VENDOR_SHIPPING == 'true'){
// if (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'true')){
/* Modify MVS and batch print for Oscommerce end */
include(DIR_WS_CLASSES . 'vendor_shipping.php');

/* Modify MVS and batch print for Oscommerce begin */
} else {
//} elseif (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'false')){
/* Modify MVS and batch print for Oscommerce end */
include(DIR_WS_MODULES . 'auctionblox/includes/classes/abxShipping.php');
$shipping_modules = new abxShipping;

}

//MVS End

require(DIR_WS_CLASSES . 'order.php');
$order = new order;

// load the before_process function from the payment modules
$payment_modules->before_process();

require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;

$order_totals = $order_total_modules->process();
if($order->customer['format_id']=="")
$order->customer['format_id']=1;
if($order->delivery['format_id']=="")
$order->delivery['format_id']=1;
if($order->billing['format_id']=="")
$order->billing['format_id']=1;
$sql_data_array = array('customers_id' => $customer_id,
'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
'customers_company' => $order->customer['company'],
'customers_street_address' => $order->customer['street_address'],
'customers_suburb' => $order->customer['suburb'],
'customers_city' => $order->customer['city'],
'customers_postcode' => $order->customer['postcode'],
'customers_state' => $order->customer['state'],
'customers_country' => $order->customer['country']['title'],
'customers_telephone' => $order->customer['telephone'],
'customers_email_address' => $order->customer['email_address'],
'customers_address_format_id' => $order->customer['format_id'],
'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
'delivery_company' => $order->delivery['company'],
'delivery_street_address' => $order->delivery['street_address'],
'delivery_suburb' => $order->delivery['suburb'],
'delivery_city' => $order->delivery['city'],
'delivery_postcode' => $order->delivery['postcode'],
'delivery_state' => $order->delivery['state'],
'delivery_country' => $order->delivery['country']['title'],
'delivery_address_format_id' => $order->delivery['format_id'],
'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],
'billing_company' => $order->billing['company'],
'billing_street_address' => $order->billing['street_address'],
'billing_suburb' => $order->billing['suburb'],
'billing_city' => $order->billing['city'],
'billing_postcode' => $order->billing['postcode'],
'billing_state' => $order->billing['state'],
'billing_country' => $order->billing['country']['title'],
'billing_address_format_id' => $order->billing['format_id'],
'payment_method' => $order->info['payment_method'],
// 'shipping_module' => $shipping['id'],
'cc_type' => $order->info['cc_type'],
'cc_owner' => $order->info['cc_owner'],
'cc_number' => $order->info['cc_number'],
'cc_expires' => $order->info['cc_expires'],
'date_purchased' => 'now()',
'orders_status' => $order->info['order_status'],
'currency' => $order->info['currency'],
'currency_value' => $order->info['currency_value']);
tep_db_perform(TABLE_ORDERS, $sql_data_array);
$sql="select MAX(orders_id) as oi from ".TABLE_ORDERS."";
$run=mysql_query($sql) or die(mysql_error());
$rs=mysql_fetch_array($run);
$insert_id =$rs['oi'];
for ($i=0, $n=sizeof($order->products); $i<$n; $i++)
{
$products_query = tep_db_query("select products_id,
products_price,
products_tax_class_id,
products_weight,
vendors_id
from " . TABLE_PRODUCTS . "
where products_id = '" . (int)tep_get_prid($order->products[$i]['id']) . "'"
);
if ($products_vendr = tep_db_fetch_array($products_query))
{
$order->products[$i]['vendors_id']=$products_vendr["vendors_id"];
}
}
// $insert_id = tep_db_insert_id();
for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

$sql_data_array = array('orders_id' => $insert_id,
'title' => $order_totals[$i]['title'],
'text' => $order_totals[$i]['text'],
'value' => $order_totals[$i]['value'],
'class' => $order_totals[$i]['code'],
'sort_order' => $order_totals[$i]['sort_order']);
tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
}

$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
$sql_data_array = array('orders_id' => $insert_id,
'orders_status_id' => $order->info['order_status'],
'date_added' => 'now()',
'customer_notified' => $customer_notification,
'comments' => $order->info['comments']);
tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

/* Modify MVS and batch print for Oscommerce begin */
if (SELECT_VENDOR_SHIPPING == 'true') {
/* Modify MVS and batch print for Oscommerce end */

//MVS - added insert for new orders_shipping table
$shipping_array = $shipping['vendor'];
foreach ($shipping_array as $vendors_id => $shipping_data)
{

$vendors_query = tep_db_query("select vendors_name
from " . TABLE_VENDORS . "
where vendors_id = '" . (int)$vendors_id . "'"
);
$vendors_name = 'Unknown';
if ($vendors = tep_db_fetch_array($vendors_query)) {
$vendors_name = $vendors['vendors_name'];
}
$shipping_method_array = explode ('_', $shipping_data['id']);
if ($shipping_method_array[0] == 'fedex1') {
$shipping_method = 'Federal Express';
} elseif ($shipping_method_array[0] == 'upsxml') {
$shipping_method = 'UPS';
} elseif ($shipping_method_array[0] == 'usps') {
$shipping_method = 'USPS';
} else {
$shipping_method = $shipping_method_array[0];
}
$sql_data_array = array('orders_id' => $insert_id,
'vendors_id' => $vendors_id,
'shipping_module' => $shipping_method,
'shipping_method' => $shipping_data['title'],
'shipping_cost' => $shipping_data['cost'],
'shipping_tax' => $shipping_data['ship_tax'],
'vendors_name' => $vendors_name,
'vendor_order_sent' => 'no'
);
tep_db_perform(TABLE_ORDERS_SHIPPING, $sql_data_array);
}

//MVS End
/* Modify MVS and batch print for Oscommerce begin */
} else {

$vendor_shipping = $cart->vendor_shipping();
$exist=false;
while(list($key,$val) = each($vendor_shipping))
{
$vendors_query = tep_db_query("select vendors_name from " . TABLE_VENDORS . " where vendors_id = '" . (int)$key . "'");
$vendors_name = 'Unknown';
if ($vendors = tep_db_fetch_array($vendors_query)) {
$vendors_name = $vendors['vendors_name'];
}
$exist=true;
$sql_data_array = array('orders_id' => $insert_id,
'vendors_id' => $key,
'shipping_module' => $shipping_method,
'shipping_method' => $order->info['shipping_method'],
'shipping_cost' => $order->info['shipping_cost'],
'shipping_tax' => $shipping['tax'],
'vendors_name' => $vendors_name,
'vendor_order_sent' => 'no');
tep_db_perform(TABLE_ORDERS_SHIPPING, $sql_data_array);
}
if($exist==false)
{
$new_cart=array();
for ($i=0, $n=sizeof($order->products); $i<$n; $i++)
{
$new_cart[$i]=$order->products[$i]['id'];
}
$vendor_shipping = $cart->vendor_shipping2($new_cart);

while(list($key,$val) = each($vendor_shipping))
{

$vendors_query = tep_db_query("select vendors_name from " . TABLE_VENDORS . " where vendors_id = '" . (int)$key . "'");
$vendors_name = 'Unknown';
if ($vendors = tep_db_fetch_array($vendors_query)) {
$vendors_name = $vendors['vendors_name'];
}

$sql_data_array = array('orders_id' => $insert_id,
'vendors_id' => $key,
'shipping_module' => $shipping_method,
'shipping_method' => $order->info['shipping_method'],
'shipping_cost' => $order->info['shipping_cost'],
'shipping_tax' => $shipping['tax'],
'vendors_name' => $vendors_name,
'vendor_order_sent' => 'no');
tep_db_perform(TABLE_ORDERS_SHIPPING, $sql_data_array);
}
}
}
/* Modify MVS and batch print for Oscommerce end */

// initialized for the email confirmation
$products_ordered = '';
$subtotal = 0;
$total_tax = 0;

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') {
if (DOWNLOAD_ENABLED == 'true') {
$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename
FROM " . TABLE_PRODUCTS . " p
LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
ON p.products_id=pa.products_id
LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
ON pa.products_attributes_id=pad.products_attributes_id
WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
$products_attributes = $order->products[$i]['attributes'];
if (is_array($products_attributes)) {
$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
}
$stock_query = tep_db_query($stock_query_raw);
} else {
$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
}
if (tep_db_num_rows($stock_query) > 0) {
$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
$stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];

// Version: 02-20-04 (BOF) 02/20/2004 - Low Stock Level Email Author: Emmett (yesUdo.com) and Jai (kynet.co.uk)

$warning_stock = STOCK_REORDER_LEVEL;
$current_stock = $stock_left;

// Jai @ kynet.co.uk made the following change on 20-02-04
// Dynamic store url - Replaced [' http://www.YOURDOMAIN.com/] with [. HTTP_SERVER . DIR_WS_CATALOG . ']

$low_stock_email = '<b>Low stock warning:</b> ' . $order->products[$i]['name'] . "\n" . '<b>Model No.:</b> ' . $order->products[$i]['model'] . "\n" . '<b>Quantity:</b> ' . $stock_left . "\n" . '<b>Product URL:</b>' . HTTP_SERVER . DIR_WS_CATALOG . 'product_info.php?products_id='. $order->products[$i]['id'] . "\n\n" . '<b>Current Low order limit is ' . $warning_stock . ' units</b>';
$low_stock_subject = 'Low Stock Warning: ' . $order->products[$i]['name'];

if ($current_stock <= $warning_stock) {
tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $low_stock_subject, $low_stock_email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); }

// (EOF) 02/20/2004 - Low Stock Level Email Author: Emmett (yesUdo.com) and Jai (kynet.co.uk)



} else {
$stock_left = $stock_values['products_quantity'];
}
tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
}
}
}

// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

//MVS start - added 'vendors_id' => ...

$sql_data_array = array('orders_id' => $insert_id,
'products_id' => tep_get_prid($order->products[$i]['id']),
'products_model' => $order->products[$i]['model'],
'products_name' => $order->products[$i]['name'],
'products_price' => $order->products[$i]['price'],
'final_price' => $order->products[$i]['final_price'],
'products_tax' => $order->products[$i]['tax'],
'products_quantity' => $order->products[$i]['qty'],
'vendors_id' => $order->products[$i]['vendors_id']
); //MVS end
$relst=tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$sql22="select MAX(orders_products_id) as oi1 from ".TABLE_ORDERS_PRODUCTS."";
$run22=mysql_query($sql22) or die(mysql_error());
$rs22=mysql_fetch_array($run22);

$order_products_id = $rs22['oi1'];
// #################### Added CCGV ######################
$order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM
// #################### End Added CCGV ######################

//------insert customer choosen option to order--------
$attributes_exist = '0';
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) {
$attributes_exist = '1';
for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
if (DOWNLOAD_ENABLED == 'true') {
$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
on pa.products_attributes_id=pad.products_attributes_id
where pa.products_id = '" . $order->products[$i]['id'] . "'
and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'
and pa.options_id = popt.products_options_id
and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'
and pa.options_values_id = poval.products_options_values_id
and popt.language_id = '" . $languages_id . "'
and poval.language_id = '" . $languages_id . "'";
$attributes = tep_db_query($attributes_query);
} else {
$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
}
$attributes_values = tep_db_fetch_array($attributes);

$sql_data_array = array('orders_id' => $insert_id,
'orders_products_id' => $order_products_id,
'products_options' => $attributes_values['products_options_name'],
'products_options_values' => $attributes_values['products_options_values_name'],
'options_values_price' => $attributes_values['options_values_price'],
'price_prefix' => $attributes_values['price_prefix']);
tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
$sql_data_array = array('orders_id' => $insert_id,
'orders_products_id' => $order_products_id,
'orders_products_filename' => $attributes_values['products_attributes_filename'],
'download_maxdays' => $attributes_values['products_attributes_maxdays'],
'download_count' => $attributes_values['products_attributes_maxcount']);
tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
}
$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
}
}
//------insert customer choosen option eof ----
$total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
$total_cost += $total_products_price;

//MVS begin
if (SELECT_VENDOR_EMAIL_OPTION == 'false') {
$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
}
}// for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

if (SELECT_VENDOR_EMAIL_OPTION == 'true') {
$order_id = $insert_id;
require(DIR_WS_INCLUDES . 'vendor_order_data.php');
}







function vendors_email($vendors_id, $oID, $status, $vendor_order_sent) {
$vendor_order_sent = false;
$debug='no';
$vendor_order_sent = 'no';
$index2 = 0;
//let's get the Vendors
$vendor_data_query = tep_db_query("select v.vendors_id, v.vendors_name, v.vendors_email, v.vendors_contact, v.vendor_add_info, v.vendor_street, v.vendor_city, v.vendor_state, v.vendors_zipcode, v.vendor_country, v.account_number, v.vendors_status_send, os.shipping_module, os.shipping_method, os.shipping_cost, os.shipping_tax, os.vendor_order_sent from " . TABLE_VENDORS . " v, " . TABLE_ORDERS_SHIPPING . " os where v.vendors_id=os.vendors_id and v.vendors_id='" . $vendors_id . "' and os.orders_id='" . (int)$oID . "' and v.vendors_status_send='" . $status . "'");
while ($vendor_order = tep_db_fetch_array($vendor_data_query))
{
$vendor_products[$index2] = array('Vid' => $vendor_order['vendors_id'],
'Vname' => $vendor_order['vendors_name'],
'Vemail' => $vendor_order['vendors_email'],
'Vcontact' => $vendor_order['vendors_contact'],
'Vaccount' => $vendor_order['account_number'],
'Vstreet' => $vendor_order['vendor_street'],
'Vcity' => $vendor_order['vendor_city'],
'Vstate' => $vendor_order['vendor_state'],
'Vzipcode' => $vendor_order['vendors_zipcode'],
'Vcountry' => $vendor_order['vendor_country'],
'Vaccount' => $vendor_order['account_number'], 'Vinstructions' => $vendor_order['vendor_add_info'],
'Vmodule' => $vendor_order['shipping_module'], 'Vmethod' => $vendor_order['shipping_method']);
if ($debug == 'yes') {
echo 'The vendor query: ' . $vendor_order['vendors_id'] . '<br>';
}
$index = 0;
$vendor_orders_products_query = tep_db_query("select o.orders_id, o.orders_products_id, o.products_model, o.products_id, o.products_quantity, o.products_name, p.vendors_id, p.vendors_prod_comments, p.vendors_prod_id, p.vendors_product_price from " . TABLE_ORDERS_PRODUCTS . " o, " . TABLE_PRODUCTS . " p where p.vendors_id='" . (int)$vendor_order['vendors_id'] . "' and o.products_id=p.products_id and o.orders_id='" . $oID . "' order by o.products_name");
while ($vendor_orders_products = tep_db_fetch_array($vendor_orders_products_query)) {
$vendor_products[$index2]['vendor_orders_products'][$index] = array(
'Pqty' => $vendor_orders_products['products_quantity'],
'Pname' => $vendor_orders_products['products_name'],
'Pmodel' => $vendor_orders_products['products_model'],
'Pprice' => $vendor_orders_products['products_price'],
'Pvendor_name' => $vendor_orders_products['vendors_name'],
'Pcomments' => $vendor_orders_products['vendors_prod_comments'],
'PVprod_id' => $vendor_orders_products['vendors_prod_id'],
'PVprod_price' => $vendor_orders_products['vendors_product_price'],
'spacer' => '-');
//MVS end
if ($debug == 'yes') {
echo 'The products query: ' . $vendor_orders_products['products_name'] . '<br>';
}
$subindex = 0;
$vendor_attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$oID . "' and orders_products_id = '" . (int)$vendor_orders_products['orders_products_id'] . "'");

$v=mysql_num_rows($vendor_attributes_query );
if($v)
{
while ($vendor_attributes = tep_db_fetch_array($vendor_attributes_query)) {

$vendor_products[$index2]['vendor_orders_products'][$index]['vendor_attributes'][$subindex] = array('option' => $vendor_attributes['products_options'],
'value' => $vendor_attributes['products_options_values'],
'prefix' => $vendor_attributes['price_prefix'],
'price' => $vendor_attributes['options_values_price']);

$subindex++;
}
}
$index++;
}
$index2++;
// let's build the email
// Get the delivery address
$delivery_address_query = tep_db_query("select distinct delivery_company, delivery_name, delivery_street_address, delivery_city, delivery_state, delivery_postcode from " . TABLE_ORDERS . " where orders_id='" . $oID ."'") ;
$vendor_delivery_address_list = tep_db_fetch_array($delivery_address_query);

if ($debug == 'yes') {
echo 'The number of vendors: ' . sizeof($vendor_products) . '<br>';
}
$email='';

for ($l=0, $m=sizeof($vendor_products); $l<$m; $l++) {

$vendor_country = tep_get_country_name($vendor_products[$l]['Vcountry']);
$order_number= $oID;
$vendors_id=$vendor_products[$l]['Vid'];
$the_email=$vendor_products[$l]['Vemail'];
$the_name=$vendor_products[$l]['Vname'];
$the_contact=$vendor_products[$l]['Vcontact'];

$email= '<b>To: ' . $the_contact . ' <br>' . $the_name . '<br>' . $the_email . '<br>' .
$vendor_products[$l]['Vstreet'] .'<br>' .
$vendor_products[$l]['Vcity'] .', ' .
$vendor_products[$l]['Vstate'] .' ' .
$vendor_products[$l]['Vzipcode'] . ' ' . $vendor_country . '<br>' . '<br>' . EMAIL_SEPARATOR . '<br>' . 'Special Comments or Instructions: ' . $vendor_products[$l]['Vinstructions'] .'<br>' . '<br>' . EMAIL_SEPARATOR . '<br>' . 'From: ' . STORE_OWNER . '<br>' . STORE_NAME_ADDRESS . '<br>' . 'Accnt #: ' . $vendor_products[$l]['Vaccount'] . '<br>' . EMAIL_SEPARATOR . '<br>' . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . '<br>' . EMAIL_SEPARATOR . '<br>' . '<br> Shipping Method: ' . $vendor_products[$l]['Vmodule'] . ' -- ' . $vendor_products[$l]['Vmethod'] . '<br>' . EMAIL_SEPARATOR . '<br>' . '<br>Dropship deliver to:<br>' .
$vendor_delivery_address_list['delivery_company'] .'<br>' .
$vendor_delivery_address_list['delivery_name'] .'<br>' .
$vendor_delivery_address_list['delivery_street_address'] .'<br>' .
$vendor_delivery_address_list['delivery_city'] .', ' .
$vendor_delivery_address_list['delivery_state'] . ' ' . $vendor_delivery_address_list['delivery_postcode'] . '<br><br>' ;
$email = $email . '<table width="75%" border=1 cellspacing="0" cellpadding="3">
<tr><td>Qty:</td><td>Product Name:</td><td>Item Code/Number:</td><td>Product Model:</td><td>Per Unit Price:</td><td>Item Comments: </td></tr>';
for ($i=0, $n=sizeof($vendor_products[$l]['vendor_orders_products']); $i<$n; $i++) {
$product_attribs ='';
if (isset($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) && (sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) > 0)) {

for ($j = 0, $k = sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']); $j < $k; $j++) {
$product_attribs .= '&nbsp;&nbsp;' . $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['option'] . ': ' . $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['value'] . '<br>';
}
}
$email = $email . '<tr><td>&nbsp;' . $vendor_products[$l]['vendor_orders_products'][$i]['Pqty'] .
'</td><td>&nbsp;' . $vendor_products[$l]['vendor_orders_products'][$i]['Pname'] . '<br>&nbsp;&nbsp;<i>Option<br> ' . $product_attribs .
'</td><td>&nbsp;' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_id'] .
'</td><td>&nbsp;' . $vendor_products[$l]['vendor_orders_products'][$i]['Pmodel'] .
'</td><td>&nbsp;' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_price'] . '</td><td>' .
$vendor_products[$l]['vendor_orders_products'][$i]['Pcomments'] . '</b></td></tr>';

}
}
$email = $email . '</table><br><HR><br>';

tep_mail($the_name, $the_email, EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID , $email . '<br>', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);
$vendor_order_sent = 'yes';

tep_db_query("update " . TABLE_ORDERS_SHIPPING . " set vendor_order_sent = '" . tep_db_input($vendor_order_sent) . "' where orders_id = '" . (int)$oID . "' and vendors_id = '" . (int)$vendors_id . "'");

if ($debug == 'yes') {
echo 'The $email(including headers:<br>Vendor Email Addy' . $the_email . '<br>Vendor Name' . $the_name . '<br>Vendor Contact' . $the_contact . '<br>Body--<br>' . $email . '<br>';
}
}
return true;
} //MVS end
// #################### Added CCGV ######################
$order_total_modules->apply_credit();//ICW ADDED FOR CREDIT CLASS SYSTEM
// #################### End Added CCGV ######################

// lets start with the email confirmation
$email_order = STORE_NAME . "\n" .
EMAIL_SEPARATOR . "\n" .
EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
// PWA BOF
if ($customer_id == 0) {
$email_order .= EMAIL_WARNING . "\n\n";
}
// PWA EOF
if ($order->info['comments']) {
$email_order .= tep_db_output($order->info['comments']) . "\n\n";
}
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
EMAIL_SEPARATOR . "\n" .
$products_ordered .
EMAIL_SEPARATOR . "\n";

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
}

if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
EMAIL_SEPARATOR . "\n" .
tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
}

$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
EMAIL_SEPARATOR . "\n" .
tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n";
if ($payment_class->email_footer) {
$email_order .= $payment_class->email_footer . "\n\n";
}
}
tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}


//MVS start
if (SELECT_VENDOR_EMAIL_WHEN == 'Catalog' || SELECT_VENDOR_EMAIL_WHEN == 'Both') {
$status=$order->info['order_status'];
if (isset($status)) {
$order_sent_query = tep_db_query("select vendor_order_sent, vendors_id from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . $insert_id . "'");
while ($order_sent_data = tep_db_fetch_array($order_sent_query)) {

$order_sent_ckeck = $order_sent_data['vendor_order_sent'];
$vendors_id = $order_sent_data['vendors_id'];
//Bothselect1078order17vendno
//Bothselect1079order17vendno
// echo $order_sent_check . ' The order sent check<br>';
// echo $insert_id . 'The order number<br>';
if ($order_sent_ckeck == 'no') {
$status='';
$oID=$insert_id;
$vendor_order_sent = false;
$status=$order->info['order_status'];

vendors_email($vendors_id, $oID, $status, $vendor_order_sent);
}// if order check
}// while
}// if isset
// echo 'Email sent? ' . $vendor_order_sent . '<br>';
}// if enabled

//





//MVS end this file is complete

// load the after_process function from the payment modules
$payment_modules->after_process();

//+++AUCTIONBLOX.COM
$cart->reset(true, $insert_id);
//+++AUCTIONBLOX.COM

// unregister session variables used during checkout
tep_session_unregister('sendto');
tep_session_unregister('billto');
tep_session_unregister('shipping');
tep_session_unregister('payment');
tep_session_unregister('comments');
// #################### Added CCGV ######################
if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');
$order_total_modules->clear_posts();//ICW ADDED FOR CREDIT CLASS SYSTEM
// #################### End Added CCGV ######################


tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Go to the top of the page
 
+Quote Post
mr bikes
post Dec 11 2008, 08:33 PM
Post #16


Newbie
*

Group: Members
Posts: 6
Joined: 9-December 08
Member No.: 1,718



Also incase these are wrong these are the databse columns for protx table

id customer_id order_id vendortxcode txtype value vpstxid status statusdetail txauthno securitykey avscv2 address_result postcode_result CV2_result 3DSecureStatus CAVV txtime
Go to the top of the page
 
+Quote Post
mr bikes
post Dec 11 2008, 09:20 PM
Post #17


Newbie
*

Group: Members
Posts: 6
Joined: 9-December 08
Member No.: 1,718



If I change the protx_direct.php file in includes/modules/payment
function before_process() part to this
CODE
function before_process()
{
// Payment should be complete by this stage - if not abort order

$this->protx_id = (int)$_SESSION['protx_id'];
tep_session_unregister('protx_id');

}


Then it works fine. Will this cause problems if I leave it like that?
Go to the top of the page
 
+Quote Post
tomh
post Dec 11 2008, 09:49 PM
Post #18


Development Team
Group Icon

Group: Team Member
Posts: 594
Joined: 7-August 07
From: Wales
Member No.: 25



If you change the code like that then it is bypassing a security check.

The error has changed from the first post you made - from "No record" to "ID Missing" - which helps a little though it's not clear why the ID is missing.

I can't see anything in the checkout_process.php that would be affecting the session (unless there's some code in the MVS files but I wouldn't have thought so).



Can you remove the change suggested above and try editing /protx_process.php

find:
CODE
    //END CHECKOUT_PROCESS.PHP CODE

        $response = $GLOBALS['protx_direct']->start_transaction();

        if ($response['authorised'] === FALSE)
        {
          $msg = 'Sorry your payment could not be processed.';
          if ($nojs)
          {
              tep_redirect(protxCleanUrl(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=protx_direct&error='.urlencode($msg . ' (' . $response['detail'].')'), 'SSL')));
          }
          else
          {
              echo '<strong><span style="color: red;">'.$msg.'</span></strong><br><br>'.$response['detail'];
          }
        }
        elseif ($response['authorised'] === TRUE)
        {
          tep_session_register('protx_id');
          $_SESSION['protx_id'] = $GLOBALS['protx_direct']->protx_id;
          if ($nojs)
          {
              tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'));
          }
          else
          {
            echo '<script type="text/javascript">window.location.href="'.tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL').'";</script>';
            tep_exit();
          }
        }

and change to
CODE
    //END CHECKOUT_PROCESS.PHP CODE

        $response = $GLOBALS['protx_direct']->start_transaction();
        tep_session_register('protx_id');
                $_SESSION['protx_id'] = $GLOBALS['protx_direct']->protx_id;

        if ($response['authorised'] === FALSE)
        {
          $msg = 'Sorry your payment could not be processed.';
          if ($nojs)
          {
              tep_redirect(protxCleanUrl(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=protx_direct&error='.urlencode($msg . ' (' . $response['detail'].')'), 'SSL')));
          }
          else
          {
              echo '<strong><span style="color: red;">'.$msg.'</span></strong><br><br>'.$response['detail'];
          }
        }
        elseif ($response['authorised'] === TRUE)
        {
          if ($nojs)
          {
              tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'));
          }
          else
          {
            echo '<script type="text/javascript">window.location.href="'.tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL').'";</script>';
            tep_exit();
          }
        }
Go to the top of the page
 
+Quote Post
mr bikes
post Dec 16 2008, 03:26 PM
Post #19


Newbie
*

Group: Members
Posts: 6
Joined: 9-December 08
Member No.: 1,718



I tried changing as suggested above, but it still takes you back to the checkout_payment.php page saying (ID Missing).
However the money IS TAKEN from the card!!!

It seems to stem from failing this if statement in includes/modules/payment/protx_direct.php

CODE
if (tep_session_is_registered('protx_id') && $_SESSION['protx_id'] > 0)


Any ideas why it would be failing this?
Go to the top of the page
 
+Quote Post
Vger
post Dec 16 2008, 04:14 PM
Post #20


Administrator
Group Icon

Group: Team Member
Posts: 2,067
Joined: 1-August 07
From: United Kingdom
Member No.: 2



Your website could be losing the session id. Make sure that your includes/configure.php file is correctly set up. Post it here if you like, minus all the db info at the bottom.

Vger


--------------------
TerraNetwork - osCommerce Hosting Specialists
free install of osCommerce with every hosting package,
with Shared SSL and SEO URLs configured.
Go to the top of the page
 
+Quote Post

5 Pages V   1 2 3 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 6th September 2010 - 07:47 AM