I had a lightbulb moment that I thought might be a way of creating a simpler content on one of my website as I'm working on the Drupal 7 version.
This would involve having more than one product reference field on the content type, however this does not work as expected.
As I see it ATM when adding a product reference field to a content type all the fields on all product entities are available on that content types Manage Display page. However if there are multiple product reference fields it shows the data from the item with the lowest SKU alphabetically and if that product does not have data in all fields it will fill them from the next product.
I notice though that the product type entity has a Manage Display settings page. On which I can set up displays, for example Node:Teaser and Node:Full Content.
My preference is that there is an option to switch off the automatic insertion of of product fields on the product display node and that there is an option in the formatter of the product reference field to select one of the displays of the product to use.
I don't know how much of an addition this would be but I think I would have quite a few use cases.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 1264178-multiple-product-reference-fields.patch | 5.38 KB | chertzog |
Comments
Comment #1
rszrama commentedThere is a checkbox on the product reference field settings form that lets you turn off automatic field injection, but you're right on the lack of support for multiple fields desiring to inject fields. Unfortunately, there's no way for us to put settings into the node's display modes for product fields because they're implemented using hook_field_extra_fields(), which just allows for the reordering and visibility, not general display settings.
Comment #2
joseph11 commentedHello,
This thread is closest thing I could find concerning the thing I'm trying to solve now. It would be great if you could give me some hints how to proceed:
I have standard node type product_display which has 2 product reference fields:
- Product (field_product)
- Product 2 (field_product2)
When I try to manage the display of "product_display" (admin/structure/types/manage/product-display/display), I would expect, that provided fields from referenced products, could be distinguishable, for example by altering field title prefix, for example like this:
- Product: Image
- Product: SKU
...
- Product2: Image
- Product2: SKU
...
I would like to use this functionality for displaying fields of "Product2" on node teaser, while displaying fields of "Product" on the full node. Is this somehow achievable? Quickly looking into the code of commerce_product_referece.module I found that "Product: " prefix is hard coded, so I guess the module does not care about distinguishing multiple product_reference fields in one display.. am I right?
If yes, I'd be thankful if you could give me some hints how to proceed when implementing this feature.
Thanks in advance.
I'm using commerce version: 1.2
Comment #3
nicolas bouteille commentedI am trying to do the exact same thing!
We have a product display called "Publishing"
This Publishing should be available in two formats : print & ship or download
Prices are different and I don't want users to have to select the format with radio buttons for the price to update.
I want both prices to be displayed along with the format.
I have created two Product types Print & Ship and Dowload.
I have two product reference fields on my Publishing content type.
However I only have one price field available on the Manage Display screen...
How can I achieve this with Drupal Commerce ?
Comment #4
troybthompson commentedI have the same need. In my case, I have events and want to sell tickets as well as sponsorships on the same event node.
Comment #5
kristofferromalso in great need of being able to display and use data from several product references on one node. For Views-based product filtering, displaying all product variations etc.
Comment #6
dpico commentedHello,
Did anyone find a solution for this? I have the same need: a display in which several different products are shown and customer should be able to add to cart one or more of them, as desired.
Comment #7
chertzogHere is a patch that addresses this issue.
Comment #8
torgospizzaPatch in #7 doesn't seem to do anything, at least in my local working copy.Comment #9
torgospizzaGot it working! In the product variation's display settings, select Rendered product from the dropdown. Then you have access to additional display modes for that variation type.
This is a really clever solution, and I think it could help us with Bundles on our site. I think it might be fairly easy to create an "Add all products to my cart" button/formatter based on this. I think that's the one remaining task for "product bundles" to be a reality in Commerce.
Thanks!
Comment #10
rszrama commentedIf I'm not mistaken, isn't this breaking backwards compatibility by changing machine names for extra fields? If I've configured their visibility settings and exported them to a Feature, after this patch, wouldn't those all be broken?
Comment #11
chertzogIt is, so display modes and things would need to be updated and features would need to be re-exported.
Comment #12
rszrama commentedOk, then we'll at least want an update path for configuration stored in the database; people managing via Features can then just re-export.