I think the correct label would be "Line item product contains specific terms ID".
The reason I want this to be changed is that I would like to create a module that extend this one by looking into custom line items terms (and not product terms).
With Commerce Customizable Products, you can add term reference field to a line item and expose them to the cart form.
My purpose is to have a condition which will be "Line item contains specific terms ID", and which actually look into line item entity (and not product attached to) for taxonomy fields.
For example, for a tour registration product, you could add discount conditions with a select form (age, pass, resident, etc...) which change the price of the line item, without having to create all combination of product.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

camdarley’s picture

Assigned: Unassigned » camdarley
Status: Active » Needs review
FileSize
5.86 KB

Ok, instead of a new module, I made a patch covering this issue.

  • I renamed the label to "Line item product contains specific terms ID"
  • The rule condition now check the type of the entity (commerce_product or commerce_line_item) instead of bundle, to handle custom entities of each type.
  • I added a new condition to handle line items terms

It seems to do the job.

jkuma’s picture

Title: "Line item contains specific terms ID" label should be renamed » Handle custom line item types
Assigned: camdarley » jkuma
FileSize
4.37 KB

Hi camdarley,

Thanks for your contribution, but your patch doesn't follow the guidelines exposed in commerce_product.inline_conditions.inc. Indeed, you are sorting out the taxonomy fields from commerce_line_item entity type without testing if it's related to a product (=> if commerce_product field is attached). I can't commit your patch for that reason.

However, I've decided to refactor the conditions build callbacks and support the custom line item types as exposed in Commerce Customizable Products.

Your issue should be fixed with the patch attached. This patch works for every line item types that implement a commerce_product field, so I don't test the bundle anymore, but I check if the commerce_product field is attached on the passed entity.

jkuma’s picture

Title: Handle custom line item types » Handle product line items
jkuma’s picture

Title: Handle product line items » Support custom product line items
jkuma’s picture

Status: Needs review » Reviewed & tested by the community
jkuma’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Pushed into 7.x-1.x branch