Get attributes bases on catalog

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!
traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Get attributes bases on catalog

Post by traiyani75 » 06 Nov 2020, 05:37

Hello,

We are using JSON API into mobile application. Now, we want to set filtering into products (mostly like flipkart and amazon). For that we want to get all attribute list based on catalog.
But, as per current document, Attribute API is returning all attributes into response. So, We cant use it at the moment.

Is there anyway through which we can get attribute list by catalog id (It means attributes which are used into particular catalog's products)

Thanks

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

Re: Get attributes bases on catalog

Post by aimeos » 07 Nov 2020, 08:50

Attributes are not assigned to categories but to products so you can't limit attributes to one or more categories. The solution is to fetch all attributes once and use the aggregation capability of the product endpoint to fetch the number of products for each attribute:
https://aimeos.org/docs/latest/frontend ... g-products

If the "attributes" value in the response is 1 or higher, display the attribute in the frontend, otherwise hide it.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply