Developer forum

Forum » Development » Subscriber class never invoked

Subscriber class never invoked

Jon Lennryd
Reply
Hi! I tried to create a subscriber-class as below, but the function ExtendTemplate() is never called.
When is it supposed to be called? I assumed it is called each time a product list is generated when a user want to show it. (I created a page, added a paragraph, added the module 'Product Catalog (eCom)'.)
The listing show up alright, except my code is never called.

    [Dynamicweb.Extensibility.Subscribe(eCommerce.ProductList.BeforeSort)]
    class ProductListingModifier : ProductListTemplateExtender
    {
        public override void ExtendTemplate(Dynamicweb.Templatev2.Template template)
        {
            // Tag is not defined upon page load!
            template.SetTag("HMAM", "Rules");
        }
    }

Thank's for any help!




Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer
Hi there,

Take a look at this:

class ProductListingModifier : ProductListTemplateExtender

Your class doesn't have an access modifier, and thus it's internal which means Dynamicweb is not able to create an instance of it. Add public in front of the class keyword and it should work.

Cheers,

Imar
Votes for this answer: 0
 
Jon Lennryd
Reply
;) Sometimes the answer is right in front of you, and you simply don't see it.

 

You must be logged in to post in the forum