Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have a node View, which pulls product through Relationship with referenced product. This works well.
Where it fails - my product (CD) have product reference fields (Tracks) and these would not pull through Relationship. After looking into actual SQL query run on DB, I think there is minor bug with declaration, although I am not too good with Views, so please review attached patch and let me know what do you think.
View I am using also attached.
Comment | File | Size | Author |
---|---|---|---|
#8 | 1576570.reverse_product_reference_relationship.patch | 2.54 KB | rszrama |
#2 | product_reference_views.patch | 1.29 KB | pavel.karoukin |
albums_tracks_view.txt | 10.18 KB | pavel.karoukin | |
product_reference_views.patch | 1.27 KB | pavel.karoukin | |
Comments
Comment #2
pavel.karoukin CreditAttribution: pavel.karoukin commentedanother try with patch to pass auto test.
Comment #3
pavel.karoukin CreditAttribution: pavel.karoukin commentedproduct_reference_views.patch queued for re-testing.
Comment #4
rszrama CreditAttribution: rszrama commentedCan you post an export of the View used to generate the error and the product type configuration we should have to test this out?
Comment #5
vasike@scrypt : you can use Features and Commerce features to export all the configurations Ryan (rszrama) asked for.
Comment #6
cvangysel CreditAttribution: cvangysel commentedThe current implementation does seem incorrect - but the problem would on present itself when using a product_reference field on a product bundle. I agree with #2, but at the same time it really is a (minor) API change. However, I tried to create situations where this patch could break stuff and I didn't came across anything.
Comment #7
rszrama CreditAttribution: rszrama commentedI think I get the second hunk, but I'm not so sure about the first. For the field schema, the entity_id is the ID of the entity the product reference field is attached to. So it seems like you're be trying to join from the left product_id to the right nid (or whatever ID of the entity the field is on). Are we sure it isn't correct to have it joining to the [field_name]_product_id in the first hunk?
Comment #8
rszrama CreditAttribution: rszrama commentedAlrighty, I finally managed to create a scenario that illustrated the broken behavior with some reverse product reference relationships and products referencing products. It turns out I was right about hunk 1 above, but that removing it made the reverse relationships break. Even more, it turns out that our reverse relationship code was just crazy old and probably never functioning. If it worked before, it must have been a fluke of entity IDs and product IDs.
Views actually provides a reverse entity relationship handler that we should be using instead, as illustrated by the Entity Reference module. I've changed this, completely removed the code affected by hunk 1 above, and then updated the various interface text to be more useful.
Comment #9
rszrama CreditAttribution: rszrama commentedCommitted.