Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

unreasonable payment structure will cost lost order.


hnzzyanglin

Recommended Posts

Posted

user add cart -> select shipping -> select payment -> confirm order -> goto payment and return back.

 

The order first create is in the "confirm order page" then go to paypal payment.

if paypal not return back and back the store do some operate will cause order lost.

 

1. function selection() this function will execute when user select the payment option

That mean when a order no order history will delete this order.

but if user payment success but paypal not return to the store. but user return back to the payment selection page order will delete. so order lost.

 

we know this is for if user change anything address,shipping, or cart.

 

function selection() {
     global $cart_PayPal_Standard_ID;

     if (tep_session_is_registered('cart_PayPal_Standard_ID')) {
       $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);

       $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1');

       if (tep_db_num_rows($check_query) < 1) {
         tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');
         tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');
         tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');
         tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');
         tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');
         tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');

         tep_session_unregister('cart_PayPal_Standard_ID');
       }
     }

     return array('id' => $this->code,
                  'module' => $this->public_title);
   }

 

 

2.function confirmation() this function is for create order

if user change cart or change currency. is order have no order history will delete this order and then insert a new order.

but if address for shipping and payment changed order will delete.

 

we know yes. all is delete in the select payment page.

 

  
if ( ($curr['currency'] != $order->info['currency']) || ($cartID != substr($cart_PayPal_Standard_ID, 0, strlen($cartID))) ) {
           $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1');

           if (tep_db_num_rows($check_query) < 1) {
             tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');
             tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');
             tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');
             tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');
             tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');
             tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');
           }

 

 

function before_process() this is for update order

Please note: only this function can insert order history! and this function must be wait payment succes return back to the checkout_process.php .

 

All order information delete and insert only depend on if have order history record.

but if payment return not success will have no order histtory record in the datebase. will cost "order delete" or "delete and new order id insert".

 

 

So if payment not success return back is a nightmare

order delete no order find.

order delete and new order create. the order id not same. can not synchronization or status.

 

So remove all delete function let the order id in a row will more insurance

 

any one have idear ??

osCommerce

Archived

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

×
×
  • Create New...