Guest Posted December 13, 2004 Share Posted December 13, 2004 Anyone know how to make the sort order by 'Price' rather than 'Description' as default when products are displayed, rather than the shopper having to click the column header :blink: Link to comment Share on other sites More sharing options...
ghiggi Posted December 14, 2004 Share Posted December 14, 2004 In index.php in the root directory find: 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"; change to: 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_PRICE') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by final_price"; This will sort by lowest price to highest price. If you want to sort by highest to lowest, change the above code to: 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_PRICE') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by final_price desc"; That should do it. Link to comment Share on other sites More sharing options...
Guest Posted December 14, 2004 Share Posted December 14, 2004 :thumbsup: See all it takes is knowledge - thx loads, I knew it would be that string I just didn't know how to change it without the fear of breaking something else. Thx again for the quick & spot on reply. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.