Guest Posted July 6, 2008 Share Posted July 6, 2008 Sorry for what will probably be a silly question but believe it or not i cannot find any answer to my problem any where in the forum search. All i want to do is change the way the products are displayed throughout the shop which will include search results and any other product display pages. Currently, my products display in alphabetical order but i really need them to display with the highest price product at the top of the list and then descending in order of price. Where will i find the code that controls this. please help even if you want to call me daft for asking. Link to comment Share on other sites More sharing options...
♥geoffreywalton Posted July 6, 2008 Share Posted July 6, 2008 You need to change the sort order. On each page where you want to change the sequence you need to find the words "order by" and cange to value to the one you require. Read the mysql section that covers order by in www.w3schools.com Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>. Link to comment Share on other sites More sharing options...
spooks Posted July 6, 2008 Share Posted July 6, 2008 I delt with some of that in this thread http://www.oscommerce.com/forums/index.php?sho...=306310&hl= Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted July 7, 2008 Share Posted July 7, 2008 thanks for that guys, but i changed the index.php under the main root directory as displayed in your reply but it still doesn't work. It is still displaying in alphabetical order. :( Link to comment Share on other sites More sharing options...
spooks Posted July 7, 2008 Share Posted July 7, 2008 thanks for that guys, but i changed the index.php under the main root directory as displayed in your reply but it still doesn't work.It is still displaying in alphabetical order. :( So you changed (195): 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"; To: for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { if ($column_list[$i] == 'PRODUCT_LIST_PRICE') { $HTTP_GET_VARS['sort'] = $i+1 . 'd'; $listing_sql .= " order by final_price desc"; And it made no differance!!!! Or did you not read everything? Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted July 7, 2008 Share Posted July 7, 2008 OK - I'm a schmuck. I did read the previous post but just got a wee bit confused over all the changes needed as the examples given were general and i didn't look any further forward than that. thanks so much for your help and sorry again :rolleyes: That worked great but the Whats New Display in the middle of the index page is still showing in alphabetical order, so i assume that bit is controlled via another bit of code in another file somewhere else ? In the file new_products.php starting at line 20 it says this: if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } Now is it the line above that says ""order by p.products_date_added desc limit"" the bit that needs changing Please don't lose patience with me as this is still my first post :blush: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.