Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Inventory Not Subtracting


jennymac

Recommended Posts

Posted

I have an inventory problem that is a MAJOR issue. I checked where it says to subtract from inventory in admin, but it obviously isn't working. I don't use product attributes, just basic math as I explained previously in another thread (that somehow was moved to the QTpro (?) thread.

 

 

Basically, I have 10 products, sell 7 and it still says 10. I did check in admin where it asks to remove inventory when sold. I'm totally stumped and now I have to do everything manually. Huge pain! And, since, I have to do that, I can't learn anything here as I would like to. Rats!

 

As usual, help would be most appreciated! Thanks so much, Jennifer aka Clueless in Caliornia

Posted

Just a guess but the part that updates your stock is in catalog/checkout_process.php

 

You may have a problem there somewhere where it is not updating your stock after an order.

Compare your checkout_process.php to an original oscommerce checkout_process.php

 

 

if there are any errors in code etc they would most likely be in the area of this code below:

 

 

// Will work with only one option for downloadable products

// otherwise, we have to build the query dynamically with a loop

$products_attributes = $order->products[$i]['attributes'];

if (is_array($products_attributes)) {

$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";

}

$stock_query = tep_db_query($stock_query_raw);

} else {

$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

}

if (tep_db_num_rows($stock_query) > 0) {

$stock_values = tep_db_fetch_array($stock_query);

// 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) && (STOCK_ALLOW_CHECKOUT == 'false') ) {

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

}

}

}

Posted

Wow - mine's not even close! I didn't build this site (obviously) and I don't have access to the person who did anymore. And I don't have another one to compare it with. Would you terribly mind posting the proper info? All I have in that file is:

 

<?php

/*

$Id: checkout_process.php,v 1.26 2002/11/01 04:22:05 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

define('EMAIL_TEXT_SUBJECT', 'Order Process');

define('EMAIL_TEXT_ORDER_NUMBER', 'Order Number:');

define('EMAIL_TEXT_INVOICE_URL', 'Detailed Invoice:');

define('EMAIL_TEXT_DATE_ORDERED', 'Date Ordered:');

define('EMAIL_TEXT_PRODUCTS', 'Products');

define('EMAIL_TEXT_SUBTOTAL', 'Sub-Total:');

define('EMAIL_TEXT_TAX', 'Tax: ');

define('EMAIL_TEXT_SHIPPING', 'Shipping: ');

define('EMAIL_TEXT_TOTAL', 'Total: ');

define('EMAIL_TEXT_DELIVERY_ADDRESS', 'Delivery Address');

define('EMAIL_TEXT_BILLING_ADDRESS', 'Billing Address');

define('EMAIL_TEXT_PAYMENT_METHOD', 'Payment Method');

 

define('EMAIL_SEPARATOR', '------------------------------------------------------');

define('TEXT_EMAIL_VIA', 'via');

?>

 

Yikes - this is NOT good...thanks so much, Jennifer

Posted

As an added note, people are allowed to checkout; it's just the inventory problem. Big problem!

Posted

jennymac,

 

that is the wrong file you are looking at.

the file you show is a language file in catalog/includes/languages/english/checkout_process.php

 

You need to open:

catalog/checkout_process.php and compare it to an original oscommerce release download that will have a clean unaltered checkout_process.php file in it

Posted

Oh, no, I don't even HAVE that file - no wonder. And I don't have an orignal oscommerce release. What should I do?? No wonder it doesn't work. And to think I paid that guy to set it up for me?!? How are people checking out? I need some coffee badly....I can see a LONG night ahead! Jennifer

Archived

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

×
×
  • Create New...