Posted by vasike on September 13, 2012 at 11:07am
7 followers
| Project: | Drupal Commerce |
| Version: | 7.x-1.x-dev |
| Component: | Product reference |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | kickstart blocker |
Issue Summary
build a new formatter for Product reference, "Rendered product" the same as "Rendered entity" formatter for Entity Reference.
This will display the referenced products rendered by entity_view(), using the selected "view mode" of the formatter.
Comments
#1
and here is the patch (based on EntityReference code).
#2
I'd love this feature; however, it'd be nice to have the option to still include the Add to Cart form with it. Perhaps the rendered entity should be pulled in as an extra pseudo-field, rather than as a formatter for the product reference field?
#3
Would it work in your case to use a Views block that renders the product entity, Jesse?
#4
It may; but I'd need the Views block to be able to be updated when the user changes the value of the Add to Cart dropdown.
#5
EDIT: Oops, dupe comment. (It gave me an error when I first posted it.)
#6
#2 is a feature request that is off topic for this issue, and even if it was in it's own issue, I'd consider it a won't fix. We inject product fields into the node display just so that you can display anything (product-related) you want before / after the add to cart form.
This change definitely needs to be a formatter, no way around it.
#7
We need this in order to spin off Add to cart confirmation as a contrib module.
#8
This isn't a bug in Commerce as far as I can tell, but are you guys not seeing this when you try to view an entity with a rendered product in its content?
Notice: Undefined variable: url in include() (line 35 of /Users/rszrama/src/git/drupal/entity/entity.tpl.php).#9
Additionally, commerce_product_reference_field_formatter_prepare_view() is a little aggressive at the moment, in that it's going to run for any field formatter defined by commerce_product_reference.module and not just the new "Rendered product" display formatter.
Updates should go against the attached patch.
#10
here is a patch that adds an extra check for the display type (formatter) in the commerce_product_reference_field_formatter_prepare_view() function
#11
Excellent. Gave it another option to change the $page parameter passed to entity_view() and added a hook function until a new release comes out for Entity API; see #1601162: Undefined variable: url in entity.tpl.php. Thanks!
#12
Automatically closed -- issue fixed for 2 weeks with no activity.