Share » Forums » Install & configuration » ezfloat attribute type decimals number ?

ezfloat attribute type decimals number ?

ezfloat attribute type decimals number ?

Thursday 18 November 2010 8:46:04 am - 7 replies

Modified on Thursday 18 November 2010 8:46:43 am by H-Works Agency

Author Message

Gaetano Giunta

Sunday 21 November 2010 1:43:49 pm

Not really sure, but you might find some related info here: http://issues.ez.no/IssueView.php?Id=15116&activeItem=30

Principal Consultant International Business
Member of the Community Project Board

H-Works Agency

Thursday 25 November 2010 3:31:46 am

Thanks but the topic you provide is about ezmultiprice, not about ezfloat.

Does anybody know how to store 3 decimals for ezfloat attribute ?

EZP is Great

Steven Bressey

Friday 26 November 2010 3:35:41 pm

Hi Martin,

I have the exact same problem : I need to store 3 decimals float numbers in many objects, but after saving my object and going back to edit it, I can only see a 2 decimals number.

I checked in the ezcontentobject_attribute table in the mysql database and the value is still stored with 3 decimals. That is at least reassuring.

What embarasses me more is that if I edit my object again (in order to change some other attribute value fo example), my float attribute value is stored with only 2 decimals in the database, if I forget to put the 3 decimals value AGAIN and everytime I wish to edit my object.

I think there is an issue here , so if anyone could tell us if there is a setting somewhere to force the attribute value in back office to show more than 2 decimals, it would be nice.

http://www.alma.fr

H-Works Agency

Sunday 28 November 2010 5:02:49 am

Hi Steven,

Yes the good news is that db value isn't rounded.

Rounding must then happen thru a template operator both in front and admin siteaccess.

That would explain why db value is rounded when you resubmit your object form.

I am gonna try to find the solution and will keep you informed.

EZP is Great

Steven Bressey

Sunday 28 November 2010 5:18:59 am

OK, thanks Martin.

I'll keep digging on my side too, and will keep you informed as well if I find anything interesting.

http://www.alma.fr

H-Works Agency

Wednesday 08 December 2010 7:13:40 am

Hello,

The problem is due to the l10n('number') transformation.

To modify number of digits you have two solutions :

- Tedious but clean : Overriding content/datatype/edit/ezfloat.tpl templates and removing "l10n('number')"

- Simpler but dirty : Editing ./share/locales/eng-GB.ini => [Numbers] FractDigits=4 (instead of 2 if you want 4 decimals).

Why dirty ? : In this case you edit an install wide variable. You thus can't override this variable on a per-siteaccess basis (which would be a great feature).

EZP is Great

Steven Bressey

Wednesday 08 December 2010 11:19:25 pm

Hi Martin,

Thanks a lot for the information. I chose the 2nd solution as I also have some calculated float fields which Id' like to show on the website with 3 decimals, and therefore needed to specify somewhere the number of decimals to show when using l10n function.

But it's true that I'd rather override the locale configuration (in my own extension for example, which would be the cleanest way) than edit the install variable.

Anyway, thank you for the solution.

http://www.alma.fr

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu