Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Sort products not by name...


Recommended Posts

search for


$listing_sql .= " order by pd.products_name";


in your index page

i believe this is the default order statement


change it to


$listing_sql .= " order by p.products_model, pd.products_name";


this should order by model then name


or for just model try


$listing_sql .= " order by p.products_model";



always here to offer some useless advice....

Link to comment
Share on other sites

if its okay id like to tag along and add a question



i basicly have his same problem with Available Options. id like it to sort by like id number or some thing so i can have it in the order i want it to have the drop downs in. for example i have say memory processors and hard drives as options. id like for processors to be the first option they can select atm it aranges them alphabetically. any ideas?

Link to comment
Share on other sites

no problem and if an occasssion requires it you can add limits to the number of items shown on a given page.

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

alright the contrib link u linked me to wasnt really what i was looking for yet i would be lookign for it down the road so thanks i just in stalled it. but im looking to sort the option name not the option value in the drop down i want to beable to have what it says for name sorted not the order of the drop down.

any idea on that one?

Link to comment
Share on other sites

got it working. Just for the record incase someone reads this, its actually:







Link to comment
Share on other sites

There are two places in index.php that have to be changed in order for the second and subsequent pages to be sorted by model. If you only change the first of these, the first page gets sorted by model, but other pages don't. I changed these two sections and it works fine:


change pd.products_name to p.products_model in


if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by p.products_model";



and change pd.products_name to p.products_model in



$listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '');

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...