dculley Posted May 24, 2015 Share Posted May 24, 2015 How do you set the product name to descending? At the moment, product name is it not in any kind of order and it jumps around when you click on one line, before you can click on edit. The order is forever changing. Would like to lock this down. I just do not know where to set it? In the standard osc234 the product names are descending and do not jump around. Dean Link to comment Share on other sites More sharing options...
Hotclutch Posted May 24, 2015 Share Posted May 24, 2015 This is the standard query in Admin\categories.php $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name"); } else { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name"); You will see that the default sort order is by name (ascending). Add DESC so that you have: $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name DESC"); } else { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name DESC"); Link to comment Share on other sites More sharing options...
dculley Posted May 24, 2015 Author Share Posted May 24, 2015 @@Hotclutch Hi Ashley, I checked my line codes in admin/categories and they already have "desc" at the end. Seems to behaving no effect. I did try and find an add-on but no luck there. Link to comment Share on other sites More sharing options...
Hotclutch Posted May 24, 2015 Share Posted May 24, 2015 Then your existing code has been modified already from the standard, i copied that query from a new install package. Link to comment Share on other sites More sharing options...
dculley Posted May 25, 2015 Author Share Posted May 25, 2015 @@Hotclutch Think I hit a home run :lol: I don't give up easy. Saw the missing bit and fixed it at the end, also removed DESC from the end. DESC put it in z to a mode. Leaving it off put it in a to z mode. Thank you very much. Dean Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.