1

Let me start off by saying that I am ultimately trying to get the product display from a line item. I would use commerce_rules_extra, which has a feature that is supposed to do this, but I could not get it to work. So I am trying to get the product display node for the product.

My strategy is to create a simple Rules Component that returns all product display nodes that reference a given product.

My component accepts a parameter of type: Commerce Product

My component has a Condition: Data comparison: Product:type - equals - "Product"

My component has an Action:

  • Fetch entity by property, Entity type: Node, Property: Product (I believe this is the product reference field)

When I attempt to set the Value as the component's Parameter "Product", the action will not accept this—instead it gives this error:

The data type of the configured argument does not match the parameter's value requirement.

This would be the typical method for fetching nodes by property on an entityreference field but I can't do the same with this productreference field. Any hints would be greatly appreciated.

1

Have a look at Action "Fetch entity by property" does not allow to fetch by multi-valued properties, which appears to be similar to what your question is about (and has RTBC status).

If I'm right, try the patch attached to it.

  • Thank you! You are correct, it was because I had my product reference field set to Unlimited values. I only needed a single-value reference for my use-case, so I switched it to a single value field. Now my rule strategy works as expected and I have a working component that accepts a line item and fetches the product display node by the product on the line item. Cheers. – Link Swanson Jul 5 '16 at 19:44
  • @LinkSwanson : aha, that's an example of solving a problem by preventing it from happening ... But of course for that you need to first find out what is causing it. And understanding the problem is often at least 50% of the solution, right? Anyway: santé ! – Pierre.Vriens Jul 5 '16 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.