Developer forum

Forum » Ecommerce - Standard features » Back in stock notifications and stock locations

Back in stock notifications and stock locations

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a solution where I need to use stock locations.

We have also implemented Back In Stock notifications.

I am wondering how this notification will be handled when using multiple stock locations. Say, I have a default location and a secondary location. Will the notification be triggered if stock value if different than 0 for any of the 2 locations?

Thank you,
Adrian


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Adrian,

Yes, if stock > 0 on the product or in any stock location then it is "back in stock" and a notification will be sent.

Here is the query we use:

Dim query As New CommandBuilder()
query.Add("SELECT n.* FROM EcomNotification n")
query.Add("INNER JOIN EcomProducts p ON p.ProductID = n.NotificationProductID AND p.ProductVariantID = n.NotificationProductVariantID AND p.ProductLanguageID = n.NotificationProductLanguageID")
query.Add("WHERE NotificationContextAreaID = {0} AND NotificationSentTime IS NULL", areaId)
query.Add("  AND ((n.NotificationProductUnitID = '' AND p.ProductStock > 0) OR")
query.Add("    (p.ProductDefaultUnitID > '' AND EXISTS (")
query.Add("       SELECT 1 FROM EcomStockUnit")
query.Add("       WHERE p.ProductID = StockUnitProductID AND p.ProductVariantID = StockUnitVariantID AND StockUnitQuantity > 0 ")
query.Add("         AND (n.NotificationProductUnitID = '' OR StockUnitID = n.NotificationProductUnitID))))")
query.Add("ORDER BY n.NotificationUserID, n.NotificationEmail")

Best regards,
Morten

Votes for this answer: 1
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Morten,

Thank you very much. It sounds very good.

Thank you,
Adrian

 

You must be logged in to post in the forum