Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Displaying Discount

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 04-08-2003, 12:04 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

{math equation="price-(price*.30)" price=$products[product].price format="%d.00" assign=unformatted}

Would this do the trick?
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #12  
Old 04-08-2003, 12:35 PM
 
Jason Brice Jason Brice is offline
 

Advanced Member
  
Join Date: Mar 2003
Location: Christchurch, New Zealand
Posts: 42
 

Default

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.
Reply With Quote
  #13  
Old 04-10-2003, 04:30 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Where you able to make the adjustments to the smarty modifier plugin for formatprice, if so I'd like to see a snippet if possible.
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #14  
Old 04-10-2003, 05:30 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

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.

EWD Hosting
Hands On Hosting
Reply With Quote
  #15  
Old 04-10-2003, 12:57 PM
 
Jason Brice Jason Brice is offline
 

Advanced Member
  
Join Date: Mar 2003
Location: Christchurch, New Zealand
Posts: 42
 

Default

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:
<font class=ProductPrice>{$lng.lbl_our_price}: <s>{include file="currency.tpl" value=$products[product].price}</s> {math equation="price*0.7" price=$products[product].price discount=$products[product].discount assign=unformatted}{include file="currency.tpl" value=$unformatted}</font>

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!
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:58 AM.

   

 
X-Cart forums © 2001-2020