| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Displaying Discount | ||||
![]() |
|
|
Thread Tools | Search this Thread |
#12
|
|||||||
|
|||||||
![]() format="%d.00" seems to round to the nearest dollar...
format="%.2f" is better but it truncates the string in stead of rounding it, so for 30% off 2.95 we are displayed $2.06 in the product window, but it is $2.07 when it's added to the cart because the actual price of $2.0666* is round up. format acts on the numeric as if it is a string. |
|||||||
#14
|
|||||||||
|
|||||||||
![]() http://smarty.php.net/manual/en/language.modifier.string.format.php
so would using the global discount thing as mentioned before and then altering the smarty string_format command to round up to the nearest penny or cent be ok ?
__________________
Looking for a reliable X-cart host ? You wont go wrong with either of these. ![]() ![]() |
|||||||||
#15
|
|||||||
|
|||||||
![]() It would be best to round to the closest penny, actually, since that's what the calculation for the shopping cart does.
Go to http://www.morecomics.net and add the item that is normally $2.95 to your cart and you'll see what I mean. It is displyed on the page as $2.06, but the price displayed in the cart area is $2.07. Here is the code that I am currently using: Code:
When I tried using the code that is mention at http://smarty.php.net/manual/en/language.modifier.string.format.php - {$number|string_format:"%.2f"} all I got were values like this: $2.26 $7.20 That is, everything had "2" in the first place after the decimal point. I'm getting puzzled here! |
|||||||
|
|||
X-Cart forums © 2001-2020
|