How to use Computed_field as a product of an existing one? I would like to have a field (field_result) that would display a number that is the result of the product of an existing field (field_1) on the same content type (let's call it book) and a fixed number (let's say 3.5). 

My idea was to use the Computed Field module in order to display the result. After reading its Community documentation I managed to do the following:

That's what I achieved so far:


I configured field_result to accept only one value and save it on the database.
I set its value as follows:

$field_1 = field_get_items($entity_type, $entity, 'field_1');
$entity_field[0]['value'] = $field_1[0]['value'] * 3.5;
I set its $display_output as follows: $display_output = $entity_field[0]['value']


Unfortunately when I edit the node and save it I get the following notice: 


  Notice: Undefined index: value in eval()


and the field displays 0.00 as a result.

What am I doing wrong?
A NOT commonly known/used solution that might help to prevent your problem from happening, is to use the (fairly new) Math Field module (for D7), instead of the Computed Field module (so change your mind about which module to use). Some more details about this module (from its project page):


  The Math Field module defines a new field type to dynamically calculate values on entity forms. This is an alternative to Computed Field
  that does not require the use of PHP Filter.
  
  Math expression fields are dynamically updated via ajax on the entity form as soon as all necessary fields are populated. If JavaScript is disabled, the field will be evaluated when the form is submitted. The result is stored in the database when the form is submitted.


For more details (step-by-step instructions), refer to either of these links:


the (amazing!) Community documentation about the Math Field module.
the interesting article about Introducing the Math Field module, which also includes some screenprints to see it at work (such as the the add/edit form example).


Known issues

As this is a fairly new D7 module, there are still a few (known) issues with it, as mentioned also on its project page:


The cTools math expression library causes an error when using function that take more than one parameter. This effects pow(), min(), max() (#1958538: Improve math expression engine).
Math Field does not yet support multivalue options fields (checkboxes, or multiselect) (#2483453: Add aggregate functions for multivalue fields).
Math Field does not yet support Field Collections (#2573643: Support the Field Collection module).


Bonus: you would not need the "PHP filter" (IMO only that should be a valid reason to investigate this alternative) ...