Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

passing of data between checkout pages??


manuva

Recommended Posts

Posted

I need to be able to display such data as customer_name , payment_method , order_id etc.. on the page checkout_success.php

 

Why is it that a page such as checkout_confirmation.php or checkout_process.php can access all these variables, but checkout_success.php can not.

 

What do I need to add to checkout_success in order to give it access to this data.

 

I would be great if some one out there can explain this..

 

Thanks very much,

 

alex

Posted

checkout_process clears the cart at the end, so you can no longer get the order info from the session. To get the info on checkout_success, you would have to load it from the database:

  require(DIR_WS_CLASSES . 'order.php');
 $order = new order($HTTP_GET_VARS['order_id']);

And you would need to pass the order ID as well by changing

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

to

  tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'order_id=' . (int)$insert_id, 'SSL'));

on checkout_process.php

 

Hth,

Matt

Always back up before making changes.

Posted

Thanks so much for that Matt!!

 

is there any security risk in passing data in the way you suggest to pass the order_id?

 

For example would it be risky to pass a credit card number using that method?

 

If so how would you pass data that was sensitive ..

 

I'm asking because our order number is actually going to be a unique piece of information that the customer will use to receive goods.

 

Thanks again,

 

alex

Posted

Slightly I suppose. You could also add to checkout_process.php

tep_session_register('insert_id');

and use the $insert_id on checkout_success. Just remember to unregister it at the end.

 

Hth,

Matt

Always back up before making changes.

Posted

Thanks Matt.. that is working really well.

 

However, I'm a little confused..

 

How do i also retrieve data on the product that has been ordered.?. Specifacally I want to display the name and qty of product ordered.

 

Thanks again,

 

alex

Posted

The product data would be stored in the order object, assuming you created an order object from the $insert_id. Access would be the same as on the other checkout pages, e.g.

    $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']) . "\n";

should show examples of all the relevant info.

 

Hth,

Matt

Always back up before making changes.

Posted

That's what I thought Matt .. and I've been trying that.

 

in checkout_process I register the insert_id as you suggested:

 

tep_session_register('insert_id');

Posted

That's what I thought Matt .. and I've been trying that.

 

in checkout_process I register the insert_id as you suggested:

 

tep_session_register('insert_id');

 

then in checkout_success

 

I think that i create an order object? ..

 

require(DIR_WS_CLASSES . 'order.php');
 $order = new order($HTTP_GET_VARS['insert_id']);

 

Inside checkout_success I am pulling up data with no problem from

 

$insert_id 
and 
$order->customer['firstname']

 

However, any data related to

 

$order->products 
such as 
$order->products[$i]['qty']

 

Is not displaying?

 

Thanks so much for your help so far!

 

Alex

Archived

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

×
×
  • Create New...