Forums / Setup & design / can't get price datatype to show in generated web page

can't get price datatype to show in generated web page

Author Message

nigel dodd

Friday 15 October 2004 6:38:51 am

In a class I define a field (id mealprice) to have the datatype Price. After putting in some data the backend shows the price correctly with the £ currency symbol. The template to show this in the frontend is:

    <tr>
        <td><b>{$node.object.data_map.mealprice.contentclass_attribute.name}:</b></td>
        <td>{attribute_view_gui attribute=$node.object.data_map.mealprice}</td>
    </tr>

however the generated page shows the attribute name "Price" but no value or £ sign. Other fields eg TextLines show up correctly. I specified the UK locale when I set up ez.

I am relatively new to ez so the answer is probably obvious to somebody with more experience.

[email protected]

Lazaro Ferreira

Friday 15 October 2004 6:18:19 pm

Hi,

Enable ezp debug output , and check it for any error or warning related

to enable debug output go to your site.ini.append.. file and add the lines

[DebugSettings]
DebugOutput=enabled

clear your templates cache after that

The line below is rendered by another template : .../content/datatype/view/ezprice.tpl

{attribute_view_gui attribute=$node.object.data_map.mealprice}

Lazaro
http://www.mzbusiness.com

Paul Forsyth

Saturday 16 October 2004 2:34:05 am

Its always worth looking at how eZ do this. Look at:

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

to see how the price is rendered. In this case you will need to '|l10n(currency)' to your line to render it correctly.

paul

nigel dodd

Saturday 16 October 2004 5:07:50 am

Thanks, but

<tr>
    <td><b>{$node.object.data_map.mealprice.contentclass_attribute.name}:</b></td>
    <td>{attribute_view_gui attribute=$node.object.data_map.mealprice|l10n(currency)}</td>
</tr>

still produces a blank output. Just to confirm, the first char of l10n is a lowercase L?
Additional experiment:

<tr>
   <td><b>{$node.object.data_map.pricefloat.contentclass_attribute.name}:</b></td>
   <td>{attribute_view_gui attribute=$node.object.data_map.pricefloat|l10n(currency)}</td>
</tr>

where now the datatype of pricefloat is a Float (instead of Price), also results in blank output, however removing the |l10n(currency) pipe causes it to be rendered correctly. What is the fundamental datatype of Price? Is it float? Why does the |l10n(currency) not work on a float? Why is there blank output of the Price datatype with and without the pipe?

In the Content view in the backend the mealprice is correctly rendered:
Price
Price £ 15.00
so the data has been input correctly but I still cannot get it to render in the frontend.

I have (according to the second reply in this thread) activated eZ debug and so can see if there are synatax errors. In the egs above there are no syntax errors reported.

Any help greatly appreciated

[email protected]

nigel dodd

Monday 18 October 2004 3:52:09 am

It was a path problem. I had set the AdditionalSiteDesignList[]=mynewsite instead of base and so it failed to find price.tpl under the base tree.

There are no reports of templates not found any more and the currency displays ok with or without the pipe to l10(currency). However I now get an eZ debug warning:

Operator 'l10' is not registered

So I wonder what that means and how do I register it?

[email protected]

Frederik Holljen

Monday 18 October 2004 4:00:31 am

try using "l10n" not "l10".