Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error with stock quantity if a edit an order!


danicasati

Recommended Posts

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?

Link to comment
Share on other sites

  • 3 weeks later...

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?

GlenBA

Link to comment
Share on other sites

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

GlenBA

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...