Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello,
I am working on filters to get products based on custom properties, but I got stuck on the size filter.
In VendrComponents class I added a new definition.
index.FieldDefinitionCollection.TryAdd(new FieldDefinition("sizes", FieldDefinitionTypes.FullText));
And here this definition is set. The product node has children of type 'ProductVariant', this type has a property 'Size'.
var sizes = product.Children.OfType<ProductVariant>().Select(x => x.Size.ToLower()).ToArray(); e.ValueSet.Set("sizes", sizes);
In the ProductSurfaceController I do this, but this is not working.
if (!string.IsNullOrEmpty(filter.Size)) { //query = query.And().Field("sizes", filter.Size); query = query.And().GroupedOr(new string[] { "sizes" }, new string[] { filter.Size }); }
It seems simple, but clearly need some help on this. 😎
Got it working already.
I had to save my sizes collection as a comma seperated list.
var sizes = product.Children.OfType<ProductVariant>().Select(x => x.Size.ToLower()); e.ValueSet.Set("sizes", string.Join(",", sizes));
The filtering.
query = query.And().GroupedOr(new string[] { "sizes" }, filter.Size.Split(','));
Nice work on getting it working 👍
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Examine contains filter
Hello,
I am working on filters to get products based on custom properties, but I got stuck on the size filter.
In VendrComponents class I added a new definition.
And here this definition is set. The product node has children of type 'ProductVariant', this type has a property 'Size'.
In the ProductSurfaceController I do this, but this is not working.
It seems simple, but clearly need some help on this. 😎
Got it working already.
I had to save my sizes collection as a comma seperated list.
The filtering.
Nice work on getting it working 👍
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.