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

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

eZ debug

Timing: Jan 18 2025 05:08:44
Script start
Timing: Jan 18 2025 05:08:44
Module start 'content'
Timing: Jan 18 2025 05:08:45
Module end 'content'
Timing: Jan 18 2025 05:08:45
Script end

Main resources:

Total runtime0.8786 sec
Peak memory usage4,096.0000 KB
Database Queries226

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0100 587.8594180.8125
Module start 'content' 0.01000.7386 768.6719693.4766
Module end 'content' 0.74860.1300 1,462.1484344.4297
Script end 0.8785  1,806.5781 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.4656210.0002
Check MTime0.00160.1810210.0001
Mysql Total
Database connection0.00320.367410.0032
Mysqli_queries0.776588.37792260.0034
Looping result0.00210.23812240.0000
Template Total0.843996.020.4219
Template load0.00220.245520.0011
Template processing0.841795.797320.4208
Template load and register function0.00020.023410.0002
states
state_id_array0.00110.120410.0011
state_identifier_array0.00070.081720.0004
Override
Cache load0.00190.21861050.0000
Sytem overhead
Fetch class attribute can translate value0.00160.177640.0004
Fetch class attribute name0.00120.1361140.0001
XML
Image XML parsing0.00100.111940.0002
class_abstraction
Instantiating content class attribute0.00000.0028140.0000
General
dbfile0.00620.7088270.0002
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
13content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
22content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
14content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 52
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs