adding company name or other fields to the view orders page

Posts: 48
Joined: 10/02/2007
Bug FinderGetting busy with the Ubercode.

(Purchase date is a field displayed by default in the current version of Ubercart.)

In addition to adding space for a column in the header and rows arrays, you need to load the data for the column. As is, the database query retrieves only a few fields mainly from the uc_order table (order id, user id, billing first name and last name, order status, and timestamp of order creation).

We wanted to add the company name to the orders list, so I added 'o.billing_company' to the fields retrieved by the SQL query. (See the attached patch.)

If you want to add a column for shipment type, you would need to reference the uc_shipments table as well. You could try changing the database query to something like:

$sql = 'SELECT o.order_id, o.uid, o.billing_first_name, o.billing_last_name, o.billing_company, o.order_total, o.order_status, o.created, oh.shipping_method, os.title FROM {uc_orders} o LEFT JOIN {uc_shipments} oh ON o.order_id = oh.order_id LEFT JOIN {uc_order_statuses} os ON o.order_status = os.order_status_id WHERE '. $status . (($sort == NULL) ? ' ORDER BY o.created DESC' : $sort);

AttachmentSize
uc_order.company_name.diff2.18 KB