Implement a basic price field to store a price (defined as an amount and a currency code). The price field needs to store these two values separately, and we've discussed using an integer column instead of a decimal for storing the amount. That decision needs to be finalized.
The widget for the price field should have settings so the user can choose to display it with one of these simple configurations:
- A textfield for the amount and a select list for the currency (with options displayed as the currency code).
- A textfield with a single currency enforced, meaning the currency code will be displayed as a suffix of the textfield. If the store only has a single currency, this should be the only option available.
This ticket can be closed when two basic display formatters are included:
- Base price (raw) - Display the price values as a number without currency formatting.
- Base price (formatted) - Display the base price values as a number with currency formatting.
Other display formatters depend on the completion of the price handling object. If possible, include settings for an additional prefix / suffix to the price.
Comments
Comment #1
rszrama commentedfwiw, this article also specifies a BigInt for monetary values.
Comment #2
rszrama commentedWhile the basic price field has been implemented, it does need to be updated to use integer storage instead of decimal storage.
Comment #3
rszrama commentedSee also this article: http://www.codeproject.com/KB/recipes/MoneyTypeForCLR.aspx
It advocates storing all price values in fixed base 10 numbers.
Comment #4
rszrama commentedFinished this off with a few commits this evening:
Comment #5
spydmobile commentedStupid question does this ongoing work have anything to do with an error like this when clicking store->products:
Comment #6
rszrama commentedIt shouldn't... I'd guess first you need to update to the dev version of Views.
Comment #7
spydmobile commentedHi Ryan, um, this *IS* the dev of views.
from Drush:
EDIT: Should I open a new issue instead?
Comment #8
rszrama commentedNah, I don't think we need a new issue... we see a lot of entity_id bug reports having to do with folks using Views 3.0-alpha1, but your problem seems to be that you have a View expecting to find the field_data_purchase_price handler. However, as of the most recent dev of Commerce, the purchase_price field has been renamed to commerce_price, which is why it's showing up as missing. Can you rebuild your site?
Comment #9
spydmobile commentedSure will a full disabling/uninstall/removal of all commerce be enough or do I need to startover from scratch and start over with D7? I think I need to be running dev commerce but have alpha5 installed....
Comment #10
rszrama commentedUninstall doesn't work for Commerce right now anyways, so just rebuild the whole site. You might also give the latest dev a shot. : )