Project:Computed Field
Version:5.x-1.2
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi!

I'm trying to display floating point numbers (money, that is) with two decimals with no luck. All trailing decimal zeros get cut off. Is there any way to work around this? Other number formatting functions such as round() or ceil() work with no probs.

Sample:

$sum = $node->field_t1_pieces[0]['value'] * $node->field_t1_price[0]['value'];
$node_field[0]['value'] = number_format($sum,2);

Cheers,
Mikko

Comments

#1

Category:bug report» support request
Status:active» closed (fixed)

I suspect that's the fault of having the incorrect field type. Make sure you defined the field as a decimal, not an integer.

Closing anyway because 5.x isn't supported anymore. You'll have to reproduce it in 6.x to re-open this.

nobody click here