Developer forum

Forum » Ecommerce - Standard features » Notification subscriber does not work...

Notification subscriber does not work...

Peter Gustafsson
Reply
 I have this code in a file in App_Code: 
using Dynamicweb;
using Dynamicweb.Extensibility;
using Dynamicweb.eCommerce;
using Dynamicweb.eCommerce.Products;
using Dynamicweb.Templatev2;

[Subscribe(Dynamicweb.Notifications.eCommerce.ProductList.BeforePaging)]
class NevotexProductListNotificationSubscriber : Dynamicweb.Extensibility.NotificationSubscriber
{
    public override void OnNotify(string notification,    Dynamicweb.Extensibility.NotificationArgs args)
    {
        //TODO: Insert code logic here

        Dynamicweb.Notifications.eCommerce.ProductList.BeforePagingArgs fargs = (Dynamicweb.Notifications.eCommerce.ProductList.BeforePagingArgs)args;
        if (fargs.Products.Count>0) fargs.Products.RemoveAt(0);

    }
}
But it does not work, the same number of products is displayed on each page as before.
Also, when I put a breakpoint inside the OnNotify override in an otherwise setup for debugging solution, it is never hit. (The circle icon of the breakpoint is whole though, it is not hollow as it is when the code it is put on is not loaded.)
What can be problem?

Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Peter

Did you compile this into an assembly and place the dll in the bin folder of your solution?

- Jeppe

 
Pavel Volgarev
Reply
This post has been marked as an answer
Hi Peter,

Your class is not public (doesn't have an access modifier so it's internal by default). Make it public and re-compile.

-- Pavel
Votes for this answer: 0
 
Peter Gustafsson
Reply
Yep, that was the problem! Thanks! 

 

You must be logged in to post in the forum