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

categories.php
– 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

/includes/languages/english/categories.php
– some wording to make it understandable

/includes/functions/general.php
– new function to enable the red/green buttons to work

Shop changes

/includes/modules/featured_products.php
/includes/modules/new_products.php
/includes/boxes/best_sellers.php
/includes/boxes/reviews.php
/includes/boxes/specials.php
/includes/boxes/whats_new.php
specials.php
products_new.php
index.php
advanced_search_result.php
product_reviews.php
product_reviews_info.php
product_reviews_write.php
reviews.php
– 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”.

/includes/functions/general.php
– 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.