danicasati Posted December 30, 2005 Share Posted December 30, 2005 Hello. In my webshop, I disabled the stock control. So, if users buy products, stock values are not changing. I put 0 if I haven't units, and 1 if I have got. But, If I edit an order with your contribution (ORDER EDITOR 1.61c), products quantity changes stock quantity. I need to disable this feature! Which lines I need to change in order to do this? Quote Link to comment Share on other sites More sharing options...
GlenBA Posted January 17, 2006 Share Posted January 17, 2006 I've been working on an similar problem, but with Bundled Products not doing stock correctly. Your problem is catalog/admin/edit_orders.php is not checking STOCK_LIMITED. From what I can see just put this if statement if (STOCK_LIMITED == 'true') { <code> } around 2 blocks of code, like this: Lines 281-285 if (STOCK_LIMITED == 'true') { 281 $order = tep_db_fetch_array($order_query); 282 if ($products_details["qty"] != $order['products_quantity']) { 283 $quantity_difference = ($products_details["qty"] - $order['products_quantity']); 284 tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " where products_id = '" . (int)$order['products_id'] . "'"); 285 } } Lines 327-330 if (STOCK_LIMITED == 'true') { 327 if ($products_details["qty"] != $order['products_quantity']){ 328 $quantity_difference = ($products_details["qty"] - $order['products_quantity']); 329 tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " where products_id = '" . (int)$order['products_id'] . "'"); 330 } } I'm pretty sure this will fix it, but as usual, backup your database, backup your code, and backup your backup, and use this at your own risk. GlenBA Hello.In my webshop, I disabled the stock control. So, if users buy products, stock values are not changing. I put 0 if I haven't units, and 1 if I have got. But, If I edit an order with your contribution (ORDER EDITOR 1.61c), products quantity changes stock quantity. I need to disable this feature! Which lines I need to change in order to do this? Quote GlenBA Link to comment Share on other sites More sharing options...
GlenBA Posted January 17, 2006 Share Posted January 17, 2006 Missed one. Look for tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $add_product_quantity . ", products_ordered = products_ordered + " . $add_product_quantity . " where products_id = '" . $add_product_products_id . "'"); and put the if statement around it. I've been working on an similar problem, but with Bundled Products not doing stock correctly. Your problem is catalog/admin/edit_orders.php is not checking STOCK_LIMITED. From what I can see just put this if statement if (STOCK_LIMITED == 'true') { <code> } around 2 blocks of code, like this: Lines 281-285 if (STOCK_LIMITED == 'true') { 281 $order = tep_db_fetch_array($order_query); 282 if ($products_details["qty"] != $order['products_quantity']) { 283 $quantity_difference = ($products_details["qty"] - $order['products_quantity']); 284 tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " where products_id = '" . (int)$order['products_id'] . "'"); 285 } } Lines 327-330 if (STOCK_LIMITED == 'true') { 327 if ($products_details["qty"] != $order['products_quantity']){ 328 $quantity_difference = ($products_details["qty"] - $order['products_quantity']); 329 tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " where products_id = '" . (int)$order['products_id'] . "'"); 330 } } I'm pretty sure this will fix it, but as usual, backup your database, backup your code, and backup your backup, and use this at your own risk. GlenBA Quote GlenBA Link to comment Share on other sites More sharing options...
danicasati Posted January 18, 2006 Author Share Posted January 18, 2006 Hello. Thank you very much for your answer, but your code doesn't work. I've added the IF statement following your instructions, but osCommerce add or remove quantity if I modify the order with ORDER EDITOR. Any suggestion? Quote Link to comment Share on other sites More sharing options...
danicasati Posted January 18, 2006 Author Share Posted January 18, 2006 Ok, problem solved. I've missed a line... :blush: Thank you for your support. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.