I am trying to get the Filter Values for a specific product. I want to show them as product features on the product detail page. For some reason I just can't figure out a way to get them.
Maybe you (or anybody else) can point me in the right direction?
FYI: I am using Umbraco 7.5.11, Merchello 2.5 and FastTrack 2.5
Hey Puck - I don't think I quite understand what you are saying here...
Filters are basically specialized (abstracted) collections. So you can do things like - "previously owned" books - where previously owned would be the filter.
Are you saying you want to display (in this case a book) and have a label stating "previously owned" ?
For example: as you can see in the Image, i have a tv. Where the filter groups are things like Beeldschermdiagonaal (screen size), and the 40 inch is the specified filter for this tv.
I want to get the list of filters for a specific product, so i can show them in a way like it is shown in the image.
Fitlergroup: specified filter
Filtergroup2: specified filter2
Filtergroup3: specified filter3
First i used
var filters = helper.Filters.Product.GetFilterGroupsContainingProduct(Model.Key);
But this only gives me the groups containing that product, with all the filters inside those groups. And I need to know which filters are specified for that product.
I want to use the filters to search for the products, but also show the specified filters on the product detail page. Just as extra information about the product.
That's why I am asking about the filters, because that way I can kill 2 birds with one stone.
In the product overview i want to use the filters as a way to filter the products list, and when i go to a specific product, I want to show them as specifications/features for that product.
If it isn't possible to get the specified filters for a product at this time, I have to find some other way to do it :)
We also have this requirement and since the selected filters of a product are shown in the back-office, I tracked down the request that returned the correct data: /umbraco/backoffice/Merchello/EntityCollectionApi/PostGetEntityCollectionsByEntity. The filter groups have a parentKey that is null, so you would have to build the group/filters relations based on this parent/child relation...
Looking at the source code for this controller action, the data is retrieved the following way:
However, the GetCollectionsContaining() is internal, like Rusty already said...
For now, you could initialize the EntityCollectionApiController and call the PostGetEntityCollectionsByEntity() action manually (here's how), use reflection to get to the internal methods or copy all required code to your own project :-(
@Rusty: Could this functionality be added to the public API's and if so, should I create an GitHub issue for this?
Getting filter values for specific product
Hi Rusty,
I am trying to get the Filter Values for a specific product. I want to show them as product features on the product detail page. For some reason I just can't figure out a way to get them.
Maybe you (or anybody else) can point me in the right direction?
FYI: I am using Umbraco 7.5.11, Merchello 2.5 and FastTrack 2.5
Thanks!
Hey Puck - I don't think I quite understand what you are saying here...
Filters are basically specialized (abstracted) collections. So you can do things like - "previously owned" books - where previously owned would be the filter.
Are you saying you want to display (in this case a book) and have a label stating "previously owned" ?
Hi Rusty,
I will try to explain it a bit better.
For example: as you can see in the Image, i have a tv. Where the filter groups are things like Beeldschermdiagonaal (screen size), and the 40 inch is the specified filter for this tv.
I want to get the list of filters for a specific product, so i can show them in a way like it is shown in the image.
First i used
But this only gives me the groups containing that product, with all the filters inside those groups. And I need to know which filters are specified for that product.
I hope you understand this a bit better!
Thanks
Hey Puck - unless you are intending to search for products with a Smart TV filter with a value of Ja I'd say you probably don't want to use a filter.
I think I might add an Umbraco checkbox list (or a custom data type if you need more control) to select the different options.
Hi Rusty,
I want to use the filters to search for the products, but also show the specified filters on the product detail page. Just as extra information about the product. That's why I am asking about the filters, because that way I can kill 2 birds with one stone.
In the product overview i want to use the filters as a way to filter the products list, and when i go to a specific product, I want to show them as specifications/features for that product.
If it isn't possible to get the specified filters for a product at this time, I have to find some other way to do it :)
Thanks
Unfortunately you will be fighting a few
internal
methods get this done directly.Damn okay.. I will try to find a workaround for this, thanks anyway!
We also have this requirement and since the selected filters of a product are shown in the back-office, I tracked down the request that returned the correct data:
/umbraco/backoffice/Merchello/EntityCollectionApi/PostGetEntityCollectionsByEntity
. The filter groups have aparentKey
that isnull
, so you would have to build the group/filters relations based on this parent/child relation...Looking at the source code for this controller action, the data is retrieved the following way:
However, the
GetCollectionsContaining()
isinternal
, like Rusty already said...For now, you could initialize the
EntityCollectionApiController
and call thePostGetEntityCollectionsByEntity()
action manually (here's how), use reflection to get to the internal methods or copy all required code to your own project :-(@Rusty: Could this functionality be added to the public API's and if so, should I create an GitHub issue for this?
We're also looking at getting filter values in a similar way and hitting the same issues.
@Rusty - Is it possible for this to be done like the way Ronald suggests or is this not how filters are intended to be used?
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.