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

rszrama’s picture

Status: Active » Closed (works as designed)

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

joachim’s picture

Component: Product » Contributed modules
Category: support » feature
Status: Closed (works as designed) » Active

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

rszrama’s picture

Title: Integrate with flags » Integrate with the Flag module
Status: Active » Postponed
Issue tags: -Content type, -flags, -Commerce (duplicate)

Just a bit of maintenance on the title / tags.

joachim’s picture

Assigned: Unassigned » joachim

I'm working on this at the moment.

Blocker: #1689538: product form has entity ID as '' rather than NULL.

joachim’s picture

Status: Postponed » Fixed

Should all be working now.

Status: Fixed » Closed (fixed)

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

sambaynham’s picture

After 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

Sinan Erdem’s picture

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

Sinan Erdem’s picture

@Sam B, can you please share how do you get the product_id?

Sinan Erdem’s picture

I wrote a way to use Flag with the product displays here: #1911568: How is this module different from Flag module?