Open app/design/frontend/YourPackage/YourTheme/template/catalog/list.phtml
Find (around line 96)
<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) ?>" />
</a>
change to
<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
// Get the Special Price
$specialprice = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialPrice();
// Get the Special Price FROM date
$specialPriceFromDate = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialFromDate();
// Get the Special Price TO date
$specialPriceToDate = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialToDate();
// Get Current date
$today = time();
if ($specialprice):
if($today >= strtotime( $specialPriceFromDate) && $today <= strtotime($specialPriceToDate) || $today >= strtotime( $specialPriceFromDate) && is_null($specialPriceToDate)):
?>
<img src="path/to/sale-icon.png" width="50" height="50" class="onsaleicon" />
<?php
endif;
endif;
?>
</a>
Next open style.css (skin/frontend/YourPackage/YourTheme/css/style.css)Find
.products-grid .product-image { display:block; width:135px; height:135px; margin:0 0 10px; }
change to
.products-grid .product-image { display:block; width:135px; height:135px; margin:0 0 10px; position:relative;}
Below this add
.onsaleicon{position:absolute; top:0; right:0;}
No comments:
Post a Comment