Fetching attribute info, if I apply multiple filters in a single search criteria, it does not work. But in case of single filter it works perfectly.
Multiple filters HTTP request:
Output:
{
"items": [],
"search_criteria": {
"filter_groups": [
{
"filters": [
{
"field": "attribute_code",
"value": "size",
"condition_type": "eq"
},
{
"field": "attribute_code",
"value": "color",
"condition_type": "eq"
}
]
}
]
},
"total_count": 0
}
But when I hit the single filter one, I get results for both size as well as color.
Single filter:
UPDATE: Tried the in filter but still no results
{
"items": [],
"search_criteria": {
"filter_groups": [
{
"filters": [
{
"field": "attribute_code",
"value": "color,size",
"condition_type": "in"
}
]
}
]
},
"total_count": 0
}
UPDATE 2: Tried "in" in different filters
{
"items": [],
"search_criteria": {
"filter_groups": [
{
"filters": [
{
"field": "attribute_code",
"value": "color",
"condition_type": "in"
},
{
"field": "attribute_code",
"value": "size",
"condition_type": "in"
}
]
}
]
},
"total_count": 0
}
UPDATE 3: Tried "in" filter in separate filter groups
{
"items": [],
"search_criteria": {
"filter_groups": [
{
"filters": [
{
"field": "attribute_code",
"value": "color",
"condition_type": "in"
}
]
},
{
"filters": [
{
"field": "attribute_code",
"value": "size",
"condition_type": "in"
}
]
}
]
},
"total_count": 0
}
-
What is expected output and what you get?Alex Paliarush– Alex Paliarush2015年12月22日 11:31:59 +00:00Commented Dec 22, 2015 at 11:31
-
updated the questiondevdoe– devdoe2015年12月22日 11:33:19 +00:00Commented Dec 22, 2015 at 11:33
-
@AlexPaliarush did you find anything on this ?devdoe– devdoe2015年12月24日 09:56:12 +00:00Commented Dec 24, 2015 at 9:56
2 Answers 2
Here is the fix for the "in" problem, this will probably be fixed in next release: https://github.com/magento/magento2/commit/65819d2f61a63e4fa9fc978220f8662ee5472791
The problem seems to be that the same field is used in 2 filters of the same filter group. In this particular case replace 2 eq filters with one in filter:
searchCriteria[filter_groups][0][filters][0][field]=attribute_code&searchCriteria[filter_groups][0][filters][0][value]=color,size&searchCriteria[filter_groups][0][filters][0][condition_type]=in
-
I tried but still no results '{ "items": [], "search_criteria": { "filter_groups": [ { "filters": [ { "field": "attribute_code", "value": "color,size", "condition_type": "in" } ] } ] }, "total_count": 0 }'devdoe– devdoe2015年12月23日 06:03:28 +00:00Commented Dec 23, 2015 at 6:03
-
Request seems to be correct. What if specify separately 'in' filter with value 'color' and then value 'size'?Alex Paliarush– Alex Paliarush2015年12月24日 10:00:21 +00:00Commented Dec 24, 2015 at 10:00
-
Edited question with both the API responsedevdoe– devdoe2015年12月24日 11:57:16 +00:00Commented Dec 24, 2015 at 11:57
-
I meant
searchCriteria[filter_groups][0][filters][0][field]=attribute_code&searchCriteria[filter_groups][0][filters][0][value]=color&searchCriteria[filter_groups][0][filters][0][condition_type]=inAlex Paliarush– Alex Paliarush2015年12月24日 13:14:19 +00:00Commented Dec 24, 2015 at 13:14 -
1Not sure you can track internal tickets, but you can create a ticket here and put as a note that MAGETWO-47450 and MAGETWO-47451 are created internally.Alex Paliarush– Alex Paliarush2015年12月29日 10:50:31 +00:00Commented Dec 29, 2015 at 10:50
Explore related questions
See similar questions with these tags.