Drupal 6 + Ubercart 2.4 : Display all orders in Order History

By BXTra |

Our online store doesn't have real time stock online due to integrated software with POS doesn't finish yet. So, we allow customer to place an order, then, contact them back if we really have those items in stock. We also keep those items waiting for them to pay. The problem is that, many times, customer that placed an order with us just don't want to pay at that time. They ignore it until we cancel that order. Then, they place another order a week later or so. That would be ok if it happens a couple times. But some customer, they do this so many times and it's hard for us to check if they re-order the same item or they just place a new order. Also to prevent some customer that come here just to play around. So, what we do is edit "Order History" to show all orders so we can check it.

What I did is to edit "uc_order.admin.inc". Path of the file should be in "/public_html/sites/all/modules/ubercart/uc_order/uc_order.admin.inc"

Edit this file from :

$result = pager_query("SELECT o.order_id, o.created, os.title, SUM(op.qty) AS products, o.order_total AS total FROM {uc_orders} AS o LEFT JOIN {uc_order_statuses} AS os ON o.order_status = os.order_status_id LEFT JOIN {uc_order_products} AS op ON o.order_id = op.order_id WHERE o.uid = %d AND o.order_status IN ". uc_order_status_list('general', TRUE) ." GROUP BY o.order_id, o.created, os.title, o.order_total". tablesort_sql($header), 20, 0, "SELECT COUNT(*) FROM {uc_orders} WHERE uid = %d AND order_status NOT IN ". uc_order_status_list('specific', TRUE), $user->uid);

To

$result = pager_query("SELECT o.order_id, o.created, os.title, SUM(op.qty) AS products, o.order_total AS total FROM {uc_orders} AS o LEFT JOIN {uc_order_statuses} AS os ON o.order_status = os.order_status_id LEFT JOIN {uc_order_products} AS op ON o.order_id = op.order_id WHERE o.uid = %d GROUP BY o.order_id, o.created, os.title, o.order_total". tablesort_sql($header), 20, 0, "SELECT COUNT(*) FROM {uc_orders} WHERE uid = %d AND order_status NOT IN ". uc_order_status_list('specific', TRUE), $user->uid);

That will be it. Now, you can see all orders placed by your customers.

 

Updated (2012.11.29)

It's a bit different in the code in Ubercart 2.10. So, what you have to do is to edit the same file in "/public_html/sites/all/modules/ubercart/uc_order/uc_order.admin.inc".

Search for the line below :

$result = pager_query("SELECT o.order_id, o.uid, o.created, os.title, SUM(op.qty) AS products, o.order_total AS total, o.order_status FROM {uc_orders} AS o LEFT JOIN {uc_order_statuses} AS os ON o.order_status = os.order_status_id LEFT JOIN {uc_order_products} AS op ON o.order_id = op.order_id WHERE o.uid = %d AND o.order_status IN ". uc_order_status_list('general', TRUE) ." GROUP BY o.order_id, o.uid, o.created, os.title, o.order_total, o.order_status". tablesort_sql($header), 20, 0, "SELECT COUNT(*) FROM {uc_orders} WHERE uid = %d AND order_status NOT IN ". uc_order_status_list('specific', TRUE), $user->uid);

Changed it to :

$result = pager_query("SELECT o.order_id, o.uid, o.created, os.title, SUM(op.qty) AS products, o.order_total AS total, o.order_status FROM {uc_orders} AS o LEFT JOIN {uc_order_statuses} AS os ON o.order_status = os.order_status_id LEFT JOIN {uc_order_products} AS op ON o.order_id = op.order_id WHERE o.uid = %d GROUP BY o.order_id, o.uid, o.created, os.title, o.order_total, o.order_status". tablesort_sql($header), 20, 0, "SELECT COUNT(*) FROM {uc_orders} WHERE uid = %d AND order_status NOT IN ". uc_order_status_list('specific', TRUE), $user->uid);

That would be it. Basically, you just need to remove the line below in the code :

AND o.order_status IN ". uc_order_status_list('general', TRUE) ." 

 

Software :
- Drupal 6.20
- Ubercart 2.4
- Ubercart 2.6 (Update 2011.08.01)
- Ubercart 2.10 (update 2012.11.29)

Add new comment

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.