Attribute search

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!
Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

Attribute search

Post by Anshul Dua » 15 Mar 2018, 10:08

Hi Team, Here i wan to filter the product according to the attributes using JSON API. Can i list the attribute using attribute type? in

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

Re: Attribute search

Post by aimeos » 15 Mar 2018, 21:08

Yes, sure. Use a filter for "attribute.type.code":

Code: Select all

var params = {];

if( servicedesc.meta.prefix ) {
    params[servicedesc.meta.prefix] = {filter: {'==': {'attribute.type.code': 'mytype'}}};
} else {
    params = {filter: {'==': {'attribute.type.code': 'mytype'}}};
}
 
$.ajax({
    method: "GET",
    dataType: "json",
    url: servicedesc.meta.resources['attribute'], // returned from OPTIONS call
    data: params
}).done( function( result ) {
    console.log( result.data );
});
It's documented there:
Filtering: https://aimeos.org/docs/Developers/Clie ... the_result
Parameter nesting: https://aimeos.org/docs/Developers/Clie ... parameters
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

Re: Attribute search

Post by Anshul Dua » 16 Mar 2018, 06:13

I am using the JSONAPI. Where can i add this code?

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

Re: Attribute search

Post by aimeos » 16 Mar 2018, 09:01

In your client application that calls the JSON REST API server endpoints
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

Re: Attribute search

Post by Anshul Dua » 16 Mar 2018, 17:07

My issues are resolved. One more thing
Can i get the attribute list according to the attribute type. Because this will easier to filter the data and compare the attribute lable with my value.?
Currently I am using this API to list the attributes
http://localhost/jsonapi/attribute

Post Reply