Guest Posted March 27, 2006 Posted March 27, 2006 Trying to find a way to sort my products by "image name". I have about 20,000 products, but not all of them have images. I'm trying to find a way to make the products without images show last. All of my product image names are numbers (e.g. 100483.gif) and by defult, if there is no image it uses "NO-IMAGE-AVAILABLE.gif" Does it make sense to sort by 'image name ascending', so images with numbers will come first, then the defult "NO-IMAGE_AVAILABLE.gif" will come last. The problem is I don't know where to change this. The best I can find is in index.php these lines: 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"; break; } } I tried changing $listing_sql .= " order by pd.products_name"; to: $listing_sql .= " order by p.products_image"; Didn't seem to work exactly the way I hoped. Maybe I'm missing something, maybe I'm way off. Any input would be great Thanks, Jrock
Guest Posted March 27, 2006 Posted March 27, 2006 try $listing_sql .= " order by p.products_image desc";
Recommended Posts
Archived
This topic is now archived and is closed to further replies.