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.

eZ debug

Timing: Jan 31 2025 01:15:33
Script start
Timing: Jan 31 2025 01:15:33
Module start 'layout'
Timing: Jan 31 2025 01:15:33
Module start 'content'
Timing: Jan 31 2025 01:15:33
Module end 'content'
Timing: Jan 31 2025 01:15:33
Script end

Main resources:

Total runtime0.0261 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.1250151.2109
Module start 'layout' 0.00540.0042 739.3359220.6719
Module start 'content' 0.00960.0151 960.00781,001.8828
Module end 'content' 0.02470.0014 1,961.890637.9922
Script end 0.0261  1,999.8828 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002710.3770140.0002
Check MTime0.00114.1587140.0001
Mysql Total
Database connection0.00072.690210.0007
Mysqli_queries0.00249.348130.0008
Looping result0.00000.057610.0000
Template Total0.00103.810.0010
Template load0.00072.697510.0007
Template processing0.00031.107510.0003
Override
Cache load0.00051.770910.0005
General
dbfile0.00249.226680.0003
String conversion0.00000.021940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs