How can I test if a price attribute is greater than 0?

Author Message

Adolfo Barragán

Friday 30 May 2003 12:11:30 am

I need test if a price attribute has a value greater than 0 for showing it or not. I try multiple variations of

{section show=$namespace:item.data_map.price|gt(0)}
or
{section show=$namespace:item.data_map.price|ne("0,00 ¤")}

but it don't work.

Paul Forsyth

Friday 30 May 2003 12:20:12 am

price has many attributes such as:

"inc_vat_price"
"ex_vat_price"
"discount_price_inc_vat"
"discount_price_ex_vat"
"price"

look at your price object by:

{$namespace:item.data_map.price|attribute(show)}

and take your pick of the objects attributes to use in your test. what you are currently doing is comparing the price object with a number or text which cannot work.

hope this helps

paul

Adolfo Barragán

Friday 30 May 2003 12:34:03 am

Ep??!!

I try
{$namespace:item.data_map.price|attribute(show)}

and I receive a server error: Server not found or DNS error ??????????

what's happen?

Paul Forsyth

Friday 30 May 2003 12:52:23 am

erm, not sure! it shouldn't return a server error...

do your other attributes get the same error?

which ez version are you using?

Adolfo Barragán

Friday 30 May 2003 1:05:06 am

> do your other attributes get the same error?
Yes, it's a class with 4 attributes, a text-line and 3 prices. If I test any attribute I receive same error.

> which ez version are you using?
I'm using 3.02 version.
If I try {$namespace:item|attribute(show)} I receive a lot of info, but nothing about attributes of class

Paul Forsyth

Friday 30 May 2003 1:09:47 am

$namespace:item is probably an object that has a data_map as an attribute and you should see your four attributes. can you confirm that $namespace:item.data_map.price is an attribute? maybe it is slightly different...

the error does sound odd. what does the error say?

ez, can you comment?

Adolfo Barragán

Friday 30 May 2003 1:18:52 am

>can you confirm that $namespace:item.data_map.price is an attribute? >maybe it is slightly different...
Yes, "price" is only a sample my object's attributes are "especie" (text-line), "frontal" (price), "craneo" (price) and "pecho" (price).

You can see the {item|attribute(show)} info at http://www.mcytp.com/index.php/user/content/view/full/120

The exact code is:
<td class="safari" valign="top">
{attribute_view_gui attribute=$category:product:item.data_map.especie}
{$category:product:item|attribute(show)}
</td>

> the error does sound odd. what does the error say?
I don't know because I haven't access to server, I have a hosting service on an external provider.
If you want I can change to cause error and you can see it

Thanks a lot

Paul Forsyth

Friday 30 May 2003 1:26:32 am

hmm,

{$category:product:item.data_map.frontal|attribute(show)}

should work.

really not sure why it is producing this error.

on the other hand, see if lines like

{$category:product:item.data_map.frontal.content.price} {$category:product:item.data_map.frontal.content.inc_vat_price} {$category:product:item.data_map.frontal.content.ex_vat_price}

work.

if it does you should be able to compare.

paul

Adolfo Barragán

Friday 30 May 2003 1:34:08 am

> on the other hand, see if lines like
> {$category:product:item.data_map.frontal.content.price}
...
> work.
> if it does you should be able to compare.

YES!!! it's work fine

Thanks a lot, I owe y0u a beer :-)

Adolfo

Bruce Morrison

Friday 30 May 2003 1:35:59 am

In relation to the error, I'm guessing that you are using IE. If so it are being spared the real error message. Go into options (under advanced I think) and turn off "Show user friendly HTTP errors" and you may get more information.

Try using
{$category:product:item.datamap|attribute(show,2)}
or
{$category:product:item.object|attribute(show,2)}

To get more data

BTW I can visit the url you have posted.

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Paul Forsyth

Friday 30 May 2003 1:48:33 am

phew! if you are at summer camp ill take you up on that!

just so you know you can always look at the template code ez have within the design/standard directory. in this case i looked at the file:

design/standard/templates/content/datatype/view/ezprice.tpl

for how they reference that datatype for viewing. this is the code the {attribute_view_gui} call will use to display that datatype.

paul

Adolfo Barragán

Friday 30 May 2003 1:49:01 am

> In relation to the error, I'm guessing that you are using IE. If so it are
> being spared the real error message. Go into options (under advanced
> I think) and turn off "Show user friendly HTTP errors" and you may get
> more information.

Yes, I'm using IE.

> BTW I can visit the url you have posted.

Thanks, but I the problem (show prices if greater than 0) is solve, and... today is holyday in Seville (Spain) and I go to beach this large weekend. So I test your proposal monday.

Regards, Adolfo

Adolfo Barragán

Friday 30 May 2003 1:52:15 am

> phew! if you are at summer camp ill take you up on that!
Sorry, I don't.

> design/standard/templates/content/datatype/view/ezprice.tpl
Yes, I modify/override this template for showing price, but I don found how test for a attribute value.

>for how they reference that datatype for viewing. this is the code the
> {attribute_view_gui} call will use to display that datatype.
Yes I use this operator for show attributes in <table>s

Regards, Adolfo

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 18 2025 11:44:52
Script start
Timing: Jan 18 2025 11:44:52
Module start 'layout'
Timing: Jan 18 2025 11:44:52
Module start 'content'
Timing: Jan 18 2025 11:44:52
Module end 'content'
Timing: Jan 18 2025 11:44:52
Script end

Main resources:

Total runtime0.0232 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0093 589.9141152.6406
Module start 'layout' 0.00930.0056 742.554739.4766
Module start 'content' 0.01490.0056 782.0313101.3672
Module end 'content' 0.02050.0026 883.398446.3047
Script end 0.0231  929.7031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003414.8134140.0002
Check MTime0.00166.7230140.0001
Mysql Total
Database connection0.00125.350410.0012
Mysqli_queries0.005021.710330.0017
Looping result0.00000.125610.0000
Template Total0.00218.910.0021
Template load0.00114.568810.0011
Template processing0.00104.297010.0010
Override
Cache load0.00083.433010.0008
General
dbfile0.00041.524080.0000
String conversion0.00000.059740.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