Magento – Display Sale Icon If Special Price on Category Page


Open app/design/frontend/YourPackage/YourTheme/template/catalog/list.phtml
Find:


<a href="getProductUrl() ?>" title="stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

Replace to


<a href="getProductUrl() ?>" title="stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
 
load($_product->getId())->getSpecialPrice(); 
    
    $specialPriceFromDate = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialFromDate();
   
    $specialPriceToDate = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialToDate();
   
    $today =  time();
 
    if ($specialprice):
        if($today >= strtotime( $specialPriceFromDate) && $today = strtotime( $specialPriceFromDate) && is_null($specialPriceToDate)):
?>
        <img src="getSkinUrl('images/saleicon.png'); ?>" width="25" height="25" class="sale-icon" />

 

And Then Open Your style.css

Find:

.products-grid .product-image { display:block; width:135px; height:135px; margin:0 0 10px; }

Replace to

.products-grid .product-image { display:block; width:135px; height:135px; margin:0 0 10px; position:relative;}

Below Add This CSS Class

.sale-icon { position:absolute; top:0; right:0;}

END RESULT

sale-product

Advertisements

One thought on “Magento – Display Sale Icon If Special Price on Category Page

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s