Developer forum

Forum » Development » Notifications - Order.AfterSave

Notifications - Order.AfterSave

René Poulsen
René Poulsen
Reply

Hi,

I'm using a Dynamicweb.Notifications.eCommerce.Order.AfterSave subscriber to send out mails with the order to specific persons. I've set up some conditions so that if the stock level is < 10, the mail is sent to one person and if it is >= 10 then it is sent to another person.

The solution I want to use this on, is using the Liveintegration, so my question is: Does the AfterSave subscriber look at the stock level in DW or the stock level in NAV? (I'm hoping for the last one :-))


Replies

 
René Poulsen
René Poulsen
Reply

Bump

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Rene

If you use the order.orderlines(0).Products(0).UnitStock property it goes through the stockelevel provider (and hence the ERP if configured to do that).
If you use order.orderlines(0).Products(0).Stock property, you get the information from the data record of the product.

BR Nicolai

Votes for this answer: 1
 
René Poulsen
René Poulsen
Reply

Hi Nicolai,

Thank you. This seems to work.

Now I've got another problem. In another place in the solution I need to get products (a ProductCollection) for a specific group through the API. Is it possible to get the stock level through the liveintegration when looping through these products? The code below doesn't seem to work. If I go to the product page for this product, it shows the stocklevel fine using @GetString("Ecom:Product.Stock")), but the code below for the same product doesn't show the right stocklevel.

@foreach (Dynamicweb.eCommerce.Products.Product product in pc) {

    <span>Stock: @product.Stock</span>

}

 
Nicolai Pedersen
Reply

Hi René

Try using the UnitStock property instead - that will use the various providers etc. Be aware though, that if you use different stock locations and units, you might need some other code.

Also you can lookup what is currently reserved in the cart using Dynamicweb.Ecommerce.Cart.ProductReserve.GetReservedAmount(product.Id, product.VariantId)

 
René Poulsen
René Poulsen
Reply

Hi Nicolai,

We don't use StockUnits in the integration and I've written a bit with Snedker about this. He said that we should remove the StockUnits part from the bach-integration if we want to let the liveintegration control the stock-level of the products.

 

You must be logged in to post in the forum