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

Displaying product savings in $ amount instead of % percent

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-06-2003, 08:49 PM
  enge919's Avatar 
enge919 enge919 is offline
 

Senior Member
  
Join Date: May 2003
Posts: 141
 

Default Displaying product savings in $ amount instead of % percent

Is there a way that I can show my customers how much they are saving in dollar amount rather that the standard way xcart displays it in percentage.

I found this code that generates the percentage amount in customer/main/products_tpl

Code:
>{if $products[product].list_price gt 0 and $products[product].price lt $products[product].list_price}, save {$discount}%{/if}

How can I change this to display in dollar amount?
Reply With Quote
  #2  
Old 09-30-2003, 10:52 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

change:

Code:
{if $products[product].list_price gt 0} {math equation="100-(price/lprice)*100" price=$products[product].price lprice=$products[product].list_price format="%d" assign=discount} <font class=MarketPrice>{$lng.lbl_market_price}: <s> {include file="currency.tpl" value=$products[product].list_price} </s></font> {/if} <font class=ProductPrice>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].list_price gt 0}, save {$discount}%{/if}{if $config.Taxes.use_vat eq "Y" and $products[product].vat gt "0"}, {$lng.lbl_including_vat} {$products[product].vat}%{/if} {else}

to:

Code:
{if $products[product].list_price gt 0} {math equation="lprice-lprice" price=$products[product].price lprice=$products[product].list_price format="%d" assign=discount} <font class=MarketPrice>{$lng.lbl_market_price}: <s> {include file="currency.tpl" value=$products[product].list_price} </s></font> {/if} <font class=ProductPrice>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].list_price gt 0}, save {$config.General.currency_symbol}{$discount}{/if}{if $config.Taxes.use_vat eq "Y" and $products[product].vat gt "0"}, {$lng.lbl_including_vat} {$products[product].vat}%{/if} {else}
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 10-04-2003, 08:51 AM
  enge919's Avatar 
enge919 enge919 is offline
 

Senior Member
  
Join Date: May 2003
Posts: 141
 

Default

Thanks Funkydunk.....Works like a charm!
Reply With Quote
  #4  
Old 10-04-2003, 02:10 PM
 
dealsondeals dealsondeals is offline
 

eXpert
  
Join Date: Dec 2002
Location: Dallas, Texas, USA
Posts: 231
 

Default

Nice one!
__________________
Never understimate stupidity.
--------
X-Cart Version: 3.5.2
Hosting:mind-in-design.net
Configuration: Virtual Dedicated Server || Intel Pentium 4 2.4 GHZ CPU || 1024MB PC2100 DDR RAM || Linux || PHP 4.3.2 || MySQL server 4.0.14
Reply With Quote
  #5  
Old 11-17-2003, 05:24 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Here's my code in customer/products.tpl

Code:
{math equation="(lprice-price)" price=$products[product].price lprice=$products[product].list_price assign=discount} {$lng.lbl_market_price}: {include file="currency.tpl" value=$products[product].list_price} {/if} {$lng.lbl_our_price}: <font class=ProductPrice>{include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].list_price gt 0 and $products[product].price lt $products[product].list_price}, You save <u>{include file="currency.tpl" value=$discount}</u>{/if}{if $config.Taxes.use_vat eq "Y" and $products[product].vat gt "0"}, {$lng.lbl_including_vat} {$products[product].vat}%{/if} {else}

Code:
="(lprice-price)" price=$products[product].price lprice=$products[product].list_price assign=discount}

Code:
You save <u>{include file="currency.tpl" value=$discount}</u>

Same effect, slightly different code.
Reply With Quote
  #6  
Old 11-20-2003, 04:51 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

almost

yours will do the math equation even if there is no difference in price. Effectively that could slow the site down by, oooh probably in the order of .1 microsecond :LOL
__________________
ex x-cart guru
Reply With Quote
  #7  
Old 01-13-2004, 10:26 PM
  BoomBoomBap's Avatar 
BoomBoomBap BoomBoomBap is offline
 

Senior Member
  
Join Date: Nov 2002
Location: San Francisco
Posts: 184
 

Default

I wasnt able to get either one of these fixes working for 3.4.10

Any update here?

the code Im currently using is below. Naturally I would like it to show $ instead of % as the topic of this forum indicates.

Code:
{if $product.price ne 0}{include file="currency.tpl" value=$product.price}{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if} {/if} {if $product.list_price gt 0 and $product.price lt $product.list_price} {math equation="100-(price/lprice)*100" price=$product.price lprice=$product.list_price format="%d" assign=discount}(Save {$discount}%){/if}
__________________
Site 1 > XCART LIVE 3.4.12

Site 2 > XCART LIVE 4.0.17
Reply With Quote
  #8  
Old 01-13-2004, 10:37 PM
  BoomBoomBap's Avatar 
BoomBoomBap BoomBoomBap is offline
 

Senior Member
  
Join Date: Nov 2002
Location: San Francisco
Posts: 184
 

Default

oh my. that was far too easy.

Quote:
{$product.list_price}

that's all i need
__________________
Site 1 > XCART LIVE 3.4.12

Site 2 > XCART LIVE 4.0.17
Reply With Quote
  #9  
Old 01-14-2004, 06:30 AM
 
dealsondeals dealsondeals is offline
 

eXpert
  
Join Date: Dec 2002
Location: Dallas, Texas, USA
Posts: 231
 

Default

Is it possible to have this post moved to "Custom Mods & Templates"? This is one I had definitely forgot about and if looking for it I would have started in the "Custom Mods & Templates" area of the forum.

Thanks,

Glen
__________________
Never understimate stupidity.
--------
X-Cart Version: 3.5.2
Hosting:mind-in-design.net
Configuration: Virtual Dedicated Server || Intel Pentium 4 2.4 GHZ CPU || 1024MB PC2100 DDR RAM || Linux || PHP 4.3.2 || MySQL server 4.0.14
Reply With Quote
  #10  
Old 04-27-2004, 06:48 PM
 
POSDepot POSDepot is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 52
 

Default Error in Code?

Quote:

{math equation="lprice-lprice" price=$products[product].price

I couldn't get FunkyDunk's mod to work until I changed the line above to this:


Quote:
{math equation="lprice-price" price=$products[product].price

I kept getting $0.00 because it was subtracting lprice from itself.

Please note I know nothing about coding so I may be wrong here, but it seems to work with the change I made.

Randy
X-Cart 3.5.3[/quote]
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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:32 AM.

   

 
X-Cart forums © 2001-2020