Product Price Empty

Author Message

Leandro Alves

Wednesday 15 September 2004 4:59:25 am

Hello!

In my product class the <b>price is not required</b>, so I can create a product without price.

Now I want to show the price in my page only if it is greater than 0.00, <b>I don't want to display 0.00</b>

I did several test but nothing worked fine.

My code in line view

{section show=$node.object.data_map.price.content.is_empty|not}
   {attribute_view_gui attribute=$node.object.data_map.price}
{/section}

And I tested these too

{section show=$node.object.data_map.price.content.is_null|not}

{section show=$node.object.data_map.price.content|gt(0)}

{section show={$node.object.data_map.price.content|eq(0)}|not}

But any of these worked fine, the price 0.00 still appear in my page...

<b>How can I do this??</b>

Thanks a lot!
Leandro

Alex Jones

Wednesday 15 September 2004 6:31:38 am

Perhaps you could try testing the price to see if it is greater than 0..?

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Leandro Alves

Wednesday 15 September 2004 8:22:01 am

Hi Alex!

Thanks for the reply... But how can I do this???

I don't know how to test... Is the price a integer????

If I know how to test, may I can use this condition in the <i>show</i> instruction.

The gt() operator tests if one value is greater than other, but it didn't work to me.

Could somebody help me?

Thanks again!
Leandro

Alex Jones

Wednesday 15 September 2004 9:42:46 am

Hrrrrm, I was thinking of the gt operator, sorry to hear it didn't work. You mentioned that it displays '0.00', so I would assume it is an integer. Try comparing against <i>$node.object.data_map.price.data_float</i> instead.

If that doesn't do it, try viewing all of the attributes using <i>|attribute(show)</i>. It may provide some additional information that could lead to an answer.

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Leandro Alves

Wednesday 15 September 2004 11:10:22 am

Hei Alex!

Thanks a lot for your reply... :)
The <i>$node.object.data_map.price.data_float</i> works fine!!!

The code used:

{section show=$node.object.data_map.price.data_float|gt(0)}
   {attribute_view_gui attribute=$node.object.data_map.price}
{/section}

Regards
Leandro

Alex Jones

Thursday 16 September 2004 6:08:51 am

That is great to hear Leandro! I am glad I could help.

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.