Jump to content
Sign in to follow this  
jimmyanoyo

QTY of a product

Recommended Posts

Hi.

 

This is what I am looking for. I need the qty of a product to decrease when its ordered, but when the qty reach to zero, I want the qty to stay at zero and stay in stock while letting customers to place order. The qty at 0 will stay and no more subtraction will be made, if someone place an out of stock order for the item.

 

Any contributions?

Share this post


Link to post
Share on other sites

Please modify the following lines in checkout_process.php

 

// do not decrement quantities if products_attributes_filename exists

     if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {

       $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];

     } else {

       $stock_left = $stock_values['products_quantity'];

     }

     tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

     if ($stock_left < 1) {

       tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

     }

 

 

Mark the line as follows:

 

      if ($stock_left < 1) {

       # tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

     }

 

I hope it is helpful! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×