When applying a Range Filter, using the InRange extension method, the HasFilter property of the Filter is false and the actual filter doesn't apply. My code building the filter is below (x is a VariationContent with a property added called SalePrice, which populates with the price of the variant):
var minPrice = HttpContext.Current.Request.QueryString["price__min"] != null ? double.Parse(HttpContext.Current.Request.QueryString["price__min"]) : 0;
var maxPrice = HttpContext.Current.Request.QueryString["price__max"] != null ? double.Parse( HttpContext.Current.Request.QueryString["price__max"]) : double.MaxValue;
filter.And(x => (x.SalePrice.InRange(minPrice, maxPrice, true, true)));
I've checked the value of minPrice and maxPrice and in the example I'm using they're set at 250 and 399 respectively. Despite that, the result set I'm returned contains variants with a SalePrice of < 250.
Where am I going wrong??
are you actually assigning the value?
Assuming you have a variable named "filter", you should do
filter = filter.And(...)
Thanks for the reply. It was the one thing I was missing. I've even done it on all my other filters, how very frustrating!
No problem :-)