View Single Post
  #2  
Old 11-10-2005, 05:09 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

Ok, here is a quick little mod that will do that for you. This will give you a checkbox in Admin (in Appearance Options, right under the Display Order dropdown) that will allow you to check if you want the listing in revere order or not, and it will also change the "Default" order method to ProductID.

Open products.php and look for the lines:

Code:
if(!isset($sort)) $sort = $config["Appearance"]["products_order"]; if(!isset($sort_direction))

Right under this add this code:

Code:
{ if ($config["Appearance"]["product_order_reversed"] == "Y") { $sort_direction = 1; } else { $sort_direction = 0;} }

Open /include/search.php and look for this block of code:

Code:
# Sort the search results... $direction = ($data["sort_direction"] ? "DESC" : "ASC"); switch ($data["sort_field"]) { case "productcode": $sort_string = "$sql_tbl[products].productcode $direction"; break; case "title": $sort_string = "$sql_tbl[products].product $direction"; break; case "orderby": $sort_string = "$sql_tbl[products_categories].orderby $direction"; break; case "quantity": $sort_string = "$sql_tbl[products].avail $direction"; break; case "price": if (!empty($active_modules["Special_Offers"]) && !empty($search_data["products"]["show_special_prices"])) { $sort_string = "x_special_price $direction, price $direction"; } else { $sort_string = "price $direction"; } break; default: $sort_string = "$sql_tbl[products].product"; }

and replace the line

Code:
$sort_string = "$sql_tbl[products].product";

with
Code:
$sort_string = "$sql_tbl[products].productid";



Run this SQL patch in the Patch/Upgrade section
Code:
INSERT INTO `xcart_config` VALUES ('product_order_reversed', 'List products in reversed order', 'Y', 'Appearance', 100, 'checkbox', 'Y');
Reply With Quote