Try our conversational search powered by Generative AI!

Updating Inventory when CatalogEntry is set to 'Ready To Publish.

Vote:
 

Hi,

We are currently investigating an issue with the state 'Ready To Publish' upon a catalog entry item.

We have an api that updates the inventory for the catalog entry however it appears to not be doing this when the item is set to 'Ready to Publish'.

Does anyone know if that behaviour is correct?

Thanks

#288408
Sep 30, 2022 12:03
Vote:
 

Hi Paul,

I don't believe that is standard behaviour. Try inspecting the [InventoryService] table. Maybe you're not providing one of the mandatory fields?

#288460
Oct 01, 2022 20:42
Paul McGann (Netcel) - Oct 03, 2022 8:06
Thanks I will take a look and see.
Vote:
 

inventory system is fairly independent from the catalog, it only needs the entry with the code exists. what error message are you seeing? 

#288495
Oct 02, 2022 10:20
Paul McGann (Netcel) - Oct 03, 2022 8:16
We don't have an error message related. This is visually we can see we are sending the data however, we then see the data is not updating.
Vote:
 

@Paul - how do you send the data and how do you check to see if it's updated ? sounds like a cache somewhere

does it work if you update inventories for published content?

#288542
Oct 03, 2022 10:21
Paul McGann (Netcel) - Oct 03, 2022 10:51
Hi Quan,

Hopefully I can explain this so it makes sense, please note stock is coming from a third part erp system.

1. We have an API endpoint /api/InventoryUpdate, to this api we send a list of type 'EPiServer.ServiceApi.Commerce.Models.Catalog.WarehouseInventory'.
2. We then use the 'IInventoryService' to retrieve the 'Mediachase.Commerce.InventoryService.InventoryRecord'.
3. We then create a writeable clone of the inventory record and update the stock level.
4. Finally we call the IInventoryService.Update method.

To check the stock is updated we do this manually in the system. Generally this is our client that will do this as they are adding products and stock and will raise issues with us when they don't go to plan.

If the state is set to draft or published it is working correctly, just anything in between.

I don't think this is a cache issue as this has been happening the past week and the cache should have been updated.

Thanks

Paul
Paul McGann (Netcel) - Oct 03, 2022 10:54
Just as a thought, is it possible to use the 'ICatalogSystem' to update the inventory levels?
Quan Mai - Oct 03, 2022 10:55
So I assume by checking you go to Catalog UI and check the Inventory tab? Is it possible to show code that update the inventories? I'm sure they are fine, just want to make sure no stone left untuned
Quan Mai - Oct 03, 2022 10:58
No, ICatalogSystem can't even handle the inventories. the inventories were separated long, long ago
Vote:
 

if (!_catalogRepository.EntryExists(warehouseInventory.CatalogEntryCode))

this catches my eyes. can you check if this does not check for publish status?

Unless you are sure that each run will only update inventories of each sku in one warehouse, you can speed up quite a lot by updating all inventories of same sku in one go

#288551
Oct 03, 2022 11:31
Paul McGann (Netcel) - Oct 03, 2022 11:51
That code is just a wrapper around the 'ReferenceConverter.GetContentLink' method which I believe does not do any checks on publish status.
Paul McGann (Netcel) - Oct 03, 2022 11:51
That code is just a wrapper around the 'ReferenceConverter.GetContentLink' method which I believe does not do any checks on publish status.
Quan Mai - Oct 03, 2022 11:52
Can you check if the data is updated in the database or not?
Vote:
 

Something is wrong somewhere else. if you are using the Catalog UI to update inventory in a Ready to Publish content, does it persist? because your code is essentially what Catalog UI does under the hood 

#288560
Oct 03, 2022 12:51
Vote:
 

Something is wrong somewhere else. if you are using the Catalog UI to update inventory in a Ready to Publish content, does it persist? because your code is essentially what Catalog UI does under the hood 

#288561
Oct 03, 2022 12:51
Paul McGann (Netcel) - Oct 03, 2022 13:02
I am going to do some more investigation into this.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.