Developer forum

Forum » Ecommerce - Standard features » Stock value not rendered correctly when using Stock Locations

Stock value not rendered correctly when using Stock Locations

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a situation with a project and I am not sure if it's how the functionality is supposed to work, a configuration issue, or a bug.

I have a solution running on DW 9.9.8 where I have defined a few stock locations and the values in these stock locations are synched with an integration job.

I also have a specific value for ProductStock that is also synched during a batch integration job.

The problem is the value that is rendered in the Ecom:Product.Stock tag. No matter what I put in the stock locations or the ProductStock field, the value rendered is not a match for any of them.:

 

 

The expected behavior would be to get either 12 (ProductStock) or 13 (sum of all stock locations) on the Ecom:Product.Stock tag but instead I get 0. Which is probably the value from the first Stock location.

I have not set a default Stock location, specifically to avoid having the availability controlled by a single location.

Is this behavior by design? Is this a configuration issue?

Thank you,

Adrian

 


Replies

 
Nicolai Pedersen
Reply

As soon as you add units to a product, the rendering will skip the stock available on the product it self as it cannot be used. It will then take the first stock level from the stock table that matches the unit and location.

If you specify a default stock location on the website settings, that will be used to find the stock level for that location and unit. If no location is specified, it will use the first matching unit regardless of the location. 

This is by design.

There is no built in option to get the sum of stocks from all locations.

You can use the StockUnit loop to get all values out and display a sum. Only do that on a product detail page.

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Thank you for the clarification.

At least I know I have not done anything wrong in the setup :)

Is there any way I can get the stock stored on the product using the API? Something similar to DBPrice?

I know the StockLocations loop is very expensive on the product list page and unfortunately, I need the information in the list.

Thank you,

Adrian

 

You must be logged in to post in the forum