Active
Project:
Computed Field
Version:
7.x-1.0-beta1
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 May 2013 at 00:31 UTC
Updated:
20 May 2013 at 01:57 UTC
There's a great little write up on doing this for version 6.x here:
http://drupal.org/node/1106840
Does anyone have any idea of adapting this 6.x code for 7.x?
foreach (array_keys($node->field_hours_work_order) as $delta) {
if (isset($node->field_hours_work_order[$delta]['value']) && isset($node->field_per_hour_work_order[$delta]['value'])) {
$node_field[$delta]['value'] = $node->field_hours_work_order[$delta]['value'] * $node->field_per_hour_work_order[$delta]['value'];
}
};foreach (array_keys($entity->field_hours_work_order) as $delta) {
if (isset($entity->field_hours_work_order[$delta]['value']) && isset($entity->field_per_hour_work_order[$delta]['value'])) {
$entity_field[$delta]['value'] = $entity->field_hours_work_order[$delta]['value'] * $entity->field_per_hour_work_order[$delta]['value'];
}
};
Comments
Comment #1
albert9000 commentedFor future generations of Drupal users here is the answer that worked for me:
Subtotal:
Then you can grab the total: