Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Product Filters, creating a price range filter View modes: 
User avatar
Member
Member
thanos.panousis-indice - 2/10/2013 4:40:44 AM
   
Product Filters, creating a price range filter
I have successfully created a dummy price filter. This filter is a dropdown that appends a where condition on the datasource, based on predefined price ranges.

The issue is that price ranges must be dynamic and calculated based on the min and max price of the datasource being filtered. The filter I am trying to create should work like so, for products starting from 40$ to 300$.
0 - 100 (10 items)
101 - 200 (4 items)
201 - 300 (2 items)
and so on.

The conceptual problem here is that a Filter is ment to be agnostic of the datasource it is filtering on. At least that's how I understand it this far. I would require my filter code to be able to run calculations on the products it WILL filter on, and dynamically create the price ranges to filter on.

Is this possible to make this work with a Filter?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/11/2013 1:30:54 PM
   
RE:Product Filters, creating a price range filter
Create your own filter control. It should inherit CMSAbstractQueryFilterControl. Then what you do is place a Filter webpart on your page, set the url of the control you created(i.e.: ~/CustomFolder/filter.ascx) then add a datasource to the page and assign the filter control to the datasource.

Essentially in your custom filter control, you create the WhereCondition, SelectColumns, OrderBy, etc. and call the RaiseOnFilterChanged() event and it will filter the datasource based on the values set in the filter control.

I have good example of the code in this post

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 2/20/2013 7:16:45 PM
   
RE:Product Filters, creating a price range filter
Thanks for the nice and clear explanation and link to an interesting solution.
The custom filter is definitely the way to go for this aim.

Regards,
Zdenek