Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

QTY of a product


Guest

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?

Link to comment
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! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...