Developer forum

Forum » Development » getting module settings

getting module settings


Reply
How can I get the module settings in a ProductListTemplateExtender?
The valuee that I'm most interested in is the "Products Per Page" and the "Product Groups" in the "Product Cataloge" Module.

Replies

 
Reply
 Hello Paul,

Try this

public class ProductListTemplateExtender1 : ProductListTemplateExtender
    {
        public override void ExtendTemplate(Dynamicweb.Templatev2.Template template)
        {
            string ecomModuleSystemName = "ecom_Catalog";
            Dynamicweb.Frontend.PageView pv = Dynamicweb.Frontend.PageView.Current();
            Dynamicweb.Properties properties = Dynamicweb.Base.GetParagraphModuleSettings(pv.ID, ecomModuleSystemName);
 
            string productsPerPage = properties["PageSize"];
            string productsGroups = properties["Groups"];
        }
    }
 
Reply
Please, note 
Dynamicweb.Base.GetParagraphModuleSettings(pv.ID, ecomModuleSystemName)

takes first ProductCatalog paragraph on the page. If you have several ProductCatalog paragraphs, you need to search required paragrahs firts and than take its settings.

 

You must be logged in to post in the forum