+1-888-365-2779
Try Now
More in this section

Forums / Ecommerce / Custom Filtering of Product List

Custom Filtering of Product List

6 posts, 0 answered
  1. Tim
    Tim  avatar
    34 posts
    Registered:
    16 Oct 2012
    04 Apr 2013
    Link to this post
    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
  2. Patrick Dunn
    Patrick Dunn avatar
    237 posts
    Registered:
    03 Nov 2014
    05 Apr 2013
    Link to this post
    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
  3. Tim
    Tim  avatar
    34 posts
    Registered:
    16 Oct 2012
    06 Apr 2013 in reply to Patrick Dunn
    Link to this post
    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  
  4. Chad
    Chad avatar
    3 posts
    Registered:
    19 Mar 2013
    10 Apr 2013
    Link to this post
    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
  5. Patrick Dunn
    Patrick Dunn avatar
    237 posts
    Registered:
    03 Nov 2014
    10 Apr 2013
    Link to this post
    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
  6. John
    John avatar
    0 posts
    Registered:
    10 Sep 2013
    31 Aug
    Link to this post

    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);
            }
        }
    }

     

6 posts, 0 answered