Filter Products by AND instead of OR - Ecommerce - Ecommerce - Progress Community

Filter Products by AND instead of OR

 Ecommerce

Filter Products by AND instead of OR

  • Filter Products by AND instead of OR
  • I'd like to display products that have both TAG1 and TAG2.  It seems like if I select TAG1 and TAG2, I get all products that have TAG1 and all products that have TAG2 .  ( want only products that have BOTH)

    Is there a way to change the behavior to "narrow" the list?  It's not a pure hierarchy, so I need to use tags (not categories)

    Any suggestions ?

    thanks
    Tim
  • Hello Tim,

    Currently there is no setting to change the behavior of the FilterProducts widget in this way. I have submitted a feature request in PITS which you can vote for here.

    Kind regards,
    Randy Hodge
    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
  • Can you provide any direction (or example!)  in how I might implement it myself ?

    thanks much
    -Tim
  • 44fc7b2b-e413-48f0-b7df-d042a5269d96_TagFilterUrlEvaluator.zip
    Hello Tim,

    You could create your own TagFilterUrlEvaluator and TagFilterDynamicQueryBuilder classes and modify them to your needs. I have attached the default classes for you to get started.

    Then in the DataConfig.config file, modify the highlighted text in this line:
    <add description="TagFilterEvaluatorDescription" resourceClassId="CatalogResources" type="Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UrlEvaluators.TagFilterUrlEvaluator" enabled="True" name="TagFilter" />
    to your new class.

    This has never been tested so please let us know how it turns out.

    All the best,
    Randy Hodge
    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
  • Thanks much!  I'll give it a whirl !
  • Hi Randy, I'm trying to create my own filter per your instructions and having some trouble....
    -----SNIP---- 
    namespace Telerik.Sitefinity.Modules.Ecommerce.Catalog.Implementations.ShopByFilter.QueryBuilders

        internal class CustomTagFilterDynamicQueryBuilder : IShopByFilterQueryBuilder
       
    ENDSNIP-------
    Error 3 'Telerik.Sitefinity.Modules.Ecommerce.Catalog.Interfaces.ShopByFilter.QueryBuilder.IShopByFilterQueryBuilder' is inaccessible due to its protection level 

    Does that mean I need the IShopByFilterQueryBuilder class as well?

    -Thanks
    tim
  • Hello Tim,

    IShopByFilterQueryBuilder is an interface, not a class. You should be able to not use it. I don't see any place where the TagFilterDynamicQueryBuilder class is being instantiated as IShopByFilterQueryBuilder.

    So try not implementing the IShopByFilterQueryBuilder interface in your custom class.

    I hope that helps.

    All the best,
    Randy Hodge
    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
  • Hi Randy,
    is it possible to have default 'OR' behavior for most of Classificaitons except some where I need 'AND'?

    For example I have classificaiton "Device type" with values: Phone, Sim card, Internet device...
    and classification "Features" with values: Wi-fi, HD Screen, Front camera, HD Video....

    I need to filter with 'OR' by Device type
    and filter with 'AND' by Features

    Is it possible? How can I do it? From your answer it looks like all filters will be replaced?

    Thanks,
    Alex
    software developer
  • Hi Alex,

     For a complex solution such as this is may be better to create your own widget(s). The implementation at this point is a little black and white.  You can have one but not both at the same time down to specific tag types or situations.

    Regards,
    Patrick Dunn
    Telerik
    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
  • Alex said:Hi Randy,
    is it possible to have default 'OR' behavior for most of Classificaitons except some where I need 'AND'?

    For example I have classificaiton "Device type" with values: Phone, Sim card, Internet device...
    and classification "Features" with values: Wi-fi, HD Screen, Front camera, HD Video....

    I need to filter with 'OR' by Device type
    and filter with 'AND' by Features

    Is it possible? How can I do it? From your answer it looks like all filters will be replaced?

    Thanks,
    Alex
    software developer

    Hi Alex,

    Have you managed to find the solution? I have a similar problem and I would be happy if you share your experience.

    Thanks