Is there a way to have a flag a product as a new product? I would like to have all new products listed with some sort of "NEW" icon for a period of time (say 7-14 days). I don't see anything like this in the docs.
Easiest way is to just create a CCK field, a checkbox, that you can then add to your product template (use Contemplate) that, when the field is active, shows a "NEW" icon.
Unless you wanted to write a few lines of code within the template to check the current date, and if it's within a certain threshold, to show said icon. That wouldn't be too hard, I don't think.
EDIT: Off the top of my head, you could put something like this into a template. This will show a product as "New" for the first week after it's been published.
<?php
$created = db_result(db_query("SELECT created FROM {uc_node} WHERE nid = %d", $node->nid));
$curTime = time();
if (
$curtime - $created <= 604800) print "NEW!";
?>Not tested but I imagine it'd work, or work with some tweaking. Might be a cool feature to add, or expand upon in a Contribution. Variable time threshold for display, etc.
You probably mean {node} instead of {uc_node}.
However, if you have access to $node->nid, you ought to be able to use $node->created as well.
Oh yeah, duh!
Even better!
<?php
if(time() - $node->created < 604800) print "NEW!";
?>Thanks! Works well. It would be a nice addition to Ubercart for those of us that are less fluent PHP programmers.
This functionality is interesting, but where exactly can I put this code
<?php
if(time() - $node->created < 604800) print "NEW!";
?>I don't have .tpl.php file for the list view in catalog. I need to customize the TAPIr table to change the name of the product. The better will be to put theme_mark() or something like this, in order to have
<span class="marker">new</span>
for some period, let's say 1 month or week. Will anyone help me resolve this?



