Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

checkout_success and dynamic variables


DarrenBull

Recommended Posts

Hi All,

 

I'm very new to osCommerce and am trying to implement alittle ROI tracking code into the checkout_success pagMy code sits at the very bottom of the checkout_success page and works fine however I would like to propagate 2 veriables with information regards the customer.

 

Can anyone please supply the PHP required to pull the customer ID and total order value?

 

The version of osCommerce I'm using is commented as follows:

 

/*

$Id: checkout_success.php,v 1.49 2003/06/09 23:03:53 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

Many thanks,

Darren.

Link to comment
Share on other sites

You can get customer id from the global $customer_id. I think the includes\classes\shopping_cart.php has all the info you need to set up this.

Link to comment
Share on other sites

Hi All,

 

I'm very new to osCommerce and am trying to implement alittle ROI tracking code into the checkout_success pagMy code sits at the very bottom of the checkout_success page and works fine however I would like to propagate 2 veriables with information regards the customer.

 

Can anyone please supply the PHP required to pull the customer ID and total order value?

 

The version of osCommerce I'm using is commented as follows:

 

/*

  $Id: checkout_success.php,v 1.49 2003/06/09 23:03:53 hpdl Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright ? 2003 osCommerce

 

  Released under the GNU General Public License

*/

 

Many thanks,

Darren.

 

$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);

 

$order_total_query = tep_db_query("select * from " . TABLE_ORDERS_TOTAL . " where class = 'ot_total' and orders_id = '" . $orders['orders_id'] . "'");

 

$order_total_result = tep_db_fetch_array($order_total_query);

 

echo 'Total Order Value: ' . $order_total_result['text'] . '<br>';

echo 'Your Customer Id: ' . $customer_id;

Treasurer MFC

Link to comment
Share on other sites

OK - I'll give it a go later tonight and let you know how I get on. Many many thanks!

 

:'(

 

$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);

 

$order_total_query = tep_db_query("select * from " . TABLE_ORDERS_TOTAL . " where class = 'ot_total' and orders_id = '" . $orders['orders_id']  . "'");

 

$order_total_result = tep_db_fetch_array($order_total_query);

 

echo 'Total Order Value: ' . $order_total_result['text'] . '<br>';

echo 'Your Customer Id: ' . $customer_id;

Link to comment
Share on other sites

OK - fantastic!! Awesome!! Many thanks... Worked great!!

 

:D

 

One little point.. could it be posisble to have the price without the currency symbol?

 

:P

 

yes,

 

echo 'Total Order Value: ' . $order_total_result['value'] . '<br>';

Treasurer MFC

Link to comment
Share on other sites

I'm doing the same roi tracking stuff... I need to figure out how to get the tax on it's own. I've managed to get the order product count, total, model numbers all into comma delmited strings so I can pass it to my tracking software. But I seem to be stumped on the tax. There doesn't seem to be any order total for tax that I can find. Do you guys have any ideas?

 

Once I get this thing done, I'm going to make a contribution for hbx webside story.

I think everyone using hitbox will find it useful. But I still need to figure out a few tidbits of info and this is one of them.

 

Kelly

 

 

Aghhh... my bad.

 

I made a mistake...  :-"

 

I don't need the customer id.. I really require the order id. Do you know how I could get that instead. Sorry .. :blush:

Link to comment
Share on other sites

Aghhh... my bad.

 

I made a mistake...  :-"

 

I don't need the customer id.. I really require the order id. Do you know how I could get that instead. Sorry .. :blush:

 

echo 'Your Order Number: ' . $orders['orders_id'] . '<br>';

Treasurer MFC

Link to comment
Share on other sites

I'm doing the same roi tracking stuff... I need to figure out how to get the tax on it's own. I've managed to get the order product count, total, model numbers all into comma delmited strings so I can pass it to my tracking software. But I seem to be stumped on the tax. There doesn't seem to be any order total for tax that I can find. Do you guys have any ideas?

 

Once I get this thing done, I'm going to make a contribution for hbx webside story.

I think everyone using hitbox will find it useful. But I still need to figure out a few tidbits of info and this is one of them.

 

Kelly

 

tax is on the product so that is stored in the orders_products table.

Treasurer MFC

Link to comment
Share on other sites

Hi,

 

When I use the suggestion below to display the price without the currency symbol, the price seems to have a few extra 0's at the end.

 

Like this 21.9900

 

Any ideas why?

 

Thanks,

Darren.

 

yes,

 

echo 'Total Order Value: ' . $order_total_result['value'] . '<br>';

Link to comment
Share on other sites

Anyone?? Please  :(

 

because that is the way it is fixed in order total.

I guess it has to do with the number of decimals as defined in your currency definition but am not sure. In any event, that value is not formatted as the text field is so you get it plain. You can alway use a round function to trim it to 2 decimals.

Treasurer MFC

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...