View Single Post
  #156  
Old 09-30-2005, 06:01 AM
 
Don L Don L is offline
 

Member
  
Join Date: Sep 2005
Posts: 27
 

Default

One small problem with this code is that it doesn't sort by searchscore on searches originating from a category page. Here's my alteration to make it always default to sorting by searchscore:

Comment out the case "orderby" in the sort search results section.

Commented out section:
Code:
// case "orderby": // $sort_string = "$sql_tbl[products_categories].orderby $direction"; // break;

Including surrounding code:
Code:
if (!empty($data["sort_field"])) { # 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 = "searchscore desc, $sql_tbl[products].product $direction"; // Add score to sort - LNJ 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 = "searchscore desc,$sql_tbl[products].product"; // Add score to sort - LNJ }

That's it. This may have unintended consequences, but none that I have encountered so far.
__________________
GetItCheap.com
x-cart v4.0.17

TheNewDonald.com - Internet Marketing Blog
Reply With Quote