X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Show list price with slash and then price below it (https://forum.x-cart.com/showthread.php?t=11359)

instinctual 01-09-2005 01:16 PM

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

artinion 02-21-2005 05:19 PM

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?

instinctual 02-22-2005 09:42 AM

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

artinion 02-23-2005 07:34 PM

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

instinctual 02-23-2005 07:47 PM

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

torola 07-13-2005 07:01 PM

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?

instinctual 07-14-2005 05:41 AM

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.


All times are GMT -8. The time now is 01:33 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.