Developer forum

Forum » Development » GetByIds is internal ProductStockNotificationService

GetByIds is internal ProductStockNotificationService

Anders Ebdrup
Reply

Hi Dynamicweb,


We have encountered a limitation in ProductStockNotificationService that makes it difficult to customize the standard back-in-stock notification behavior.

The method below is currently defined as:

internal virtual IEnumerable<ProductBackInStockNotification> GetByIds(IEnumerable<int> ids)
{
    return Array.Empty<ProductBackInStockNotification>();
}


This method is used from the frontend flow here:


var stockNotifications = Services.ProductStockNotifications.GetByIds(ids).ToList();

The issue is that the method is internal virtual, which means it cannot be overridden from a custom project, even if we replace ProductStockNotificationService through DI and inherit from the class.
In practice, this makes it impossible to customize the lookup logic for notification IDs in an extension-friendly way, because:

  • the method is not accessible outside the Dynamicweb assembly
  • using new does not help, since the call is made through the base type
  • the frontend code will therefore always hit the default implementation

We would like to request that this method be changed to public virtual (or alternatively protected internal virtual if that fits the intended design better).
This would make it possible to provide a custom implementation of ProductStockNotificationService and override the behavior in a supported way, without patching Dynamicweb source code.
Thanks in advance.

 

Best regards, Anders
 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Anders

I made it public: https://doc.dynamicweb.dev/documentation/fundamentals/dw10release/releasenotes/workiteminfo.html?workitemid=27912

BR Nicolai

Votes for this answer: 1
 
Anders Ebdrup
Reply

Great, thank you! Can this be merged to R3 or R2?

 
Anders Ebdrup
Reply

Hi again,

 

Can this fix please be added to some of the former rings?

 

Best regards, Anders

 

You must be logged in to post in the forum