Hide Products in osCommerce

By | November 20, 2010

The other day, one of my very good clients came up with the idea of having hidden products. That is products that do not show anywhere in his site other than on it’s own product_info.php page. It suits the way the client does business.

I knew that there was a contribution that can handle this already, but as my client has a highly modified site it would be easier to simply code this up from scratch, as I have a good handle on the clients website, and where-ever possible I avoid other peoples contributions.

So…first up was to set up an extra entry in the products table of the database, which is basically a flag to say “show or hide” product.

Admin changes

– addition of red/green button to set product to “show” or “hide” (in the usual table view)
– addition of radio buttons to set this during adding/editing

– some wording to make it understandable

– new function to enable the red/green buttons to work

Shop changes

– all of these files needed changing to add an extra piece to the SQL that shows lists of products, in order to NOT show any hidden products, those with a status of “hide”.

– in here I had to add similar to stop the category counts from showing products that have a “hide” status.

As you can see, what should be a simple change is made quite complex by osCommerce not being very modular. And that is the exact reason why you should never attempt anything in osCommerce if you are not confident in your abilities!

Leave a Reply

Your email address will not be published.