veni Posted January 30, 2007 Share Posted January 30, 2007 I'm not using a modified version of OSCommerce and I would like to know how I can have the products show by DESCENDING order when I click on any categorie from the categorie menu? If possible I would like to hard code it to DEESCENDING as becomes default sorting. I tried using some of the contributions but they generated errors so I think if I hard code it it should work. Can anyone help me please? Link to comment Share on other sites More sharing options...
wheeloftime Posted January 30, 2007 Share Posted January 30, 2007 I'm not using a modified version of OSCommerce and I would like to know how I can have the products show by DESCENDING order when I click on any categorie from the categorie menu? If possible I would like to hard code it to DEESCENDING as becomes default sorting. I tried using some of the contributions but they generated errors so I think if I hard code it it should work. Can anyone help me please? When you click multiple times on the product name column it will switch between sorting ascending and descending just like for the other columns you show ?! If you really need to have it started descending you will have to make the below changes to your (catalog)/index.php: Find: $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; and replace with $HTTP_GET_VARS['sort'] = $i+1 . 'd'; $listing_sql .= " order by pd.products_name desc"; HTH Link to comment Share on other sites More sharing options...
veni Posted January 30, 2007 Author Share Posted January 30, 2007 When you click multiple times on the product name column it will switch between sorting ascending and descending just like for the other columns you show ?! If you really need to have it started descending you will have to make the below changes to your (catalog)/index.php: Find: $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; and replace with $HTTP_GET_VARS['sort'] = $i+1 . 'd'; $listing_sql .= " order by pd.products_name desc"; HTH It worked thanks. I wasn't actually specific enough in my first post. I want to have the Item sorted by DESCENDING order by date added into the catalogue or Manufacturer ID. Can you still help me? Link to comment Share on other sites More sharing options...
wheeloftime Posted January 30, 2007 Share Posted January 30, 2007 It worked thanks. I wasn't actually specific enough in my first post. I want to have the Item sorted by DESCENDING order by date added into the catalogue or Manufacturer ID. Can you still help me? You mean just keep the default product name sort order but within that by date added or manu. ID ? Expand a little for this on the products_name parts in this same index.php file. If what you want should also be true for searches you will have to go for the advanced_search_result.php file also. Link to comment Share on other sites More sharing options...
veni Posted January 30, 2007 Author Share Posted January 30, 2007 You mean just keep the default product name sort order but within that by date added or manu. ID ?Expand a little for this on the products_name parts in this same index.php file. If what you want should also be true for searches you will have to go for the advanced_search_result.php file also. As of now, when I click on a category on my category menu all the item are display Alphabetically by Ascending (a-z) order. The mod you gave me changes it to DESCENDING order (Z-A). What I want is when I click on the category menu it displays the most recent items that I added first hence the alphabetical sorting does not take place, instead it will only list the must recent added items firrst, from ealiest to Oldest. I only one that feature applicable when I click on a categry from the category menu. I hope this is clearer now Thanks Link to comment Share on other sites More sharing options...
wheeloftime Posted January 30, 2007 Share Posted January 30, 2007 As of now, when I click on a category on my category menu all the item are display Alphabetically by Ascending (a-z) order. The mod you gave me changes it to DESCENDING order (Z-A). What I want is when I click on the category menu it displays the most recent items that I added first hence the alphabetical sorting does not take place, instead it will only list the must recent added items firrst, from ealiest to Oldest. I only one that feature applicable when I click on a categry from the category menu. I hope this is clearer now Thanks Okay. Look again for: $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; and change to $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_date_added, pd.products_name"; Next to that add the field p.products_date_added to all the queries you find just above this code part. Add it ie. between de p.products_price and p.products_tax_class_id so it looks like p.products_price, p.products_date_added, p.products_tax_class_id Link to comment Share on other sites More sharing options...
veni Posted January 30, 2007 Author Share Posted January 30, 2007 Okay. Look again for: $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; and change to $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_date_added, pd.products_name"; Next to that add the field p.products_date_added to all the queries you find just above this code part. Add it ie. between de p.products_price and p.products_tax_class_id so it looks like p.products_price, p.products_date_added, p.products_tax_class_id I thank you very much for your help. Is is possible to to Order them by Product model number instead of product date added? Link to comment Share on other sites More sharing options...
wheeloftime Posted January 30, 2007 Share Posted January 30, 2007 I thank you very much for your help. Is is possible to to Order them by Product model number instead of product date added? With all the information you should be able to figure that out easily ;) Link to comment Share on other sites More sharing options...
veni Posted January 30, 2007 Author Share Posted January 30, 2007 With all the information you should be able to figure that out easily ;) Ok this is what I did. Since I wanted the item to sort By DESCENDING by their Product_id, in the index.php I did this: $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_id"; break; and I found all instances of p.products_price, p.products_tax_class_id and replaced them with p.products_price, p.products_id, p.products_tax_class_id Even tough I don't get any errors it does not sort at all. Link to comment Share on other sites More sharing options...
wheeloftime Posted January 30, 2007 Share Posted January 30, 2007 Ok this is what I did. Since I wanted the item to sort By DESCENDING by their Product_id, in the index.php I did this: $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_id"; break; and I found all instances of p.products_price, p.products_tax_class_id and replaced them with p.products_price, p.products_id, p.products_tax_class_id Even tough I don't get any errors it does not sort at all. You don't have to add p.products_id to the queries as it is already there ! $listing_sql .= " order by p.products_id desc"; should give different output. Link to comment Share on other sites More sharing options...
veni Posted January 30, 2007 Author Share Posted January 30, 2007 You don't have to add p.products_id to the queries as it is already there ! $listing_sql .= " order by p.products_id desc"; should give different output. I thank you a million times, that's exactly I wanted to achieve. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.