I'm using the 7.x-2.x version of uc_coupon, but I noticed this still exists in 7.x-3.x.

I've come across an issue where the uc_coupon table fields throw an error when I add them to a view. I've defined the view based off of the uc_orders table, and in the fields selection, the Coupon group successfully shows with all fields. But when I add any of those fields to the view, it throws a SQL error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'uc_coupons.order_id' in 'on clause'

After some debugging, I figured out the issue is with the views join definition. where LEFT JOIN {uc_coupons} uc_coupons ON uc_coupons_orders.oid = uc_coupons.order_id is defined.

I updated the join with the attached patch, and the field showed successfully. I'm wondering how this issue has not arisen previously, or maybe I'm missing something?

CommentFileSizeAuthor
uc_coupon_views_fix.patch488 bytesRayCascella
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

Status: Active » Reviewed & tested by the community

This solves the problem, thank you.