Guest Posted July 23, 2003 Posted July 23, 2003 I have change the default of my product listings to sort by date added. I have change this by altering the following code found in 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_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_date_added"; break; } } The problem is it displays the oldest products first. Does anyone know how I can change it to show the newest products first. Regards, Carl.
Rumble Posted July 23, 2003 Posted July 23, 2003 Hi there! Change this line in your code from $listing_sql .= " order by p.products_date_added"; ...to.... $listing_sql .= " order by p.products_date_added " . ($sort_order == 'd' ? 'desc' : ''); OR....... $listing_sql .= " order by p.products_date_added " . ($sort_order == 'a' ? 'asc' : ''); I can't remember which one it is :? but one of them should work the way you want it! Make sure you back up before you try! Reddy to Rumble Thank you osCommerce and all who Contribute to her!
Rumble Posted July 23, 2003 Posted July 23, 2003 Hi, For sort by price change $listing_sql .= " order by pd.products_name"; to..... $listing_sql .= " order by p.products_price"; Back up before you try! Reddy to Rumble Thank you osCommerce and all who Contribute to her!
murdock Posted July 24, 2003 Posted July 24, 2003 Once againthe forum does it again. Another problem solved... thanks for all hard work.. I now sort by price :?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.