DazedAndConfused Posted December 6, 2003 Share Posted December 6, 2003 I'm simply trying to get the products (on all listings) to sort by price (highest to lowest) instead of product name by default. I've searched all the forums and even downloaded a few contributions I thought would work. It seems like I'm just looking for the location to change the variable to default all product listings to ORDER by PRODUCT_LIST_PRICE DESC. Thanks in advance.... I'd like to actually rest tonight instead of throwing my laptop through a wall!!!!! Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2003 Share Posted December 6, 2003 In catalog/index.php change: if ($column_list[$i] == 'PRODUCT_LIST_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; break; to: if ($column_list[$i] == 'PRODUCT_LIST_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by final price desc"; break; This will sort descendingly - use 'asc' to sort ascendingly. Matti Link to comment Share on other sites More sharing options...
DazedAndConfused Posted December 6, 2003 Author Share Posted December 6, 2003 Thank You Thank You!!! I knew it was an easy fix, just didn't know where to call it from. I Get To Go To Sleep Tonight!!!!! :D Link to comment Share on other sites More sharing options...
brina Posted December 29, 2003 Share Posted December 29, 2003 Where is catalog/index.php? If my site is mysite.com and I created the folder osCommerce to contain my shopping cart, then where exactly is the catalog folder? Link to comment Share on other sites More sharing options...
Guest Posted December 29, 2003 Share Posted December 29, 2003 The folder osCommerce is probably the catalog folder in your case. The catalog folder will have checkout_shipping.php, create_account.php, product_info.php, etc. in it. includes and images will be subdirectories of the catalog folder. Hth, Matt Link to comment Share on other sites More sharing options...
emanresu Posted December 29, 2003 Share Posted December 29, 2003 Hello Tried it and got 1064 - You have an error in your SQL syntax near 'price asc limit 0, 20' at line 1 select p.products_image, pd.products_name, 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 products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '76' order by final price asc limit 0, 20 We've adjusted currencies.php in classes to show VAT & non VAT prices. Is there an alternative SQL field name we can use to get the same effect? Citizen of US Minor Outlying Islands Link to comment Share on other sites More sharing options...
Guest Posted December 30, 2003 Share Posted December 30, 2003 You want final_price, not final price. _ not space. Hth, Matt Link to comment Share on other sites More sharing options...
Guest Posted December 30, 2003 Share Posted December 30, 2003 This is the correct code to insert if ($column_list[$i] == 'PRODUCT_LIST_PRICE') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by final_price asc"; break; The two things changed are: 'PRODUCT_LIST_PRICE' final_price Link to comment Share on other sites More sharing options...
emanresu Posted December 30, 2003 Share Posted December 30, 2003 Thanks - its working now B) Citizen of US Minor Outlying Islands Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.