Sunday, 13 January 2013

New and sale label on products


on view page in place in between:-<div class="product-img-box">
            <?php echo $this->getChildHtml('media') ?>



<?php // SALE label placement
if ( ($_product->getFinalPrice() - $_product->getPrice()) < 0) { ?>
<img class="labels labels-top-right" src="<?php echo $this->getSkinUrl('images/labels/sale.png'); ?>">
<?php } ?>
<?php // NEW label placement
$now = date("Y-m-d");
$newsFrom= substr($_product->getData('news_from_date'),0,10);
$newsTo=  substr($_product->getData('news_to_date'),0,10);
if ($now>=$newsFrom && $now<=$newsTo)
{?> <img class="labels labels-top-left" src="<?php echo $this->getSkinUrl('images/labels/new.png'); ?>"><?};
?>






</div>





css:-
/* Labels CSS
-------------------------------------------------------------- */
.labels { border:none; position:absolute; z-index:99; }
.labels-top-right { top:-2px; right:-2px; }
.labels-bottom-right { bottom:-2px; right:-2px; }
.labels-bottom-left { bottom:-2px; left:-2px; }
.labels-top-left { top:-2px; left:-2px; }




in .product-img-box


position: relative;




No comments:

Post a Comment