Download & Extend

Product nid and/or title as argument

Project:Ubercart Views
Version:6.x-2.0
Component:Code
Category:bug report
Priority:normal
Assigned:madsph
Status:closed (fixed)

Issue Summary

I need to generate a view in which orders are filtered by a product nid (supplied as an argument). So if such-and-such a product nid is present, show the order. However, there doesn't seem to be a way to get at product nids in uc_views, either as an argument or as a field or anything else. Product SKUs are there, so I presume this can't be terribly difficult. Anyone got a solution?

Comments

#1

Products are nodes, so you should be able to use the Node nid.

I just tried it before writing this though, and there seems to be some sort of error. I am looking in to it right now, and will get back to you.

#2

Category:support request» bug report
Assigned to:Anonymous» madsph
Status:active» needs review

Found the bug. Orders where joined with nodes on the order_id field which of course is nonsense.

I have corrected this and checked in to cvs.

If you can't check out from cvs then what you need to do is:
Open the /uc_views/views/uc_views.views.inc file and locate

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

In my version this is around line 388 (but depending on which version you are using this could vary a little).

Change 'order_id' to 'nid' in both places so you get:

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

Thanks for reporting this issue.

#3

Sweet. Thanks for the timely response!

#4

Status:needs review» closed (fixed)
nobody click here