This recipe shows you how to sort your product listing by date. If you often add products and have long lists, this will be useful to focus on new items.
Your product listing will change from the default sorting done alphabetically by product name to sorting by the date on which each product was added:
Ready for some date pudding? Enjoy!
if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { if ($column_list[$i] == 'PRODUCT_LIST_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; break; } } } else {
Replace with the following code, modifying the sort order so that the date a product was added on is the...