This contribution allows you to sort the products in a category by multiple methods, by best sellers, products name, and by price. The best sellers are updated daily by cron job and you can set the number of days back to look at sales to base your best sellers on.
The way sort by price and name is pretty straightforward, the way best sellers works is each order counts as one sale so if someone orders 50 of item (A) and item ( B ) is ordered 5 times but only 1 each time, item ( B ) will show 5 sales and item (A) will show only 1 so the one that was more popular with multiple people will be ranked higher -- item B. This can be changed by modifying the code in cron_update_bestsellers.php slightly if you wish to count by total number of items sold instead it is noted how to do so in the code.
Legend: 
Download

Report
All regards for this great contribution and easy to follow readme.txt belongs to homewetbar
This v1.2.1 (FULL VERSION):
1.) Is correcting the missing `order by` in the readme.txt here.
See: http://forums.oscommerce.com/index.php?showtopic=213587&st=20#
case 'PRODUCT_LIST_NAME':
$listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
break;
case 'PRODUCT_LIST_30SALES':
$listing_sql .= " order by p.products_recent_sales desc, pd.products_name desc";
break;
2) Is additionally removing some spaces in file and directory name, which would making you mad on *nix systems otherwise.
Fixes an error I have encountered that applies to all previous installs. It is a count error where products with attributes were counted multiple times.
Easy to upgrade, just copy the new cron_update_bestsellers.php over your old one.
Please note the fix by marabay below, after reading the forum it does not seem that error appears for anyone but them.
FULL VERSION
When browsing to next page the sorting dosent continue.
Now it do.
Added the ability to sort search results by best sellers too!
-Easy upgrade, just follow optional instructions at the end of the install doc.
FULL VERSION
SUPPORT FORUM: http://forums.oscommerce.com/index.php?showtopic=213587
Prev contribution had a bug when on standart oscommerce you get last column doubled in your product listing. This package has an updated installation readme to fix this. Full package.
File below was missing the cron job file. Included now. Full Version
File below was missing the cron job file, included now. Full version.
SUPPORT FORUM: http://forums.oscommerce.com/index.php?showtopic=213587
This contribution allows you to sort the products in a category by multiple methods, by best sellers, products name, and by price. The best sellers are updated daily by cron job and you can set the number of days back to look at sales to base your best sellers on.
The way sort by price and name is pretty straightforward, the way best sellers works is each order counts as one sale so if someone orders 50 of item (A) and item ( B ) is ordered 5 times but only 1 each time, item ( B ) will show 5 sales and item (A) will show only 1 so the one that was more popular with multiple people will be ranked higher -- item B. This can be changed by modifying the code in cron_update_bestsellers.php slightly if you wish to count by total number of items sold instead it is noted how to do so in the code.