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

Show list price with slash and then price below it

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-09-2005, 01:16 PM
 
instinctual instinctual is offline
 

eXpert
  
Join Date: Nov 2003
Posts: 247
 

Default Show list price with slash and then price below it

Ok, so if you'd like to show the list price with a slash, and the price below that - you can use this code in the 3.5.x branch - doesn't work yet in the 4.0.x branch.

Code:
{if $product.price ne 0} {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} <font class=MarketPrice><s> {include file="currency.tpl" value=$product.list_price} </s></font> {/if} {if $product.list_price eq ""} {/if} <font class=ProductPrice>{if $product.list_price gt 0 and $product.price lt $product.list_price}<font color=#FF0000>{/if}{if $product.list_price gt 0 and $product.price lt $product.list_price}{else} {/if} {if $product.list_price gt 0 and $product.price lt $product.list_price}{$lng.lbl_our_price}: {/if}{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if} {else} <font class=ProductPrice>{$lng.lbl_enter_your_price}</font> {/if}

You want to put this starting at the first {if} you see above, and ending with the last {/if} after the "enter your price" variable - this one is for product.tpl.

Similarly, for the products.tpl - thumbnail page, you can use this:
Code:
{if $products[product].price ne 0} {if $products[product].list_price gt 0 and $products[product].price lt $products[product].list_price} {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 and $products[product].price lt $products[product].list_price}, 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} <font class=ProductPrice>{$lng.lbl_enter_your_price}</font> {/if}
Cheers

Instinctual
Colorado
X-Cart Versions 3.5.x - 4.0.x
Reply With Quote
  #2  
Old 02-21-2005, 05:19 PM
 
artinion artinion is offline
 

Advanced Member
  
Join Date: Feb 2005
Location: Bangkok, Thailand
Posts: 37
 

Default replacing "Enter your price" with the price

Does this mean I have the choice of putting that code in either product.tpl or products.tpl?
__________________
X-Cart v. 4.0.12 Gold
Linux, Apache, MySQL, PHP 4
Reply With Quote
  #3  
Old 02-22-2005, 09:42 AM
 
instinctual instinctual is offline
 

eXpert
  
Join Date: Nov 2003
Posts: 247
 

Default

Yes - assuming you don't want the list vs. discount price to show on one or the other page - - products.tpl controls the thumbnail view of your site and product.tpl controls the detail view of a product - you can choose to put it on either or both of those templates.


Cheers ;o)

Instinctual
Colorado
X-Cart Versions 3.5.x - 4.0.x
Reply With Quote
  #4  
Old 02-23-2005, 07:34 PM
 
artinion artinion is offline
 

Advanced Member
  
Join Date: Feb 2005
Location: Bangkok, Thailand
Posts: 37
 

Default

Quote:
Originally Posted by instinctual
Yes - assuming you don't want the list vs. discount price to show on one or the other page - - products.tpl controls the thumbnail view of your site and product.tpl controls the detail view of a product - you can choose to put it on either or both of those templates.

Excellent! Now I only want to just show the listed price (products.tpl, product.tpl), which of the code should I change?

Art
__________________
X-Cart v. 4.0.12 Gold
Linux, Apache, MySQL, PHP 4
Reply With Quote
  #5  
Old 02-23-2005, 07:47 PM
 
instinctual instinctual is offline
 

eXpert
  
Join Date: Nov 2003
Posts: 247
 

Default only showing list price...

So you only want to show the list price - not the regular price? In the backend, under modify product there is a spot for each product to have a list price and a price - which of these do you want to show up on these two templates?

And - you want it on both the thumbnail view of the product as well as the detail view of the product - when does the user actually see the price they get?

To just show list price you would modify the product.tpl code as such:

Code:
{if $product.price ne 0} {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} <font class=MarketPrice><s> {include file="currency.tpl" value=$product.list_price} </s></font> {/if} {if $product.list_price eq ""} {/if} {* <font class=ProductPrice>{if $product.list_price gt 0 and $product.price lt $product.list_price}<font color=#FF0000>{/if}{if $product.list_price gt 0 and $product.price lt $product.list_price}{else} {/if} {if $product.list_price gt 0 and $product.price lt $product.list_price}{$lng.lbl_our_price}: {/if}{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if} *} {else} <font class=ProductPrice>{$lng.lbl_enter_your_price}</font> {/if}



And for products.tpl as such:

Code:
{if $products[product].price ne 0} {if $products[product].list_price gt 0 and $products[product].price lt $products[product].list_price} {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 and $products[product].price lt $products[product].list_price}, 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} <font class=ProductPrice>{$lng.lbl_enter_your_price}</font> {/if}


Instinctual
Colorado
X-Cart Versions 3.5.x - 4.0.x
Reply With Quote
  #6  
Old 07-13-2005, 07:01 PM
 
torola torola is offline
 

Advanced Member
  
Join Date: Feb 2005
Location: Toronto, Canada
Posts: 54
 

Default Re: Show list price with slash and then price below it

Quote:
Originally Posted by instinctual
Ok, so if you'd like to show the list price with a slash, and the price below that - you can use this code in the 3.5.x branch - doesn't work yet in the 4.0.x branch.

Code:
{if $product.price ne 0} {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} <font class=MarketPrice><s> {include file="currency.tpl" value=$product.list_price} </s></font> {/if} {if $product.list_price eq ""} {/if} <font class=ProductPrice>{if $product.list_price gt 0 and $product.price lt $product.list_price}<font color=#FF0000>{/if}{if $product.list_price gt 0 and $product.price lt $product.list_price}{else} {/if} {if $product.list_price gt 0 and $product.price lt $product.list_price}{$lng.lbl_our_price}: {/if}{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if} {else} <font class=ProductPrice>{$lng.lbl_enter_your_price}</font> {/if}

You want to put this starting at the first {if} you see above, and ending with the last {/if} after the "enter your price" variable - this one is for product.tpl.

Similarly, for the products.tpl - thumbnail page, you can use this:
Code:
{if $products[product].price ne 0} {if $products[product].list_price gt 0 and $products[product].price lt $products[product].list_price} {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 and $products[product].price lt $products[product].list_price}, 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} <font class=ProductPrice>{$lng.lbl_enter_your_price}</font> {/if}
Cheers

Instinctual
Colorado
X-Cart Versions 3.5.x - 4.0.x


Does this mode work in v4.0.12?
__________________
Unix X-Cart PRO 4.0.12
Add-on: X-Affiliate
Reply With Quote
  #7  
Old 07-14-2005, 05:41 AM
 
instinctual instinctual is offline
 

eXpert
  
Join Date: Nov 2003
Posts: 247
 

Default nope...

to my knowledge no it does not....BUT - double-check the variable names for your version - the only reason it wouldn't work is because they've slightly changed variable names, etc. - - shouldn't be that hard to get it to work on the 4.0.x branch.

Don't copy my whole snippet of code, only take into consideration the parts you need, and use the rest of the stock code in the 4.0.x branch. Take a look at the math equation for price, and the if/thens, and modify accordingly for that branch.
__________________
Instinctual
8,000 feet up in the Rocky Mountains of Colorado
X-Cart Versions 3.5.x - 4.0.x

IF you xcart, THEN you prosper, ELSE you fail. ELSEIF xcart fails, THEN you fix it, all the WHILE {loop}\'ing {section}\'s to feed your $smarty mind.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:33 AM.

   

 
X-Cart forums © 2001-2020