Add Label for New Product in Magento Product List

Add following code to display new label for new products.

<?php  $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)||($now>=$newsFrom && $newsFrom!=” && $newsTo==” ))
{?><img alt=”” src=”<?php echo $this->getSkinUrl(‘images/icon-new.png’);?>”><?php }?>

Advertisements
  1. No trackbacks yet.

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

%d bloggers like this: