I just created the patch attached, because my client needed to have a list of all users and their orders. I'm not a Views expert so please correct me if I did something wrong or unusual.

CommentFileSizeAuthor
uc_orders_join_users.patch497 bytesmarcvangend

Comments

longwave’s picture

Status: Needs review » Reviewed & tested by the community

This patch is good.

longwave’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS, thanks for the patch!

marcvangend’s picture

Thanks for committing, I'm glad I could give something back.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jvieille’s picture

Issue summary: View changes

Also need a join to get products of a user

function uc_views_views_data() {
  // uc_order_products table
  $order_products = drupal_get_schema('uc_order_products');
  $data['uc_order_products']['table']['group'] = t('Ubercart order product');
  $data['uc_order_products']['table']['base'] = array(
    'field' => 'order_product_id',
    'title' => t('Ubercart order product'),
    'help' => t("Products that have been ordered in your store."),
  );

  $data['uc_order_products']['table']['join']['node'] = array(
    'left_field' => 'nid',
    'field' => 'nid',
  );

  $data['uc_order_products']['table']['join']['uc_orders'] = array(
    'left_field' => 'order_id',
    'field' => 'order_id',
  );

+  // missing join to get order products in users based views
+  $data['uc_order_products']['table']['join']['users'] = array(
+   'left_table' => 'uc_orders',
+   'left_field' => 'order_id',
+   'field' => 'order_id',
+ );
  
  $data['uc_order_products']['order_product_id'] = array(
jvieille’s picture

Title: join uc_orders on users » join uc_orders and uc_order_products on users
Issue summary: View changes
Status: Closed (fixed) » Needs review
marcvangend’s picture

Title: join uc_orders and uc_order_products on users » join uc_orders on users
Issue summary: View changes
Status: Needs review » Closed (fixed)

jvielle, thanks for contributing.

Short, single-topic issues are easier to review, so please don't re-open 5 year old closed and fixed issues, but instead start a new one. Also, when setting an issue to "needs review", please attach a patch file.