Hi guys,

Here's what I want to happen...

I'm selling eBooks and certain ones have been discounted. In my CCK I enter the current price of the eBook (field_ebook_price) and if the eBook is currently on sale I enter the 'was' price (field_was_price).

On my page I want to show "Was: (was price), Now: (current price), You Save: (was price - current price).

To get the value for 'You Save' I made a computed field with the following settings...

Computed Code:
$node_field[0]['value'] = $node->field_was_price[0]['value'] - $node->field_ebook_price[0]['value'];

Display Format:
$display = '$' . $node_field_item['value'];

...and stored in the database using these settings:
Data Type:
float

Data Length:
10,2

Default Value:
0.00

Not Null: (yes)

Sortable: (yes)

But I can't get it to show up on my page. What php code should I use? I've tried the following with no luck...

print $node->content['field_you_save']['#value'] (which is listed in the variables for Contemplate).
print $node->field_you_save[0]['view'];
print $node->field_you_save[0]['value'];
print $node_field_item[0]['view'];

...and probably 20 other variations.

I tried disabling my contemplate them for the eBooks pages and it still didn't work even though the 'display fields' values were all set properly.

Please help.

Comments

codenamerhubarb’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Tmanagement’s picture

Do you have a solution yet? It seems that I have the same problem.

codenamerhubarb’s picture

Title: Computed Field not showing with or without contemplate activated » FIXED: Computed Field not showing with or without contemplate activated

What I had to do was resubmit all my CCK nodes. For me this wasn't such a big issue because I only had about 10 since my site was only new. If you have several nodes and it would be too hard to resubmit them all I think there's an alternative way to do it by clearing some cache tables in your SQL database. I'm not sure as I've never done this.

Does anybody know an easy way to re-submit CCK nodes?