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.

Files: 
CommentFileSizeAuthor
#8 1576570.reverse_product_reference_relationship.patch2.54 KBrszrama
PASSED: [[SimpleTest]]: [MySQL] 3,557 pass(es).
[ View ]
#2 product_reference_views.patch1.29 KBpavel.karoukin
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es).
[ View ]
albums_tracks_view.txt10.18 KBpavel.karoukin
product_reference_views.patch1.27 KBpavel.karoukin
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch product_reference_views.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Status:Needs review» Needs work

The last submitted patch, product_reference_views.patch, failed testing.

StatusFileSize
new1.29 KB
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es).
[ View ]

another try with patch to pass auto test.

Status:Needs work» Needs review

product_reference_views.patch queued for re-testing.

Can you post an export of the View used to generate the error and the product type configuration we should have to test this out?

Status:Needs review» Postponed (maintainer needs more info)

@scrypt : you can use Features and Commerce features to export all the configurations Ryan (rszrama) asked for.

The 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.

Version:7.x-1.3» 7.x-1.x-dev

I 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?

Title:Views integration issue - probably relations described incorrectly for product_referenceViews reverse relationship handler for Product Reference fields not working
Status:Postponed (maintainer needs more info)» Needs review
StatusFileSize
new2.54 KB
PASSED: [[SimpleTest]]: [MySQL] 3,557 pass(es).
[ View ]

Alrighty, 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.

Status:Needs review» Fixed

Committed.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.