|4 digit pricing|
|4 digit pricing|
Author Scott on 07-05-2000 at 15:55 (EST)
|I have a product that sells for $37.75 for 100 units, but they have to be ordered individually at $.3775 each. When the qty. is entered into the field and submitted, the cart is defaulting to $.38. Is there a way to support the 4 digit ($.3775) figures?|
|Messages In This Discussion|
| 1. 4 digit pricing|
Author Scott on 07-05-2000 at 16:01 (EST)
|Follow-up to the previous message. I noticed the total cost is being calculated correctly but the price in the PRICE column of the cart is defaulting to a 2 digit price.
| 2. RE: 4 digit pricing|
Author Bill Weiner on 07-05-2000 at 19:00 (EST)
|Internally, uStorekeeper will keep the accurate pricing....all the way down to the 4-digit precision that you need for items priced at "$.3775" each....So that is why the final calculation is correct.|
The problem of when you order one item at "$.3775" it appears in the shopping cart as "$.38" -- is purely a display/rounding issue. That is, before any items in the shopping cart are displayed, the prices are formatted to the standard 2-decimal place precision....thus the reason why an item priced at "$.3775" appears as "$.38".
I would suggest just forcing the customers to purchase the item in quantities of 100. For instance, if the item was a "Candle" priced at $.3775 each, then maybe just put in the description that the item can only be purchased in quantities of 100. For the "Short Description" field you could even enter something like "Box of 100"....and then specify the price of the product as "$37.75".
Otherwise, if you really wanted to, you could try editing the "get_cart_html" subroutine of the ustorekeeper.pl script. About half-way down in that subroutine you will see the following line:
$formatted_price = sprintf("%.2f",$price);
Which is the line that formats the price output to be rounded to 2 decimal places. I believe you could just change that line to:
$formatted_price = sprintf("%f",$price);
...and you'll get the necessary precision displayed.