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

Starburst image in short description

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-27-2008, 05:57 AM
 
Isleman Isleman is offline
 

Senior Member
  
Join Date: Jan 2005
Location: UK
Posts: 128
 

Default 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.
__________________
X-Cart ver. 4.4.2 ( www.responseelectronics.com )
X-Cart ver. 4.1.11 ( www.mrdoorbell.com)
Reply With Quote
  #2  
Old 11-28-2008, 12:19 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default 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
Reply With Quote
  #3  
Old 11-28-2008, 03:55 AM
 
Isleman Isleman is offline
 

Senior Member
  
Join Date: Jan 2005
Location: UK
Posts: 128
 

Default 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}
__________________
X-Cart ver. 4.4.2 ( www.responseelectronics.com )
X-Cart ver. 4.1.11 ( www.mrdoorbell.com)
Reply With Quote
  #4  
Old 11-28-2008, 04:22 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default 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}
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #5  
Old 12-02-2008, 05:47 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default 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
Reply With Quote
  #6  
Old 11-05-2009, 12:29 AM
 
lash lash is offline
 

Senior Member
  
Join Date: Oct 2006
Posts: 138
 

Default 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.
__________________
4.1.9
www.lash.se
Reply With Quote
  #7  
Old 05-04-2011, 02:11 AM
 
Isleman Isleman is offline
 

Senior Member
  
Join Date: Jan 2005
Location: UK
Posts: 128
 

Default 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
__________________
X-Cart ver. 4.4.2 ( www.responseelectronics.com )
X-Cart ver. 4.1.11 ( www.mrdoorbell.com)
Reply With Quote
  #8  
Old 06-29-2011, 08:12 AM
 
Isleman Isleman is offline
 

Senior Member
  
Join Date: Jan 2005
Location: UK
Posts: 128
 

Default 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 .
__________________
X-Cart ver. 4.4.2 ( www.responseelectronics.com )
X-Cart ver. 4.1.11 ( www.mrdoorbell.com)
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 05:59 PM.

   

 
X-Cart forums © 2001-2020