Featured Products in osCommerce
One of the very finest things you can do to make your customers experience better is to point them at your special offers and featured products.
In standard osCommerce, the "New Products" box on the first page is pretty useless - it's just a list of the latest 9 products added. My idea is to use that box to show "Featured Products" instead - so I set about finding a cleanly coded solution.
Guess what? I couldn't find one.
Sure, there are a few "featured" contributions, but all of them are rather clunkily coded (including one I made many years ago)! So, I set about recoding a few files to make adding featured products really easy.
Have a look at the video below;
Basically, my idea is to have a "flag" to set the featured status or not (in eaxctly the same way that you use it to set the product in or out of stock). This makes it really easy to set a product featured.
My other thought was to use the existing "New Products" box ratyer than have to code a new one - so I did!
The result is a cleanly coded "Featured Products" contribution that sticks to osCommerce coding convention and is easy to install. Just a few drop-in files if you install a new store, and if you have an existing store, just a few lines of code to add to a few files;
- /admin/categories.php
- /admin/includes/languages/english/categories.php (and obviously german etc)
- /admin/includes/functions/general.php
- /includes/modules/new_products.php
And that is it! I will zip it up and add it to the contributions area later on.



Now available at; http://addons.oscommerce.com/info/5848
Please note that any and all support is done at this thread - nowhere else. I offer an installation service at $25.00 to $50 (or more, it depends upon what you have installed already) if you cannot manage to install this yourself.
Only the english language is supplied, if any readers would like to translate the few bits of text, here they are;
Featured
Feature in New Products
Yes
No
Please do post your german, french, spanish, polish etc etc translations here, and I will add them into the download. Thanks.
Comment by Gary — April 2, 2008 @ 11:08 am
Hi, this is my first osc website and your contrib. is just what i was looking for. I do´nt understad WHY this contrib is not standard to osc.
I could not find a install.txt or instructions on what to ad since my website is already running and i ca´nt just copy/paste files.
Thanks for the contrib, lloking forward to using it !!!!
Comment by Gaston — April 2, 2008 @ 1:46 pm
Hi Gaston
For an already developed store, you'll need to use a program like Beyond Compare - to compare your EXISTING file to my NEW files…
You'll be able to see the changes really easily. If you cannot manage I offer an installation service at $25 to $50 usd (price depends upon what you have already installed).
Thanks, Gary
Comment by Gary — April 2, 2008 @ 2:37 pm
as a new user to oscommerce i was advised to move from RC2a to MS2. Can this be used for MS2?
Comment by Adam — April 3, 2008 @ 7:21 am
Adam - should work OK in MS2, but I have not tested it.
Why anyone would advise you to go from RC2a to MS2 though - what was the reason for that?
Comment by Gary — April 3, 2008 @ 7:25 am
i was @ oscanswers. contributions like Fast Easy Checkout & HTC work, & some of the speed
optimisation thread is specific to MS2. i will work on both sites and see where
it takes me … so much to learn
Comment by Adam — April 3, 2008 @ 3:03 pm
Adam - it is true that some contribs won't work on RC2a - but to be honest, it's not all that many that don't…
Let us know how you get on.
Comment by Gary — April 3, 2008 @ 3:08 pm
Hi,
There is a bug, I tried to upload it to the contribution area but could not as it is locked.
Go to the link below and you will see the fix, might be an idea for those of you who have installed it to fix the bug and for Burt to update the contribution.
http://forums.oscommerce.com/index.php?showtopic=298837
This contribution is amazing, thank you!
Comment by Richard — April 10, 2008 @ 5:50 pm
Richard - many thanks for spotting that bug. I will update the contribution tomorrow. Cheers!
Comment by Gary — April 10, 2008 @ 9:40 pm
I have had a few requests for installation. Yes, this is available at a small cost. I need to have the following;
1. Access to your shop Admin Area.
2. Access to PHPMyAdmin (usually in the host control panel)
3. Access to FTP
If you want to have this installed please email me on oscshops@gmail.com - giving all the above info. I will email you back to let you know my paypal email address.
DO NOT POST PRIVATE INFO IN THIS BLOG!
Comment by Gary — April 13, 2008 @ 9:37 am
[…] rather than the last 9 added/amended products. A better option in my opinion would be to add a "Featured Products" contribution, as I think that no customer wants to see Random […]
Pingback by Club osCommerce » Random Products on Front Page — April 18, 2008 @ 10:41 am
Struggling to get this installed due to the fact I have a "product sort order add on" already installed. Any pointers would be appreciated.
many thanks Chris
Comment by Glosticks — April 21, 2008 @ 9:57 am
Chris - that's the problem with osCommerce unfortunately - contributions tend to make a mess of the base code and so adding furhter contributions is difficult.
I offer an install service should you not be able to get it up and running. Please email me if you need to have a chat about that and get a price. Gary
Comment by Gary — April 21, 2008 @ 10:09 am
I installed this feature on fresh installed osc…but the feature settings do not reflect the changes on the index page.
Comment by mike — April 23, 2008 @ 2:45 am
Mike - you have installed it incorrectly. I offer an install service should you not be able to get it working.
Comment by Gary — April 23, 2008 @ 6:47 am
Same problem with my friends installation. Fresh installed osc with your feature… but doesn't reflect the change. I am almost done with manual installation file for who wants manual install…but it's useless if the fresh install doesn't even work. Just try it.
Comment by mike — April 23, 2008 @ 4:29 pm
Mike - strange that many have installed without problems. Very strange
Would suggest that you are not doing things correctly, wouldn't it?
Comment by Gary — April 23, 2008 @ 4:48 pm
i'm going to try install in php 5…currently it was tested on php 4.5.
Comment by mike — April 23, 2008 @ 5:11 pm
Works great - thanks!!
Comment by jgeoff — April 28, 2008 @ 11:00 pm
Hi, great contribution, got it to work perfectly, many thanks!
If I may ask, in which order is the products listed within the featured group?
In the order they was listed as "featured" (1-2-3), on an alphabetical A-B-C basis, or random? Does their home category make any difference on in what order they appear?
Thanks for your time.
Comment by Sam — April 29, 2008 @ 3:04 am
jgeoff - thanks for letting me know
Sam - ordered by "date added". So if you have the 9 products in the "new prodcuts" box, and 3 of those are featired, you'd get the first 3 as featured, ordered by date added, then the next 6 would just be the last added products.
Comment by Gary — April 29, 2008 @ 7:07 am
Thanks for your fast reply Gary. Ah, I see. That makes sense.
Is there a way to alter the date of a product listed in the database manually?
Just curious; in some circumstances it could help the design of a front page even further to be able to move a product within the group.
Comment by Sam — April 29, 2008 @ 3:26 pm
Sam - you should be able to amend the date using phpmyadmin. most likely in the products table, using the products_date_added row
Comment by Gary — April 29, 2008 @ 4:49 pm
Thanks Gary, will have a look!
and again, great contribution, just what I have been looking for.
How much is a beer where you are?
Comment by Sam — April 29, 2008 @ 5:24 pm
Question, and I hope it's not silly, but how do I make it default to "No" when adding new products?
I tried switching the 0s and 1s here, in /admin/categories.php, but that didn't do it…?
Comment by jgeoff — April 29, 2008 @ 9:20 pm
jgeoff - find this:
case '0': $in_featured = false; $out_featured = true; break;
case '1':
default: $in_featured = true; $out_featured = false;
change it to this:
case '0': $in_featured = false; $out_featured = true; break;
case '1': $in_featured = true; $out_featured = false; break;
default: $in_featured = false; $out_featured = true;
Actually , you found a "bug" - thanks - I'll update the contribution with the new codebase later on today.
Comment by Gary — April 30, 2008 @ 7:15 am
That works - thanks!
Comment by jgeoff — April 30, 2008 @ 7:29 am
Wait, it doesn't work… it seems everything I add is automatically Featured, before and after this update. Any other ideas, or is it just me?
Comment by jgeoff — April 30, 2008 @ 7:30 am
Works OK on mine. Must be "just you"
Comment by Gary — April 30, 2008 @ 7:36 am
LOL The radio button says "No", but after submitting it's still featured… for me.
Comment by jgeoff — April 30, 2008 @ 7:55 am
Ah well - if you want me to take a look email me your admin and ftp details to oscshops AT gmail DOT com
Comment by Gary — April 30, 2008 @ 7:58 am
For you it works just fine, after adding a test product and checking your index?
Comment by jgeoff — April 30, 2008 @ 8:03 am
Yep.
Comment by Gary — April 30, 2008 @ 8:13 am
I'll contact you tomorrow after I recheck things. For you it's 8:15AM… for me, it's pre-bed 4:15AM lol
Comment by jgeoff — April 30, 2008 @ 8:17 am
Jgeoff is having a same problem as me. The radio button is "No" but you can still see in index page. I fresh installed last time…but result is the same. I was hoping you can find the bug and let me know.
Comment by mike — May 7, 2008 @ 7:15 am
There is no bug that causes this - it's user error
Comment by Gary — May 7, 2008 @ 7:18 am
Works for me too!
PHP Version: 5.2.0
Database: MySQL 5.0.27
Comment by Richard — May 8, 2008 @ 4:53 pm
does your version show products from subcategories?
Comment by Chris — May 11, 2008 @ 4:13 pm
Chris - in the front page, it shows the products that you selected to be "featured" (regardless of what category or subcategory these featured products are in). On category/subcat pages it does not show featured at all (but can easily be changed to show them) - 1 simple little sql change - no more than 30 seconds extra work. Gary
Comment by Gary — May 11, 2008 @ 4:48 pm
I copied the downloaded files over my original files (I know, not the best way to do things, but I'm technically challenged). I got an error message on the home page of my store. I thought I copied the original files over the new ones, but now the feature products are working, but the Categories/Products page on the administration website is empty. Everything else about the administration site and the store itself is working, I just can't access the products at all. Any suggestions?
Comment by Emma — May 27, 2008 @ 1:32 pm
Emma - most certainly not the best way to do things. Make a mirror of your live site on your home or owrk computer and make any changes there first. When happy everyhting works, upload the changed files to your live site. See this for more details. Assuming you have not got a backup, you need to either: Keep working until you find the fix, or pay someone to fix it for you. If you have a backup of you original files, just upload the backup - and then make the changes as per the "already installed" fileset.
Comment by Gary — May 27, 2008 @ 2:01 pm
I downloaded a copy of Feature Products, however it is a nightmare to install if you have a heavily modified site.
I like to think I know my way around installing a mod, however this one has no instructions and using winmerge to compared the files is impossible with some files.
It is referenced in the README.txt and on this page that there is instructions for mod sites to install feature products, however I am unable to find any.
Is there going to be a instruction manual coming soon? Or even some basic commenting in the code to highlight what has been added.
I am stuck on the functions/general.php page. everything else was simple. It's just this page light's up like a Christmas tree in winmerge.
Thanks!
Comment by Laurence — May 30, 2008 @ 2:34 am
I was able to find out which function is needed from general.php by going step by step through the code.
The contribution works like a charm!
Thank you!
Comment by Laurence — May 30, 2008 @ 2:44 am
Laurence - not too difficult really is it
Comment by Gary — May 30, 2008 @ 7:39 am
Not if you stop and use your brain!
Comment by Laurence — June 3, 2008 @ 10:24 am
Am I right in think that the SQL file thats attached in this conrtib needs to be uploaded to your existing database?
Thanks!
Comment by aoife — June 23, 2008 @ 3:40 pm
Aoife - that's right
Comment by Gary — June 23, 2008 @ 4:23 pm
Featured Products works great. I had to rely heavily on Beyond Compare.
Question - I want to display ONLY the products flagged as featured, regardless of whether or not they are new products. What needs to be changed in the SQL (and in what files) to make this work?
Comment by Charles — June 24, 2008 @ 1:52 pm
Charles - you'd need to play with the new_products module, off the top of my head;
Find this: where products_status = '1'
Change to: where products_status = '1' AND p.products_featured = '1'
Comment by Gary — June 25, 2008 @ 4:18 pm
Thanks Gary! That worked.
Comment by Charles — June 26, 2008 @ 10:08 am
Hello once again!
The feature is a charm. Installing it a second time is quite easy. I just went through my personal version and commented the admin/categories.php page where the changes exists - mainly cause my categories.php page is already heavily altered.
It would be great to see in future updates a page where it displays all the items that has featured set to '1' and then allows you to sort the order.
Thanks!
Laurence
Comment by Laurence — July 4, 2008 @ 3:13 am
Love this.
One thing tho. I most likely have missed something. How do I change the wording on the box (New Products For July)
Comment by cassie — July 12, 2008 @ 5:11 am
Deb - good work!
Cassie - in teh language file for index.php
Comment by Gary — July 12, 2008 @ 2:32 pm
Oh my goodness *blush*
Thank you for that. I search and searched where I was to change it and had a feeling it had to be that file. Found it the moment I opened up again to go looking lol.
Awesome Thank you for your help and all your work
Comment by cassie — July 13, 2008 @ 1:49 am
I have a small problem. This works great on my main shop. I am in the process of setting up a new shop. I installed it everything seemed to be working but now it does not. I am not getting any errors. Just if I try to set at featured Product in Admin nothing happens. The little icon light stays red and the box that shows the items in the shop is just showing new Items as I upload the.
When I am putting in all my details for new Item in does not matter if I make it a featured product or not does nothing. Any ideas what has happened. I have gone over files and nothing is glaring at me what could be wrong
Comment by Cassie — July 22, 2008 @ 11:44 am
Cassie - do the other buttons work - the ones which turn the STATUS of the product on and off?
Comment by Gary — July 22, 2008 @ 3:02 pm
Hi Gary Yes the Status buttons work.
Comment by cassie — July 23, 2008 @ 12:51 am
Hi again.
Wondering if uninstalling and redoing it would make any difference. Tho have no idea about the SQL stuff if I need to do something there.
Any ideas on what could be the problem?
I have gone over all files and cannot see the problem at all
Comment by cassie — July 27, 2008 @ 2:00 am
If the status buttons work, then it's not an issue with your website or your website hosting. It can only be some code that you have missed somewhere…
Comment by Gary — July 27, 2008 @ 8:40 am
Thanks Gary.
I ended up moving hosts and we had no end of problems with heaps of things on that host and once we moved everything over. My own fault for using the first host. Ended up just doing a whole new fresh install and one at a time adding mods.
Works a charm on new install with all the mods added
Thanks
Comment by cassie — July 27, 2008 @ 11:06 am
Good one
Comment by Gary — July 27, 2008 @ 12:03 pm
Hi there, I'm pretty new to this so it may be blindingly obvious but how can I hide the prices being displayed here? Thanks! D.
Comment by Daleos — July 28, 2008 @ 3:18 pm
Daleos - I think you would need to amend the module directly. Remove this:
' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '
Comment by Gary — July 28, 2008 @ 7:46 pm
Thanks Gary, that's great!
Comment by Daleos — July 30, 2008 @ 9:29 am