ComicWisdom Posted April 25, 2008 Share Posted April 25, 2008 When the list of items in a category comes up, I would like the items to be displayed from highest price first by default to lowest price. If possible, I would even like to disable any other sort order. Could someone help with this please? Thank you, Ralph Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!! Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience. The quickest way to learn is to forget to BACKUP! Link to comment Share on other sites More sharing options...
ohioman Posted April 25, 2008 Share Posted April 25, 2008 Ok.. that would come up in your index.php page. My index page is modified heavily so i'm not sure about the exact line number... but somewhere in the middle of your script... look for this: // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; Try changing it to this: // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'" ORDER BY p.products_price DESC; That should give you your products most expensive first. As far as disabling any other sort orders, I really didn't notice any breifly looking through the script. Here is one thing to keep in mind: If you see ORDER BY at the end of a query it is sorting it. If you still get results anywhere else, you can simply remove the sorting feature at the end or if it just says something like.. ORDER BY products_name... just take that out and it is no more. Hope this helps, Iceman :thumbsup: When the list of items in a category comes up, I would like the items to be displayed from highest price first by default to lowest price. If possible, I would even like to disable any other sort order. Could someone help with this please? Thank you, Ralph Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.