David,
please see my comments inline:
David E Jones wrote:
On Sep 19, 2006, at 2:10 AM, Jacopo Cappellato wrote:
David,
On the other hand, the "amount" (that is stored in the
OrderItem.amountSelected field) is used as a multiplier for the unit
price: if a product (with require amount = Y) has a unit price of 2$
(ProductPrice) and you select an amount of 100 then the new unit price
(in the cart/order) is 200; the "amount" will not affect in any way
the quantity issued from inventory that is always the
OrderItem.quantity field.
Is this correct?
I think this is correct, but unfortunately it is also a bug... The
amount really should be multiplied by the quantity in order to get the
total to deduct from inventory and so on.
Hmmm... but in this way we could have non integer inventory quantities
(since the amount value can be a non integer value)... do we really want
this to happen?
PS: This makes me think that the amount multiplier has some potential
and could be used also to express small unit prices (amount =
0.0001)... but the problem is that the new unitPrice is stored in the
OrderItem.unitPrice field that has limited precision... maybe we
should store there the original unit price and just get the order item
total as: OrderItem.quantity * OrderItem.amountSelected *
OrderItem.unitPrice
Isn't it done this way already, ie calculating the order item subtotal
this way?
Not exactly in this way.
For example: if I order an item with original unit price of 15.99,
quantity = 2 and amount = 1.5, in the OrderItem entity the following
values are stored:
quantity = 2
selectedAmount = 1.5
unitPrice = 23.98 (!!! This is the result of 1.5 * 15.99 = 23.985)
and the order item subtotal is (correctly) calculated multiplying the
quantity and the unitPrice: 47.96
Maybe we should instead store in the OrderItem:
quantity = 2
selectedAmount = 1.5
unitPrice = 15.99
and the order item subtotal should be calculated multiplying the
quantity, the unitPrice and the selected amount: 2 * 1.5 * 15.99 = 47.97
But then the selectedAmount should be displayed in all the order view
screens.
Should we try to clean/fix this?
If so, I could put some effort in this but first I'd like to be sure to
understand the intended use of the amount field.
Thanks,
Jacopo
-David
David E Jones wrote:
So, what you're saying is that you want to stock in quantities of 1
but sell only quantities of 50?
You could have a product (product "A") that represents a single unit
and put that in inventory but don't make it available for sale, and
then have another product (product "B") that is available for sale
that represents 50 of the stocked product and use a marketing package
or manufactured product to handle the quantity.
In this way you don't need any price attached to product A, and
instead just have your $59.99 associated with product B. That way
even if it is a small price that would make the price of product A
too small to reasonably handle, it will still work fine.
-David