Getting the most out of Zen Cart
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

The reason I started this blog was because I've spoken to so many people who have setup on line, but are struggling for sales or people who want to get online, but don't know how to. Selling online is very difficult. It's competitive, pretty much no matter what you sell and it can be expensive to setup (and advertise). You can be selling the best products on the web, but it's pointless unless you get the visitors and they can use your site when they finally get there
Glenn Herbert
December 6th, 2008 at 5:04 am
Nice tip!
Users should note that the table name will only be “zen_products” if you have set a table prefix of “zen” when installing.
It would be safer to use the constant that holds the value of the table name for your installation. Something like
$datesql = “select products_date_added from ‘ . TABLE_PRODUCTS . ‘ where products_id = “. (int)$_GET['products_id'] .” “;