How to get an object of Order (or something similar - details of an order!) by providing order id? Perhaps, some kind of code like: $order = order_load($orderId);

I'm new to Ubercart (3.x)/Drupal (7.x) and searched the title but found no solutions.

I need to create a view/page by custom module which displays "My Purchases" or "My Sells"

I need to get complete Order details, by providing order-id. Also need the creator/seller and buyer info of the order.

Can someone give me some PHP example/other ways possibly using a View?


Using the Ubercart API at api.ubercart.me, it is

$orders = uc_order_load($orderId);

$orders is an array, so $order = $orders[0];

See: http://api.ubercart.me/api/drupal/ubercart!uc_order!uc_order.module/function/uc_order_load/7


You can use this as well

$result = db_query("SELECT order_id FROM {uc_orders} WHERE order_status 
IN ('abandoned', 'pending') ");
$deleted = 0;
 foreach($result as $row){
drupal_set_message($deleted . ' Abandoned or Pending Orders deleted', 'status');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.