Guest K.D.S Posted January 5, 2008 Share Posted January 5, 2008 Hi, am very new to cubecart and seem to have a problem setting the number of decimal places for prices. The products i am going to sell have a very low value but cant seem to set the prices to accept 3 decimal places. I have set the currency (GB Pounds) to 3 decimal places but the prices stick to two places, rounding up. e.g. if i set the price to 0.025 when i look at the product it has changed to 0.03. Thanks for any help. Kev. Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 6, 2008 Share Posted January 6, 2008 I haven't looked in the CC code, but the MySQL database has the product's price set at a certain format. Use what ever means you have to access your store's MySQL database and look at the design of the table 'CubeCart_inventory'. The [price] column is formatted to hold Decimal(30,2). Change that to (30,3) and the default value to '0.000'. Do the same to tables 'CubeCart_order_inv[price]' and 'CubeCart_order_sum[subtotal] and [prod_total]' if desired. There *may* still be CC code that rounds to two decimal places, specifically during tax computations. But the bottom line computation, rounding to two decimal places may be what you actually want to end up with. In /includes/functions.inc.php, there is a function, priceFormat(), that uses data from the CubeCart_currencies table, [decimalPlaces] field. You might want to add another record here (maybe it's in the admin panel where you can add a currency) for "microdollars", being a copy of US Dollars (or whatever), but with '3' as the value for decimalPlaces. Quote Link to comment Share on other sites More sharing options...
Guest K.D.S Posted January 7, 2008 Share Posted January 7, 2008 It Worked! Thanks for your help Kev Quote Link to comment Share on other sites More sharing options...
Guest megaline Posted February 8, 2008 Share Posted February 8, 2008 Hi, I have done for version 4 and it works. The only problem is that We should have the TOTAL just in 2 decimal as in reality the 0.001€ does not exist so we could not ask customers to pay that and the total should be rounded to only 2 decimals. Anyone has done that? thank you Ali Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 8, 2008 Share Posted February 8, 2008 Try searching through all your CC files looking for the string: "VAL_GRAND_TOTAL",priceFormat($order[0]['prod_total']) One place you can find it in CC3.0.15 is in: /includes/content/viewOrder.inc.php around line 126. Change (at least) this to: "VAL_GRAND_TOTAL",round(priceFormat($order[0]['prod_total']),2) This is, of course, until you add a "bottomLineDecimalPlaces" column to the currencies table and mod all the code to use it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.