X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Starburst image in short description (https://forum.x-cart.com/showthread.php?t=43913)

Isleman 11-27-2008 05:57 AM

Starburst image in short description
 
When a product has a discount it usually shows the list price and the discount price but also it displays a starburst image on the product page which contains the discount in percentages.
How can I make this star to appear on the short description in category view ?
Thank you.

Yurij 11-28-2008 12:19 AM

Re: Starburst image in short description
 
Quote:

Originally Posted by Isleman
When a product has a discount it usually shows the list price and the discount price but also it displays a starburst image on the product page which contains the discount in percentages.
How can I make this star to appear on the short description in category view ?
Thank you.



Try use next code (for file "skin1/customer/main/products.tpl" or ".../products_t.tpl"):

PHP Code:

<table width="60" cellspacing="1" cellpadding="2">
<
tr>
    <
td class="SaveMoneyLabel">
<
br />
{
math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%3.0f" assign=discount}
&
nbsp;<span id="save_percent">{ $discount }</span>%
    </
td>
</
tr>
</
table


Isleman 11-28-2008 03:55 AM

Re: Starburst image in short description
 
Quote:

Originally Posted by Yurij
Try use next code (for file "skin1/customer/main/products.tpl" or ".../products_t.tpl"):

PHP Code:

<table width="60" cellspacing="1" cellpadding="2">
<
tr>
    <
td class="SaveMoneyLabel">
<
br />
{
math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%3.0f" assign=discount}
&
nbsp;<span id="save_percent">{ $discount }</span>%
    </
td>
</
tr>
</
table


Thanks a lot . Is working very nice now.
However I get a problem as it shows on all the products even if they haven't been discounted.
Id the product has not been discounted it will show 100%
Obviously it needs an if condition which I copied from product.tpl . But somehow it doesn't work . Is anything else that needs included ?

Heres is the code

<tr>
{if $product.taxed_price gt 0 and $product.list_price gt 0}
<td align="right" valign="top" width="60" id="save_percent_box"{if $product.taxed_price >= $product.list_price} style="display: none;"{/if}>

<table width="60" cellspacing="1" cellpadding="2">
<tr>
<td class="SaveMoneyLabel">
<br />
{math equation="100-(price/lprice)*100" price=$product.taxed_price lprice=$product.list_price format="%3.0f" assign=discount}
&nbsp;<span id="save_percent">{ $discount }</span>% </td>
</tr>
</table> </td>
{/if}

JWait 11-28-2008 04:22 AM

Re: Starburst image in short description
 
Try this...
{if $product.taxed_price gt 0 and $product.list_price gt 0}
<td align="right" valign="top" width="60" id="save_percent_box"{if $product.taxed_price >= $product.list_price} style="display: none;"{/if}>
{if $discount gt 0}
<table width="60" cellspacing="1" cellpadding="2">
<tr>
<td class="SaveMoneyLabel">
<br />
{math equation="100-(price/lprice)*100" price=$product.taxed_price lprice=$product.list_price format="%3.0f" assign=discount}
&nbsp;<span id="save_percent">{ $discount }</span>% </td>
</tr>
</table>{/if} </td>
{/if}

Yurij 12-02-2008 05:47 AM

Re: Starburst image in short description
 
Quote:

Originally Posted by Isleman
Thanks a lot . Is working very nice now.
However I get a problem as it shows on all the products even if they haven't been discounted.
Id the product has not been discounted it will show 100%
Obviously it needs an if condition which I copied from product.tpl . But somehow it doesn't work . Is anything else that needs included ?


Try use next code:

PHP Code:

{if $products[product].taxed_price gt 0 and $products[product].list_price gt 0}
<
table width="60" cellspacing="1" cellpadding="2">
<
tr>
    <
td class="SaveMoneyLabel">
<
br />
{
math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%3.0f" assign=discount}
&
nbsp;<span id="save_percent">{ $discount }</span>%
    </
td>
</
tr>
</
table>
{/if} 



If you do not want to show discount "0%" should be changed first condition
PHP Code:

{if $products[product].taxed_price gt 0 and $products[product].list_price gt 0 and $products[product].list_price ne $products[product].taxed_price


lash 11-05-2009 12:29 AM

Re: Starburst image in short description
 
Anyone knowds if this code goes in
skin1/customer/main/products.tpl" or ".../products_t.tpl?
And about where to put the code?
Just thought I asked before I start messing around on a live store. Hope I can get an answer.

Isleman 05-04-2011 02:11 AM

Re: Starburst image in short description
 
I am trying to reimplement the same code as here on 4.4.1 version but it seems it doesn't work .
Has anybody got an idea how I can make this modification on 4.4.1 ?
Thank you

Isleman 06-29-2011 08:12 AM

Re: Starburst image in short description
 
I just found the answer myself the class name is changed in 4.4.2 so just copy this code in /customer/main/product.tpl


{if $active_modules.Special_Offers}
{include file="modules/Special_Offers/customer/product_bp_icon.tpl"}
{/if}
{if $product.appearance.has_market_price and $product.appearance.market_price_discount gt 0}
<td align="right" valign="top">
<div class="save-percent-container">
<div class="save" id="save_percent_box">
<span id="save_percent">{$product.appearance.market_pric e_discount}</span>%
</div>
</div>
</td>
{/if}

I am trying now to align it to the right but I am not able to .
Can anybody help me ?
Thank you .


All times are GMT -8. The time now is 12:03 PM.

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