Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order appears in OrderCheck but not in Orders - a possible cause


phanchet

Recommended Posts

Hi

 

I have been reading up on the forums about the bizarre situation where sites run perfectly for ages then all of a sudden Orders no longer appear on the Order table - only in OrderCheck

 

OrderCheck is a brilliant bit of code that really helps when payments fail for one reason or another

 

However - if you happen to delete the most recent entry from the OrderCheck table (say Order 54) then there's a snag in this bit of code in this bit of checkout_process.php

 

 

// ------------------------------------------------------------------------------------------

// OrderCheck

$holding_orders_max_query = tep_db_query("select max('orders_id') as max_id from " . TABLE_HOLDING_ORDERS . "");

$holding_orders_max = tep_db_fetch_array($holding_orders_max_query);

$insert_id = $holding_orders_max["max_id"];

// ------------------------------------------------------------------------------------------

 

// ------------------------------------------------------------------------------------------

// OrderCheck

// Added 'orders_id' => $insert_id, to the list below

$sql_data_array = array(

'orders_id' => $insert_id,

 

 

 

.. the max value of the TABLE_HOLDING_ORDERS is one less that the max value in the ORDERS table (as you deleted it), so the update fails.

 

 

Easy fix - place an order yourself, then edit the entry in the HOLDING table to have the same orders_id as the highest orders_id in the Orders table. They are then back in sync. Then remember to never delete from the OrderCheck table : (remove the delete button?)

 

 

Better fix - the $insert_id should be the highest value in the OrderCheck AND Orders table, rather than just the highest in the OrderCheck table

 

 

Hope that helps

 

Phil Hanchet

OneStopWebSystems.com

Never Knowingly Understood

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...