Support » Plugin: WP eCommerce » Retrieve order details after transaction with mysql_query();

  • WPSC Version :
    Theme – Custom


    After a transaction has been successfully placed on wpsc-transaction_results.php, i’m trying to retrieve the customers order details to carry out further calls to other API’s. So I need to get all the order and customer details. I’ve scrambled the below together from various forums, however it’s in-consistent and since upgrading from to, the mysql_query() call isn’t returning anything.

    If anyone has any better, more reliable solutions to getting a customers order after a successful transaction, please let me know!



    // Get order id
    $billing_details = wpsc_get_customer_meta();
    $order_id = $billing_details['_wpsc_cart.log_id'][0];
    //Get product details
    $result_product_id = mysql_query("SELECT * FROM ". WPSC_TABLE_CART_CONTENTS ." WHERE purchaseid = '".$order_id."'");
    while($row_product_id = mysql_fetch_array($result_product_id)) {
    	$prodid = $row_product_id['prodid'];
    	$product_name = $row_product_id['name'];
    	$product_quantity = $row_product_id['quantity'];
    	$product_price = $row_product_id['price'];
    	$product_price_quantity = $product_price*$product_quantity;
    $sessionid = $_GET['sessionid'];
    $purchase_log_object = new WPSC_Purchase_Log( $sessionid, 'sessionid' );
    $purchase_log = $purchase_log_object->get_data();
    echo 'Product ID: ' . $prodid;
    echo 'Product Name: ' . $product_name;
    echo 'Quantity: '  . $product_quantity;
    echo 'Product Price: ' . $product_price;
    echo 'Total Price: ' . $product_price_quantity;
    echo 'Customer details: ';

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Retrieve order details after transaction with mysql_query();’ is closed to new replies.