2

I would like to evaluate line_item -> quantity before line_item is saved.

I've created a rule firing on "before line item saved" event.

I've added 2 actions:

  1. Action variable_add (evaluating desired quantity of line item)

  2. Action data_set. Setting data to commerce-line-item:quantity from variable, created in the first action

I'm always getting Rules evaluating log. This is an excerpt:

0 ms Rule Evaluate quantity fires.

0.497 ms Evaluating the action variable_add. [edit]

0.736 ms Added the provided variable variable_added of type decimal [edit]

1.968 ms Evaluating the action data_set. [edit] 69.962 **ms *Unable to modify data "commerce-line-item:quantity": Invalid data value given. Be sure it matches the required data type and format*.

72.107 ms Unable to evaluate action data_set. [edit]**

72.286 ms Rule Evaluating quantity has fired.

How to fix this error?

May I use substitutions (e.g. [commerce-line-item:quantity] etc) in PHP evaluation in 1, 2 actions? May I call functions (e.g. drupal_set_message() etc)?

  • Use the "set message" action under the 'System' section of actions and output the value of the variable to make sure it's an integer! That should help with troubleshooting... – Boriana Ditcheva Feb 28 '13 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.