Ever wanted to put a ‘new’ sticker on your product pages? Well here’s what you do;

Create a little eye catching graphic that says New or NEW PRODUCT. Then pop your graphic in includes/templates/<your template folder>/images and call it new.gif

Once you have done that open includes/templates/<your template folder>/css/stylesheet.css at the bottom add the following lines:

.new {
background-image:url(../images/new.gif);
width: 43px;
height: 43px;
}

Alter the width and hight to match the graphic you created.

Then add the code below to your includes/templates/<your template folder>/templates/tpl_product_info_display.php file. It’s up to you where you want to display the item, but you may need to play around to get it exactly where you want it.

<?php
$datesql = “select products_date_added from zen_products where products_id = “. (int)$_GET['products_id'] .” “;
$date_display = $db->Execute($datesql);
$newdate = $date_display->fields['products_date_added'];
$newdate2 = $newdate – 30;
function reformatDate($newdate) {
list($year, $month, $day, $hour, $min, $sec) = split( ‘[: -]‘,
$newdate);
return “$year-$month-$day”;
}
$dateA=$newdate;
$theDate=reformatDate($dateA);
$thirty_days_ago = mktime()-2592000;
if ($theDate >= date(‘Y-m-d’, $thirty_days_ago)) { echo ‘<div class=”new”></div>’; }
?>

And that’s it. Your little graphic will show for 30 days after you added the product to the Zen Cart system.

Quick Tip: If you want the new sticker to display for longer than 30 days (or less) then look for   $thirty_days_ago = mktime()-2592000; and alter the 2592000 to the number of seconds you want it to display for. If your maths is a rubbish as mine then look here to calculate days to seconds