Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a view that is listing Nodes that reference line items. I'm creating a relation to orders that contain the line item, and I want to display the most recent payment transaction on that order. When I add a "Commerce Order: Representative payment transaction" relationship to the view, it's returning the following SQL error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'commerce_order.order_id' in 'where clause'
I've attached a dump of my view.
Comment | File | Size | Author |
---|---|---|---|
view_export.txt | 5.77 KB | emarchak |
Comments
Comment #1
emarchak CreditAttribution: emarchak commentedComment #2
periksson CreditAttribution: periksson commentedHi,
I get the same error when creating reporting views for our store. We use the commerce payment transaction create date as our "order date".
Looks like several modules have had issues like these. My best guess is that there is something going on in commerce/modues/payment/includes/views/handlers/commerce_payment.views.inc
Maybe someone who understands this can tell what's going on. This hack at least got me some data in my particular query (it probably brakes everything else, but it might be an entry point for checking the documentation etc):
Best
Eric
Comment #3
jnicola CreditAttribution: jnicola commentedSo I took a quick gander at this. I wasn't able to make the view import work, nor was I able to ascertain exactly what you are doing from the description. This may be my own issue however :)
Could you perhaps create a view that will create the SQL error you mention that will work right out of the box in Commerce Kickstart 1.x with it's sample content, alogn with including any directions to reproduce there? I can then take a look at everything clearly and try and work on the problem for you :)
Comment #4
LeDucDuBleuet CreditAttribution: LeDucDuBleuet commentedUnfortunately, the hack in #2 does not work for us. I have tried to find another solution but it is beyond me for the time being.
To reproduce the problem, simply add a "Representative payment transaction" relation to the default product report view that comes with the commerce report module : admin/commerce/reports/products
Thank you.
Comment #5
rszrama CreditAttribution: rszrama commentedTagging for http://contribkanban.com/#/board/commerce/7.x-1.x.
Comment #6
nvahalik CreditAttribution: nvahalik at Centarro commentedThis is a bug in Views' views_handler_relationship_groupwise_max class.
Comment #7
nvahalik CreditAttribution: nvahalik at Centarro commentedHere is the related bug: #2295379: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.uid1' in 'where clause'
Comment #8
nvahalik CreditAttribution: nvahalik at Centarro commentedComment #9
joegl CreditAttribution: joegl commentedThe error has cropped up again for me, when running Views 3.20 with Commerce 3.14. It's specifically related to the Representative Payment Method relationship. I am not sure if this is an issue with Views or Commerce Views Integration. The SQL error is exactly the same:
I have reproduced the issue on two separate production sites.
Comment #10
joegl CreditAttribution: joegl commentedApologies to re-open and close this issue right away. From all I have discovered it appears to be a borked views handler for "Representative Node" relationships in Views 3.20. See the Related Issue in Views for more info.