Guest Posted August 27, 2003 Posted August 27, 2003 I have a problem. Most of my stock is out of stock all the time (at the moment) but I want customers to be able to order it anyway. I know you can turn off "subtract stock" in the admin but I want to be able to subtract from the goods that I do have in stock. But when I make a test order of something that isn't in stock that item then disables itself and cannot be ordered again. So is there something I can do to allow negative values of stock and not have them disappear when they are ordered, but just keep on getting more and more negative ie -1 -2 -3 etc. Or even just stay at zero but not disappear? I did try installing a contib whch was supposed to sort this out but it worked intermittently and I am going live next week so I need something that works all the time. Any help appreciated.
Guest Posted August 27, 2003 Posted August 27, 2003 admin :arrow: Configuration :arrow: Stock :arrow: Allow checkout Or did you try that and it isn't working for you? Hth, Matt
Guest Posted August 27, 2003 Posted August 27, 2003 Allow checkout, subtract stock and check stock levels are all set to true. I know I can change subtract stock to false but I only want to do that as a temporary measure if I don't get this sorted before I go live. Once I start getting in more stock, I need to be able to have it subtract the stock. But also not disable the item when it's out of stock. At the moment all of my out of stock stock quantities are set to 0 when I enter the product. So the system displays it, says it is out of stock and can be ordered, which is fine. But then when I place a test order for any out of stock item, the system then disables the product and it can't be seen. I need it to stay on, even though it is out of stock.
radders Posted August 30, 2003 Posted August 30, 2003 I'm looking for the same thing. Did you ever solve this one?
radders Posted August 30, 2003 Posted August 30, 2003 OK I found the answer here: http://www.oscommerce.com/forums/viewtopic.php...+stock&start=10 surprising the number of people how asked about this without getting this answer. :o Actually though this appears to be the default behaviour with QTPro installed so I don't have to bother with this mod :D
Guest Posted August 30, 2003 Posted August 30, 2003 ^Well I have responded to that thread although it isn't exactly the problem I have, as I still want customers to be able to add the product to their cart. Still, we shall see what happens.
radders Posted August 30, 2003 Posted August 30, 2003 Just comment out this bit of code: if ($stock_left < 1) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } in checkout_process.php, and Bob's your uncle
Guest Posted August 30, 2003 Posted August 30, 2003 Ah - that's what I figured but I thought I would check to make sure. Thanks.
radders Posted August 30, 2003 Posted August 30, 2003 You probably need settings like these too but I expect you already have such settings and that everything is hunkydory apart from the items disappearing when stock reaches zero. Check stock level: true Subtract stock: true Allow Checkout: true
Guest Posted August 30, 2003 Posted August 30, 2003 Yep - all true. I am bathing my daughter right now so I am hopping in between the bathroom and the computer but when she has gone to bed I will do it and make sure everything works fine.
Guest Posted August 30, 2003 Posted August 30, 2003 Hmm - tried it and I am getting parse errors. It looked like this // 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']) . "'"); } } } I changed it to look like this: // 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']) . "'"); } } } and got parse errors. What did I do wrong? I only added the // at the begining of the line. If I change it to if ($stock_left < 0) would that work?
radders Posted August 30, 2003 Posted August 30, 2003 My php editor seems quite happy with that. Try uploading it again. Sometimes if the file hasn't fully tranferred across you can get a parse error. It is like a syntax error so changing the values will not help. Alternatively if that doesn't work you could try changing it to this: // if ($stock_left < 1) // { // tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); // } Bear in mind that php attaches no significance to the new line
Guest Posted August 30, 2003 Posted August 30, 2003 Well, commenting out every line has worked! I don't know why it didn't do it before. I edit my files in situ using C Panel, rather then downloading and uploading them, so it should have worked first time. Anyway, it's working now, thank goodness. Now I have only one tiny little bug to iron out before I am totally ready to go live on Monday. Thanks for your help - again! :D
Recommended Posts
Archived
This topic is now archived and is closed to further replies.