Posted by setvik on June 8, 2009 at 2:53pm
Jump to:
| Project: | Ubercart Views |
| Version: | 6.x-2.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | madsph |
| Status: | closed (fixed) |
Issue Summary
The table gets stripped from fields in the views query for oc_orders fields; this breaks node queries where the included oc_orders fields have the same name as a field in another table (e.g. created)
To reproduce error:
- create a node view, add a page display, and set the path
- add any node field (node title for example)
- add the Ubercart Order: Order Creation Date
Save and view the new view.
The problem is due to some errors in how uc_orders is joined with the node table in hook_views_data()
See attached fix.
| Attachment | Size |
|---|---|
| uc_views.views_.tablejoin.patch | 800 bytes |
Comments
#1
I think this is a duplicate of #465420: Product nid and/or title as argument - although I think you make the join slightly different in your patch. I can't reproduce the bug though with my version so I think it is fixed.
In the current branch (not released yet - but in cvs) the join is made in the following way:
$data['uc_order_products']['table']['join'] = array('uc_orders' => array(
'left_field' => 'order_id',
'field' => 'order_id',
),
);
$data['node']['table']['join'] = array(
'uc_orders' => array(
'left_table' => 'uc_order_products',
'left_field' => 'nid',
'field' => 'nid',
),
'uc_order_products' => array(
'left_field' => 'nid',
'field' => 'nid',
),
);
$data['uc_orders']['table']['join'] = array(
'node' => array(
'left_table' => 'uc_order_products',
'left_field' => 'nid',
'field' => 'nid',
),
'uc_order_products' => array(
'left_field' => 'order_id',
'field' => 'order_id',
),
);
Can you verify that that solves your issue, or am I reproducing it wrong?
#2
This did the trick for me -- thanks for affirming that the problem was the node/uc_orders join.
(For others having problems, my symptom was plainly that as soon as I added the order created date as a filter, the view was trying to join node to uc_order_products using the order_id field, and obviously no such column exists in the node table.)
#3
Great - thank you for reporting :-)
#4
Automatically closed -- issue fixed for 2 weeks with no activity.