HELP!

I think I've figured out my problem. I JUST DON'T KNOW HOW TO FIX IT!

I've added a drop down sorter to the Category Listing(tpl_index_product_list.php) and the Advanced Search Results Page(tpl_advanced_search_result_default.php).

When I make a selection in the drop down sorter, it seems to work... it produces the correct URL and changes the "select" in the drop down sorter, HOWEVER, it doesn't sort the products listed (they keep the same sort order).

I THINK the problem can be fixed by changing this piece of code that is found in BOTH the default_filter.php (that controls the sort order for the Category Listing) AND in the header_php.php (that controls the sort order for the Advanced Search Page)...
PHP Code:
// set the default sort order setting from the Admin when not defined by customer 
  
if (!isset($_GET['sort']) and PRODUCT_LISTING_DEFAULT_SORT_ORDER != '') { 
    
$_GET['sort'] = PRODUCT_LISTING_DEFAULT_SORT_ORDER
  } 

  if (isset(
$column_list)) { 
    if ((!isset(
$_GET['sort'])) || (isset($_GET['sort']) && !ereg('[1-8][ad]'$_GET['sort'])) || (substr($_GET['sort'], 01) > sizeof($column_list)) ) { 
      for (
$i=0$n=sizeof($column_list); $i<$n$i++) { 
        if (isset(
$column_list[$i]) && $column_list[$i] == 'PRODUCT_LIST_NAME') { 
          
$_GET['sort'] = $i+'a'
          
$listing_sql .= " order by p.products_sort_order, pd.products_name"
          break; 
        } else { 
// sort by products_sort_order when PRODUCT_LISTING_DEFAULT_SORT_ORDER is left blank 
// for reverse, descending order use: 
//       $listing_sql .= " order by p.products_sort_order desc, pd.products_name"; 
          
$listing_sql .= " order by p.products_sort_order, pd.products_name"
          break; 
        } 
      } 
// if set to nothing use products_sort_order and PRODUCTS_LIST_NAME is off 
      
if (PRODUCT_LISTING_DEFAULT_SORT_ORDER == '') { 
        
$_GET['sort'] = '20a'
And more specifily, this line of code:
PHP Code:
$listing_sql .= " order by p.products_sort_order, pd.products_name"
The sort ALWAYS reverts back to what is listed in this code for some reason. I've tried several ways to just remove it, but I always get an error.

Is there a way that this code can be adjusted so that the sort order doesn't default to what is listed in that code?