php - Display Sale icon on special price products in magento. Only at homepage it is showing not in all pages -


display sale icon on special price products in magento. @ homepage showing not in pages.

code have edited in app/design/frontend/default/template/catalog/product/list.html
line number: 95

<a href="<?php echo $_product->getproducturl() ?>" title="<?php echo $this->striptags($this->getimagelabel($_product, 'small_image'), null, true) ?>"` class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->striptags($this->getimagelabel($_product, 'small_image'), null, true) ?>" />   <?php      // special price     $specialprice = mage::getmodel('catalog/product')->load($_product->getid())->getspecialprice();      // special price date     $specialpricefromdate = mage::getmodel('catalog/product')->load($_product->getid())->getspecialfromdate();     // special price date     $specialpricetodate = mage::getmodel('catalog/product')->load($_product->getid())->getspecialtodate();     // current date     $today =  time();      if ($specialprice):         if($today >= strtotime( $specialpricefromdate) && $today <= strtotime($specialpricetodate) || $today >= strtotime( $specialpricefromdate) && is_null($specialpricetodate)): ?>         <img src="../images/sale-icon.png" width="101" height="58" class="onsaleicon" /> <?php           endif;     endif; ?>  </a> 

this icon displaying in homepage not in product list of pages. how display in pages?

please me out of this

this because insert image this:

<img src="../images/sale-icon.png" width="101" height="58" class="onsaleicon" /> 

the image should placed in skin/frontend/{interface}/{theme}/images/ , should reference way:

<img src="<?php echo $this->getskinurl('images/sale-icon.png');?>" width="101" height="58" class="onsaleicon" /> 

[edit]
bit off topic, know: don't use mage::getmodel('catalog/product')->load($_product->getid()) each product attribute need. slows down page more think. edit attributes need (special price, special price , special price to) in backend set field used in product listing yes, reindex , should able use directly:

$specialprice = $_product->getspecialprice(); $specialpricefromdate = $_product->getspecialfromdate(); $specialpricetodate = $_product->getspecialtodate(); 

Comments