Add the ability to sort by add_date field along with listing default by this field. Edit include/search.php and locate the following code:
Code:
$sort_fields = array(
"productcode" => func_get_langvar_by_name("lbl_sku"),
"title" => func_get_langvar_by_name("lbl_product"),
"price" => func_get_langvar_by_name("lbl_price"),
"orderby" => func_get_langvar_by_name("lbl_default")
);
Change to:
Code:
$sort_fields = array(
"add_date" => func_get_langvar_by_name("lbl_date"),
"productcode" => func_get_langvar_by_name("lbl_sku"),
"title" => func_get_langvar_by_name("lbl_product"),
"price" => func_get_langvar_by_name("lbl_price"),
"orderby" => func_get_langvar_by_name("lbl_default")
);
Next locate:
Code:
#
# Perform search and display results
#
$data = array();
After this above code add:
Code:
if(empty($sort)) $sort = "add_date";
Next locate:
Code:
case "productcode":
$sort_string = "$sql_tbl[products].productcode $direction";
break;
Above this line add:
Code:
case "add_date":
$sort_string = "$sql_tbl[products].add_date DESC";
break;
Thats it! Now all of your product listings by default will show newest products first. As well as Date field has been added to the sort options list under "Date".

Keep in mind, X-Cart admin->General Settings->Apperance: "Select the order in which products should be displayed within a category:" will be ignored with this mod in place.