Developer forum

Forum » Integration » Syncing stock units & quantities from Omni

Syncing stock units & quantities from Omni

Arnór Halldórsson
Arnór Halldórsson
Reply

Hello friends,

We're working on syncing stock units with their respective quantities and unit sizes through the LS Omni integration and are curious as to how best to store the unit sizes of each stock unit. I didn't find any documentation regarding this specificly so I'm badgering you on the forum :D

The EcomStockUnit table only accounts for the stock quantity of the unit so I'm wondering if we should be using the StockUnitDetailQuantity field on the EcomStockUnitDetail table to record the unit size? Or is it maybe simpler to just hijack the StockUnitWeight / StockUnitVolume fields on the EcomStockUnit table for this and do a little code shenanigans to make it work properly when creating and sending the order objects to Omni?

Best regards,
Arnór


Replies

 
Nicolai Pedersen
Reply

Hi Anor

You setup the units in "Product units" in settings. Each unit will have a unitid. So you can have the same product in i.e. pieces and boxes.

Then you just add the stock quanitity for each unit type for each product/variant combination to the EcomStockUnit table.

If you by size mean width, height and depth of a given unit, it goes into the EcomStockUnit table. Those fields are relatively new.

EcomStockUnitDetail is not for any (good) use. It is related to "boxes" - a loop in the product renderer. Lets say you have "box" or assortment prepacked of other units, this can be used. I.e. a Box with "1 tshirt yellow small", "2 tshirt yellow medium", "3 tshirt blue small" etc. Then that information can be used in the EcomStockUnitDetail table.

If you by sizes mean that 1 "box" is 6 "bottles" of i.e. a wine, we currently do not support any logic related to that.

BR Nicolai 

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Hello dear,

Ahh bummer, by size I was exactly talking about that latest case you mentioned :/ That is, a product can be sold in either single units or boxes containing n single units.

Stock quantities aren't really an issue, they get synced from BC and seem to register correctly :)

So I guess my best option is to add a new field to the EcomStockUnit table or hijack an existing field, and write the necessary logic into the integration framework...

Are there any plans for adding support for this? And if not, will you consider adding it if I manage to solve this in a manner that is not dreadfully shameful?

Best regards,
Nóri

 

 

 
Nicolai Pedersen
Reply

Hello dear wink

We do not have that feature in the plan. But we hear it a lot these days, so we might look into it coming up.

There are 2 things related to this.

The simple things is to add the relation and calculations between 2 different units - that units of type box is 6 amounts of type bottles. And then being able to show how many boxes are in stock if there is 100 bottles.

But then keeping track of the stock levels after purchase. What happens if we have 2 boxes and 2 bottles in stock and 3 bottles are sold. We need to be able to handle that.

BR Nicolai

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Well it would be neat and cool to have this built into DW someday :)

And you're right, the stock management will always be likely to cause headaches no matter how you spin this :) You would have to re-calculate the stock value for the other stock units after each sale.

As you said, the simple thing is to add the relation and calculation between the units, f.e. by adding StockUnitParentUnitId, StockUnitUnitSize, and StockUnitName (instead of using the VariantOptions table) fields to the EcomStockUnit table:

StockUnitProductId StockUnitId StockUnitName StockUnitQuantity StockUnitParentUnitId StockUnitUnitSize
ProductA SU1 Piece 492   1
ProductA SU2 Box 4 SU1 100
ProductA SU3 Pallet 0 SU1 1000

Then inside SetOrderComplete / CheckoutDone or wherever you do the stock calculations after orders are completed today, you'd have to trigger recalculations of all stock values for all stock units for that product with a StockUnitParentUnitId on them, based on the StockUnitUnitSize value. So if someone bought 93 single units of ProductA, the table rows would look something like this afterwards:

StockUnitProductId StockUnitId StockUnitName StockUnitQuantity StockUnitParentUnitId StockUnitUnitSize
ProductA SU1 Piece 399   1
ProductA SU2 Box 3 SU1 100
ProductA SU3 Pallet 0 SU1 1000
 

This is at least how I would approach the issue without having spent any time yet on researching how DW manages the stock under the hood, maybe after that I'll realise that I'm an idiot, shut up and leave you alone :)

In the case of me being Simple Jack, I could probably just skimp on the stock calculations since I'm always working with ERP integrated webshops. All Stock is synced / fetched from the ERP systems on the fly and no orders are allowed to be finished unless the LiveIntegration is running. I'd just need to add the fields so that I could show the units in the frontend, then convert them to single units during checkout and have the ERP do the rest. But that wouldn't be much of a solution for anyone else now would it :)

BR,
Nóri

 
Jens Erik Aavild
Jens Erik Aavild
Reply

Hello Arnór, 

Thank you for the suggestion and inspiration. What do you think, if we did like this? 

At the product level, we add an extra dimension called: Units

Where you can add multiple units of measures for the product.

The system creates the first unit of measure with the qty. of 1 as the default base unit. 

You can create a new unit of measure by selecting between the Product Units configured in Settings/Product Catalog


The units account for all product variants and stock locations for the specific product. 

The stock matrix is at the base unit only, and the system subtracts 6 pieces if a box of 6 wine bottles is sold, etc. 
 

BR.

Jens 

 

 
Arnór Halldórsson
Arnór Halldórsson
Reply

You are very welcome Jens :)

This is awesome! You guys are awesome!

Best regards,
Nóri

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Hi friends,

Any updates on when this feature will be made available? :)

Best regards,
Arnór

 
Jens Erik Aavild
Jens Erik Aavild
Reply

Hi Arnór, 

All things considered... It should be done next week.

Unless something unforeseen happens in the test and review next week, it will be shipped with the next 9.10 release. 

BR

Jens 

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Awesome!

Thank you :)

Br,

Arnór

 

You must be logged in to post in the forum