Custom Filtering of Product List - Ecommerce - Ecommerce - Progress Community

Custom Filtering of Product List

 Ecommerce

Custom Filtering of Product List

  • Custom Filtering of Product List
  • If I want to provide custom filtering to the product list, should I be making my own custom filter or do I really need to make my own ProductList widget with the filter built in ?

    Suggestions ?  I've googled the world over, and can't find an example of custom-filtered-product list...  I'd hate to think that I'm the first to try :)

    thanks,
    Tim
  • Hi Tim,

     Thank you for contacting us.

    You're by far the first from doing so but this is why Sitefinity 6.0 will include a customizable sort/filter option for products that includes even custom fields. It's already finished and ready for 6.0 which is due out within the next couple weeks. We would definitely suggest waiting and upgrading to 6.0 as it provides a load of new features related not only to Ecommerce but Sitefinity as a whole.

    With that being said you don't have to create your own product list from scratch hardly ever. Our widgets are ASP.NET custom controls so you can create a class and inherit from the ProductList and then override the necessary methods/provide your own methods.

    Something like this:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI;
    using Telerik.Sitefinity.Model;
      
    namespace SitefinityWebApp.Custom
        public class CustomProductList : ProductsView
        
            public string overrideSortOrder get; set;
            protected override void LoadView(string viewName)
            
                if (!overrideSortOrder.IsNullOrEmpty())
                
                    if (base.ControlDefinition.Views.IsMasterView(base.CurrentView.ViewName))
                    
                        //find custom sort control -> find listview -> set sort expression
                    
      
      
                
                base.LoadView(viewName);
            
      
        

    I hope this helps but I would definitely wait and upgrade to 6.0! All the best,
    Patrick Dunn
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Thank you Partrick.

    6.0 sounds exciting.  Not sure if I can wait, but will try to only do critical changes hoping 6.0 gets here before my customer needs the function.

    Just to clarify, I need to filter (not sort).  Can you point me to any examples that have just a bit more detail  ?

    Thanks much!
    -Tim  
  • Patrick,
    I appreciate the code you posted here and I'm attempting to follow this example and I think I'm on the right track but how do I "register" this control extension?  I've made modifications to the control by extending the base class but my changes do not show up when I use the Products View control. How do I tell the control to use my extended class?

    I've been fooling around with the attributes of the product list by bringing up the popup view by clicking "edit" on the control. I go into advanced settings and see a ton of attributes. I assume I need to edit one of these to point to my extended class correct? Which one do I edit?

    Thanks,
    Chad
  • Hi,

     The extended class is its own control. You need to register it as you would any custom control. The easiest way to do this is with Thunder.

    I hope this helps.

    Regards,
    Patrick Dunn
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • I tried a variation on this example as I need to customise the result oft he Product View but when I add the control to the page I get the following error message (on the control):  Value cannot be null.
    Parameter name: originalControl

    This does make sense, I guess at the LoadView method is expecting a parameter but where is that coming from?

    My code is:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI;
    using Telerik.Sitefinity.Model;

    namespace SitefinityWebApp.CustomClasses

        public class ProductListCustom : ProductsView
       
            protected override void LoadView (string viewName)
           
                if (base.ControlDefinition.Views.IsMasterView(base.CurrentView.ViewName))
               
                    // some customisation here
               

                base.LoadView(viewName);