Questions about facets

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
matish
Posts: 18
Joined: 04 Nov 2025, 11:52

Questions about facets

Post by matish » 22 Nov 2025, 22:22

I am trying to figure out how facets work over the API.
In general they work, but I would like to limit the facet options that are applicable to the subselection of products.

How can I achieve that?
Now I am using a query, which returns 6 products out of 13 products:

Code: Select all

https://aimeos.priit.yt.lan/jsonapi/product?include=attribute%2Cmedia%2Cprice%2Cproduct%2Cproduct%2Fproperty%2Ctext%2Ccatalog%2Csupplier%2Cstock%2Cproperty%2Cproduct%2Fproperty%2Ftype%2Cattribute%2Ftype&page%5Blimit%5D=6&page%5Boffset%5D=0
This query result returns me under 'included' the attributes that are visible on this image:
Image

The problem is that there are more facets available on the next page (such as Manufacturer = HP and so on...).
How can I get full list of available facets that take into account all the filters but exclude paging?


That one I resolved with aggregation (http://localhost:8000/jsonapi/product?aggregate=index.attribute.id)
Last edited by matish on 24 Nov 2025, 08:58, edited 1 time in total.

User avatar
matish
Posts: 18
Joined: 04 Nov 2025, 11:52

Re: Questions about facets

Post by matish » 22 Nov 2025, 23:50

Another thing that came up:
Consider the following query:

Code: Select all

https://aimeos.priit.yt.lan/jsonapi/product?include=attribute,media,price,product,product/property,text,catalog,supplier,stock,property,product/property/type,attribute/type
&page[limit]=6
&page[offset]=0
&filter[f_optid][0]=14
&filter[f_optid][1]=11
&filter[f_optid][2]=16
&filter[f_optid][3]=17
Here are the explanations for each attribute ID:

Code: Select all

14 = color.black
11 = color.white
16 = manufacturer.dell
17 = manufacturer.hp
I would like to select all results where (manufacturer.dell OR manufacturer.hp) AND (color.white OR color.black).
How can I make a query that would achieve that? The query that I have above does not have AND condition in the middle.

User avatar
aimeos
Administrator
Posts: 8675
Joined: 01 Jan 1970, 00:00

Re: Questions about facets

Post by aimeos » 24 Nov 2025, 08:59

matish wrote: 22 Nov 2025, 23:50 I would like to select all results where (manufacturer.dell OR manufacturer.hp) AND (color.white OR color.black).
How can I make a query that would achieve that? The query that I have above does not have AND condition in the middle.
Use "f_oneid" instead:
https://aimeos.org/docs/latest/frontend ... attributes
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
matish
Posts: 18
Joined: 04 Nov 2025, 11:52

Re: Questions about facets

Post by matish » 24 Nov 2025, 13:48

I did try with that, but that one seems to result in a query:

Code: Select all

where (manufacturer.dell OR manufacturer.hp) OR (color.white OR color.black).
But I need:

Code: Select all

where (manufacturer.dell OR manufacturer.hp) AND (color.white OR color.black).

User avatar
aimeos
Administrator
Posts: 8675
Joined: 01 Jan 1970, 00:00

Re: Questions about facets

Post by aimeos » 24 Nov 2025, 13:53

Please have a look at the linked documentation. The f_oneid requires a different filter structure:

Code: Select all

filter[f_oneid][color][]=...
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
matish
Posts: 18
Joined: 04 Nov 2025, 11:52

Re: Questions about facets

Post by matish » 25 Nov 2025, 06:48

aimeos wrote: 24 Nov 2025, 13:53 Please have a look at the linked documentation. The f_oneid requires a different filter structure:

Code: Select all

filter[f_oneid][color][]=...

Sorry about the confusion. I took another look and got it working now. Thanks!

Code: Select all

https://aimeos.priit.yt.lan/jsonapi/product
?include=attribute,media,price,product,product/property,text,catalog,supplier,stock,property,product/property/type,attribute/type
&page[limit]=6
&page[offset]=0
&filter[f_oneid][color][0]=13
&filter[f_oneid][vendor][0]=16
&filter[f_oneid][vendor][1]=17

User avatar
matish
Posts: 18
Joined: 04 Nov 2025, 11:52

Re: Questions about facets

Post by matish » 25 Nov 2025, 08:41

I would like to use min-price...max-price facet too. Is it possible to know what is the minimum and maximum price for the current subselection of products excluding paging?

Post Reply