Developer forum

Forum » Swift » Stock locations and related products with variants

Stock locations and related products with variants

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I have a site that displays a master product and then displays all variants using the Related Products List service. The site also uses Stock Locations. I set up a stock location on the area. When displaying the variants, it ignores the stock location and instead outputs the stock from the product directly.

Is this a bug or a missing feature?

I tried to work around it by using the StockUnits collection inside the loop in RelatedProductsList.cshtml like so:

@foreach (var product in productList)
{
  @product.StockUnits.Single().StockLevel // I did a Count() and there seems to be only one item.
 
but that outputs the stock level of the master product, not the one of each variant held by thhe product variable.
Any suggestions on how to make this work?
Imar

Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

>> Is this a bug or a missing feature?

Well, it can be both!

Using ProductViewmodel.StockLevel should return the stocklevel based on the stocklocation from context (which can be set by querystring, set on the user or set on the website settings)

Which version are you using? There have been changes... The code looks correct, but there could be something here related to the variant.

Do you have the problem in product detail view as well?

Can have QA look into the issue.

 

 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Nicolai,

We're runing on 9.16.6 with Swift version 1.25.0.

>> Do you have the problem in product detail view as well?

Not sure. We only have the details page for the master and then the variants list below it. When I add a Stock Location item to the product details page, I get a list of stock locations (1) and when I click it I see the correct value from the stock location (but only for the master).

I'll send you a link and login details for QA.

Thanks!

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Imar,

Please, mail me the link(s) and credentials for a backend user has administrator rights (I can't have access by angel).

BR, Oleg QA

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I just sent you an email. Thanks Oleg!

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

mailed with temporary results of the investigation, please find.

BR, Oleg QA

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply
This post has been marked as an answer

Hi,

Nicolai has suggestion to improve the feature on DW9. I've created new task # 19659 to track.

BR, Oleg QA

Votes for this answer: 1

 

You must be logged in to post in the forum