News:

Support the VirtueMart project and become a member

Main Menu

Product ordered with minus values

Started by kratzi, May 03, 2017, 17:25:13 PM

Previous topic - Next topic

kratzi

Hi,

I have seen the following issue for some time already and hoped it would be fixed in VM 3.2.1 and J 3.7. but it can be still reproduced.

When I look into my database I see sometimes that the value product_ordered in db_virtuemart_products has a negative value. I have no idea how this gets there but they are there sometimes.

The problem is the following: If product_in_stock is "0" and product_ordered is f.e "-5" VM will show the product in frontend as available. I guess it is due the calculation: (product_in_stock) - (product_ordered)  -->  0  - (-5) =  +5 so the product has a positive stock value.

This is unfortunately very annoying because you offer products which you will not be able to deliver.

Thank you and regards

kratzi

VM 3.2.1 and J 3.7

jenkinhill

In VM3.2.1 with default VM template trying to add a negative number to order a product does not work and gives an error message -"Please enter a valid quantity for this item."

So you should look at the template overrides you are using.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

kratzi

#2
Thank you but this is not what I meant. I experienced some scenario where you can end up with a negative value for the field "Booked, ordered" under VM Backend > Product > Product Status. If you then have zero products in stock you have a published product in frontend and this should not be as it is not good.

I have seen there were many improovements made for VM 3.2.1 regarding many other features and I think that VM 3 is really getting really good already and many problems were solved. However the above is not yet an satisfying option and I think it should be taken into account. Possibly it should be forced as soon the value for "Product in stock" is 0 or less the product should under no circumstances be displayed in the shop frontend.

Thank you 



jenkinhill

In VM Configuration/Shopfront under "Action when a Product is Out of Stock"  if the option " Do not Display Product" is selected then the product is not showm when stock is zero. Is that not happening for you?
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Jörgen

Hello

@jenkins
Having a negative nr of booked products makes an "out of stock" item visible. Which is actually correct I think.

@kratzi
This is kind of tricky. Getting a negative booking means that You have cancelled or deleted a booked order and there were no booked products.

  • This could happen if You manually add a product to an existing order in the backend.
  • It could also happen if You manually alter number of booked for a product
The logic is actually working correct. Having a negative number for booked product means that You have cancelled a previous over sell or manually altered the number of booked products. Thus You actually have products available. Even though the in stock is correct. Manually adding a product to an existing order in backend can also create this issue.

I hope this sounds clear enough, It is hard to explain in an easy way.

Have You made any of these things or has the number of booked products always been updated through "normal" order handling ?

The answer to the problem here is to figure out how the negative booked value was created.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

kratzi

Hi,

Quote from: jenkinhill on May 03, 2017, 23:24:48 PM
In VM Configuration/Shopfront under "Action when a Product is Out of Stock"  if the option " Do not Display Product" is selected then the product is not showm when stock is zero. Is that not happening for you?

Yes my shop has a setup like this.

@Jörgen
I don't doubt there is a logic behind this functionality and how it works in theory but I would doubt we are the only ones who are facing this problem when using VM for our sales.

I think you are right this happens to us when for products which got oversold and are then calcelled. I imagine this is when we mess up with the "product in stock" and "reserved, booked" fields after we have oversold a product and had to cancel the order.

But imagine how this works in real life. You sold a product which you don't have in stock any more and also can not source in the next days. What do you do first. You set the product to 0 so no one else can buy this product. At this stage you can't cancel the order because you first need to know if the customer might consider receiving another product instead. What do you set to 0? Only the "product in stock" field or also the "booked, reserved" field to get the product off in frontview. If you are also not the only one who has access to this function in backend you can explain the correct way 10 times and still there will be mistakes. In the end you somehow and up with a "product in stock" set to zero and a "booked, reserved" field with a negative value and therefore a product which is in stock which you don't want to sell.

Next case ... we plan to install an inventory management in the next time. Imagine what happens here. The inventory management will send multiple times a day the correct stock and has no clue that VM has for some reason a negative value for "booked, reserved". In case the inventory management sends "0" and the value is negative for "booked reserved" you have a product to buy in frontend.

I already found out that you could set the database attribute to "unsigned" for "product_ordered" which will not allow a negative value for this field and therefore solves my issue. However I still think that my concerns above is not unjustified.

Regards

kratzi :)

