10seconds Posted January 21, 2006 Posted January 21, 2006 Hi People, I want to know if you can sort products by one column THEN sort by the nest column. I have a music / dvd store and want to sort products by Artist then by Title. So for example all the Beatles Cd's are together but the titles are also sorted alphabetically.At present they only sort artists alphabetically ..the titles are all over the place .I worked out how to change the primary sort columns but can 't work out how to add an extra column. here is my code from index.php 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_ARTIST') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_artist "; break; Hope one of the geniuses out there can help me Cheers Daniel
boxtel Posted January 21, 2006 Posted January 21, 2006 Hi People,I want to know if you can sort products by one column THEN sort by the nest column. I have a music / dvd store and want to sort products by Artist then by Title. So for example all the Beatles Cd's are together but the titles are also sorted alphabetically.At present they only sort artists alphabetically ..the titles are all over the place .I worked out how to change the primary sort columns but can 't work out how to add an extra column. here is my code from index.php 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_ARTIST') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_artist "; break; Hope one of the geniuses out there can help me Cheers Daniel order by pd.products_artist, pd.products_title Treasurer MFC
10seconds Posted January 22, 2006 Author Posted January 22, 2006 order by pd.products_artist, pd.products_title Thanks for that ,worked like a charm
Recommended Posts
Archived
This topic is now archived and is closed to further replies.