We've upgraded to 10.1.1 and discovered that the InStockQuantity property always returns 0.
Other properties regarding stock status seems also to return 0.
Anyone know why?
We've built a temporary way around it for now.
Are you using the concrete classes (OrderForm, LineItem, etc), or the new abstraction (IOrderForm, ILineItem etc)?
Do you use the workflows?
We extract the LineItems through the CartHelper so we're using the concrete classes. We use the information to structure the content on the page where we display the current content depending which type of items contained therein.
The way we alleviated the problem for now was building an extension which extracts the code from the lineitem and finds the variation to get to know current in stock value.
If you are using the workflows, then that value should be set in OrderGroupActivityBase.PopulateInventoryInfo. Can you check if the values are correctly set there?
We're running the CartValidate-workflow. Could it be that it is till running the old workflow instead of VNext?
That's strange. That function should be run if you are using the "old" workflow. As I said you can download the Workflow project, include it in your solution, build it and debug to see if it is actually called.
Where do I find the workflow project for download?
I noticed that the WarehouseCode is empty in our case which results in empty result when running [ecf_Inventory_GetInventory]. Could that be the culprit?
You should be able to use this:
We will put the new one for Commerce 10 soon.
The problem was with WarehouseCode. We were not using it explicitly and in version 9 and previous it seems to have handled empty warehousecodes by setting them to "Default". But in version 10 that seems to be removed. This caused problems with the inventory-numbers but affected also other things dependant on the WarehouseCode.
The LineItem.WarehouseCode property is now obsoleted - the order system will only work with Shipment.WarehouseCode. However other parts of system were also updated, so it should work just fine - the check for inventories should take the Shipment.WarehouseCode and check it against LineItems in that Shipment. Do you have custom code which does otherwise?
We had to add entries to the cart with this method in CartHelper:
public virtual LineItem AddEntry(Entry entry, Decimal quantity, bool fixedQuantity, string warehouseCode, params CartHelper helpersToRemove)
Earlier we used this:
public virtual LineItem AddEntry(Entry entry, Decimal quantity, bool fixedQuantity, params CartHelper helpersToRemove)
This solved our problem and quantity is evaluated in a correct way.
@Tobias, you have upgraded to 10, but still use legacy Cart and LineItem objects?