Jörgen

Hello Kratzi

Setting booked to Zero manually is probably what has caused the issue. If everything works as expected setting in stock, only! , to zero is going to work. Setting booked to zero will mess things up.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

GJC Web Design

I guess the option is yet another switch/setting in admin to handle the two different scenarios - because as with so many things different functionality will be required by different users
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

Quote from: kratzi on May 04, 2017, 16:46:25 PM
But imagine how this works in real life. You sold a product which you don't have in stock any more and also can not source in the next days. What do you do first. You set the product to 0 so no one else can buy this product. At this stage you can't cancel the order because you first need to know if the customer might consider receiving another product instead. What do you set to 0? Only the "product in stock" field or also the "booked, reserved" field to get the product off in frontview.

When your inventory would be correct, you would have already 0 and the product would not be displayed or at least not for sale (depends on your set option).

The product is "out of stock", when "product in stock" minus "booked products" is below 1. So when you notice that your wares are not enough, and you have for example 5 booked products, then setting "product in stock" to 5 should unlist the product.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Jörgen

Hello

If I might add to the confusion...

If You set in_stock equal to the actual stock then it would be correct. If someone has started to pick booked items then You will have to wait updating  the inventory until all the orders have been marked shipped to get a correct inventory. This is not a unique situation for Virtuemart. This happens to all businesses and is not an easy task to handle. But do not clear booked items manually unless You have a clear Picture of the real number of booked items.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

kratzi

Hi

Quote from: Jörgen on May 04, 2017, 20:57:24 PM
Setting booked to Zero manually is probably what has caused the issue. If everything works as expected setting in stock, only! , to zero is going to work. Setting booked to zero will mess things up.

I thought about this but this will still not work. Because if I set stock to "0" and leave booked to f.e. "2" and then the customer tells me to cancel the order I end up with a visible product again because the ordered 2 will as I see it move to available again because they get unreserved?!

Quote from: Milbo on May 05, 2017, 14:15:45 PM
When your inventory would be correct, you would have already 0 and the product would not be displayed or at least not for sale (depends on your set option).

The product is "out of stock", when "product in stock" minus "booked products" is below 1. So when you notice that your wares are not enough, and you have for example 5 booked products, then setting "product in stock" to 5 should unlist the product.

Well we have over 1000 products online and our inventory will never be 100% accurate I guess no matter system we are going to use. Once a product gets broken during packing you are not immediately logging into VM to correct the numbers and in the end you of course forget about changing the number. Ok we don't have one but imagine a physical shop which also sends online and has 2000 products. How do you get the correct amount for stolen or broken or missing products??

I still think a negative value in booked field which makes the product visible again is not a perfect solution.

Regards

kratzi

Jörgen

Hello Kratzi

This is not correct.

Quote from: kratzi on May 08, 2017, 17:50:16 PM
I thought about this but this will still not work. Because if I set stock to "0" and leave booked to f.e. "2" and then the customer tells me to cancel the order I end up with a visible product again because the ordered 2 will as I see it move to available again because they get unreserved?!

When You have two items booked they have not been taken out of the stock. If You cancel an order that is only booked, the inventory in_stock will not change. If You cancel a delivered order then expects the two items taken out of stock back. If not then You have to decrese the "real" stock inventory with the undelivered return.


  • You have a confirmed order with two booked items. Cancelling this order decreases the number of booked items with two.
  • You have a confirmed AND shipped order with two items. Cancelling this order increases the number of items ín_stock with two. Booked items are already decreased, when it got shipped and will not be changed.

You may create a new sales status called "not returned" or "discarded" that doesn´t increase the inventory and use it for this special order line when You cancel an order line and the items get discarded. Then You can handle order lines that get cancelled but not returned. This order status would be a copy of the status "shipped" but with another name.

I hope this will make things clearer.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

mhuebler

same problem for me. how i can figure out the orders that generate the negative value for 'product_ordered' ?

Jörgen

Hello mhuebler

There are no orders that create negative value for the booked products. You get it when You do this :

  • You go in and manually ZERO the product_ordered value for product X.
  • You CANCEL a booked order that includes product X
  • You SHIP a booked that includes product X
This should not happen with the normal product flow, it happens when You ZERO booked products, maybe this could happen when You import and update products via CSVI. I have not tested with CSVI but could be a good idea to check out.

best regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.