Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to display out of stock / inactive products


Guest

Recommended Posts

I used OSC to build an online comic store. Some of my customers asked if I could also display the out of stock items on the site and after trying every conceivable option in the Admin Area, found that the only way to do this is to set the Inactive Product Status to Active, either by way of Easy Populate or changing one product at a time. That wasn't a big deal, but the problem is that I need to keep subtract stock as "true", so the minute a new product sells out, you have to go in and manually change it's status to "Active" again.

 

So how do you permanently display out of stock (inactive) products in your catalog?

 

It's not as easy as it sounds, especially if your PHP skills are limited to a basic understanding of how it works (or less).

 

The specific reference that you have to remove is "p.products_status = '1' and " (without the quatation marks and remember to also delete the space after "and" otherwise it will leave a double space) It can be found in all of the following files:

 

Root (main folder where OSC is located)

index.php

product_info.php

popup_image.php

advanced_search_result.php

products_new.php

product_reviews.php

product_reviews_write.php

reviews.php

specials.php

tell_a_friend.php

 

includes/boxes/

best_sellers.php

reviews.php

specials.php

 

includes/functions/

general.php

 

I used Ultra Edit to search for and modify the files, but I guess any text editor will do. Please backup these files before changing anything!!!

 

To display the products in the catalog, you only need to delete "p.products_status = '1' and " in the following files (Some files have more than 1 reference so make sure you delete ALL of them!):

 

Root (main folder where OSC is located)

index.php

product_info.php

popup_image.php

advanced_search_result.php

 

Additionally you can also edit the following files, depending on whether you want customers to see and write reviews/tell a friend/display best sellers/see specials on Out of Stock products (I only edited all the "reviews" files, since I only wanted customers to be able to write and read reviews on Out of Stock products):

 

Root (main folder where OSC is located)

product_reviews.php

product_reviews_write.php

reviews.php

specials.php

tell_a_friend.php

 

includes/boxes/

best_sellers.php

reviews.php

specials.php

 

includes/functions/

general.php

 

Personally I can't see why anybody would want to display Out of Stock items for New Products, but if that's what you want also edit "products_new.php"

 

If you have display product count enabled and you would like to include the Out of Stock Items in the product count in the Categories Box, delete only "p.products_status = '1' and " under the description heading "Return the number of products in a category" in "includes/functions/general.php". I didn't since I only want it to display the number of In Stock items.

 

IMPORTANT NOTE:

1. These modifications should dislplay all In and Out of Stock products in your Catalog

2. When you view the product it will still display the original Product Info i.e. it does not indicate that it is Out of Stock until you "Add to Cart". To compensate for this I activated "Display Product Quantity" under OSC Admin, which retruns "0" under quantity if something is Out of Stock.

3. I'm not qualified in PHP, so BACK UP YOUR ORIGINAL FILES (This message will self destruct as soon as anybody tries to blame me for screwing up their site)

4. There's probably a better and easier way to do this.

 

Good luck

 

Rudi aka The Green Mamba

Link to comment
Share on other sites

  • 3 weeks later...

Looks good. It is what I need for my site I think. Thanks. :)

Has anyone else tried this? Are there any side-effects?

 

Since I have a very short supply chain most of my products are out of stock (but this is not a concern if my customers :-) .)

Do you think this will still work on conjunction with qtpro contribution?

 

Have you thougth about adding this as a contribution btw?

I think it definitely qualifies as helpful :thumbsup:

Can't think of a signature tight now. But just you wait till I read the next Discworld!

Link to comment
Share on other sites

  • 8 months later...
My site is heavily moded and I was not able to get featured products to work so if you have any suggestions I would apreciate it.

 

thanks

Elizabeth

 

You need to add back the "p.products_status = '1' and" to products_new.php or if you haven't made any modifications to products_new.php, simply replace the one you have with the original file.

Link to comment
Share on other sites

A bit to late I guess but an easy way to keep your out of stock items visible is to comment out one line in catalog/checkout_process.php:

        if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
//          tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
       }

This will of course not work for those products already set inactive but from here on you at least will not have to go through your admin catalog to reactivate inactive products.

I have mainly 1 quantity products and I wanted to keep them visible automatically after they were sold for at least a little while.

Link to comment
Share on other sites

  • 1 year later...

With comment out one line, do you mean delete, or could you just put the value of products_status to 1 ?

I mainly want the products still to show up, untill I updated the stock, but customers won't be able to buy them.

 

Thanks in advance,

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...