Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Im not sure if this is a flags issue or commerce. Im wondering why products isnt a regular content type. That way products would integrate with modules such as flags. Not knowing a lot about drupal and commerce, is there a reason for this choice?
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedYeah, check out http://www.drupalcommerce.org/node/49. A product's definition isn't content. A product display is content. Regardless, Flag should work with any entity type, not just nodes.
Comment #2
joachim CreditAttribution: joachim commentedHaving taken a look at #1035410: Flag any entity, I reckon that because product entities don't have a direct view page but just a form, we're going to need so do some extra integration to get the flag widget into the product form.
Comment #3
rszrama CreditAttribution: rszrama commentedJust a bit of maintenance on the title / tags.
Comment #4
joachim CreditAttribution: joachim commentedI'm working on this at the moment.
Blocker: #1689538: product form has entity ID as '' rather than NULL.
Comment #5
joachim CreditAttribution: joachim commentedShould all be working now.
Comment #7
sambaynham CreditAttribution: sambaynham commentedAfter a morning' hacking, I've found out that you can make this happen by embedding flag_create_link('flag_name',$product_id) in a hook_form_alter for whatever add to cart form you're using. It ain't elegant, but it works!
In future, I imagine it'll be a matter of placing a more elegant version of this code in the hook_widget_view of the flag module's add to cart form.
Peace
Sam B
Comment #8
Sinan Erdem CreditAttribution: Sinan Erdem commentedI am using Display Suite in the product display. How can I put a flag link so that when the user uses the link, he flags a product variation (entity) instead of node?
Comment #9
Sinan Erdem CreditAttribution: Sinan Erdem commented@Sam B, can you please share how do you get the product_id?
Comment #10
Sinan Erdem CreditAttribution: Sinan Erdem commentedI wrote a way to use Flag with the product displays here: #1911568: How is this module different from Flag module?