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.