hi there,

-set up a custom product-type (line-item) in commerce name 'downloads'
-attached a new field to the line-item-type name 'field_key' shall be used to issue a string after
successfull payment, and be hidden to all users except superusers, standart value: 10
-created a product of type download for testing
created a contenttype for it and published
- TRIED to create a rule :

{ "rules_issue_key" : {
    "LABEL" : "issue key",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "download", "key" ],
    "REQUIRES" : [ "rules", "commerce_payment" ],
    "ON" : [ "commerce_payment_order_paid_in_full" ],
    "IF" : [
      { "entity_has_field" : {
          "entity" : [ "commerce-order:commerce-line-items:0" ],
          "field" : "field_key"
        }
      }
    ],
    "DO" : []
  }
}

want to create an action to fill the field_key with an other string
but the field_key wont appear in the data selector

Comments

cocacool’s picture

Assigned: cocacool » Unassigned
cocacool’s picture

... but even if the rule ui woud let me assign the action
it would do nothing cause the field_key is not detected by the cart even if its
part of the product-type (commerce line item)

action log:

0 ms Reacting on event When an order is first paid in full.
0.177 ms Evaluating conditions of rule issue key. [edit]
0.412 ms The condition entity_has_field evaluated to FALSE [edit]
0.417 ms AND evaluated to FALSE.
0.427 ms Finished reacting on event When an order is first paid in full.

any ideas?

TR’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

the field_key is not detected by the cart even if its part of the product-type

This really doesn't seem to be a Rules issue - it sounds like a problem with the commerce order entity. Regardless, support questions for the commerce module should be asked in the commerce issue queue.

If this is still a problem for you, and if you can reproduce the problem using core Drupal entities (for example, with a field on a Article content type), then please post steps for reproducing the issue, as well as an export of the misbehaving rule. It's very difficult to reproduce problems that involve a complicated site setup and customization like you have with commerce, and if it's really a Rules bug then it should be reproducible with core Drupal entities.