Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Passing variables from checkout_success


nikkimac

Recommended Posts

I have spent the day searching for the answer to this and testing various things with no success, so decided to ask for help!

 

I want to pass the custoer id and the order id, after the custoemr has paid, to a new page so it can be used for the next step in my account processing.

 

I have managed to get the customer id to pass no problem by simply calling it in the next section of my site - it looks like customer_id is held as a session variable.

 

However, unable to get order_id to pass across to the next xection. I have tried changing checkout_success as follows: (about line 19)

 

if(tep_session_is_registered('createaccount')) tep_redirect(tep_href_link('logincheck.php','orders_id=' . $orders__id . '&orders_id=' . $HTTP_GET_VARS['orders_id']));}

 

 

logincheck.php is the page I am redirecting the customer to after processing their payment. The above code does not crash but nor does it pass the order number. I have also tried:

 

if(tep_session_is_registered('createaccount')) tep_redirect(tep_href_link('logincheck.php','orders_id=' . $orders__id));}

 

but again nothing happens. How on earth do I pick up the order number once the customer has left the payment pages so I can use it in the next stage of my programming. I do not want to have to search the database since there may be more than one entry for each customer and trying to work out the correct one is flawed with problems.

 

Help!!

 

Nikki Macfarlane

Link to comment
Share on other sites

I have spent the day searching for the answer to this and testing various things with no success, so decided to ask for help!

 

I want to pass the custoer id and the order id, after the custoemr has paid, to a new page so it can be used for the next step in my account processing.

 

I have managed to get the customer id to pass no problem by simply calling it in the next section of my site - it looks like customer_id is held as a session variable.

 

However, unable to get order_id to pass across to the next xection. I have tried changing checkout_success as follows: (about line 19)

 

if(tep_session_is_registered('createaccount')) tep_redirect(tep_href_link('logincheck.php','orders_id=' . $orders__id . '&orders_id=' . $HTTP_GET_VARS['orders_id']));}

logincheck.php is the page I am redirecting the customer to after processing their payment. The above code does not crash but nor does it pass the order number. I have also tried:

 

if(tep_session_is_registered('createaccount')) tep_redirect(tep_href_link('logincheck.php','orders_id=' . $orders__id));}

 

but again nothing happens. How on earth do I pick up the order number once the customer has left the payment pages so I can use it in the next stage of my programming. I do not want to have to search the database since there may be more than one entry for each customer and trying to work out the correct one is flawed with problems.

 

Help!!

 

Nikki Macfarlane

 

I do not want to have to search the database since there may be more than one entry for each customer and trying to work out the correct one is flawed with problems.

 

as the id is determined by mysql you will have to :

 

$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1");

$orders = tep_db_fetch_array($orders_query);

 

echo TEXT_YOUR_ORDER_NUMBER . $orders['orders_id'] . '<br><br>';

Treasurer MFC

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...