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
Hey Guys,
Does anybody know a way to query products on a custom property?
I'm trying to do the following, but it says GetProperty is not supported:
Product.All().FirstOrDefault(x => x["Slug"] != null && x["Slug"].Value == parsedProductSlug)
If I change it to the following it works:
Product.All().ToList().FirstOrDefault(x => x["Slug"] != null && x["Slug"].Value == parsedProductSlug)
However, I'd rather not load all products in to memory to do this.
Any ideas?
Cheers
Matt
I think Soren covers it here http://www.publicvoid.dk/QueryingProductsByCustomPropertiesInUCommerce.aspx
Jon
Thanks Jon,
Managed to get it down to this:
Product.All().FirstOrDefault(x => x.ProductProperties.Any(y => y.ProductDefinitionField.Name == "Slug" && y.Value == parsedProductSlug));
Moved my reply to own thread
http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/44998-Query-ProductsCategories-By-Custom-Properties-Efficiently
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Query products on custom property?
Hey Guys,
Does anybody know a way to query products on a custom property?
I'm trying to do the following, but it says GetProperty is not supported:
If I change it to the following it works:
However, I'd rather not load all products in to memory to do this.
Any ideas?
Cheers
Matt
I think Soren covers it here http://www.publicvoid.dk/QueryingProductsByCustomPropertiesInUCommerce.aspx
Jon
Thanks Jon,
Managed to get it down to this:
Moved my reply to own thread
http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/44998-Query-ProductsCategories-By-Custom-Properties-Efficiently
is working on a reply...