This must be a fairly standard sort of thing: I want to create a simple tabular list of products, each one with a title, a description, a picture and a price. I chose the number module to display the price, but find that the display leaves much to be desired. For, here are some things I would like to do

  • Always display two decimal places (eg if the price is "20" then display "20.00")
  • display a currency (eg € or $) with the price
  • Have the price align automatically to the right in the table

Unfortunately, there doesn't seem to be any way to do this, nor does it complain if I do something "wrong" - for example, I tried entering "€20.00" and it let me do it - but then the resulting value was just "0"!

Am I missing something?

Comments

joel_guesclin’s picture

Title: Is it possible to theme a Decimal field as currency in a View? » Theme a Decimal field as currency in a View?

Title was too long! Still hoping for an answer by the way...

karens’s picture

Status: Active » Fixed

When you create or edit the number field, you can give it a prefix, so enter the euro or dollar sign there. Decimals are controlled by the format you choose. When you add the field to a view, choose the format that has the right number of decimals. Right-aligning a value in a Views table has to be done in css or your theme, you'll have to read up on how to do that somewhere else, that's not a CCK issue.

All of those features are available in 4.7.x-1.3, but were not in earlier versions, so if you don't see them, you need a newer version of the code.

Anonymous’s picture

Status: Fixed » Closed (fixed)