Closed slaveykov closed 7 years ago
$response = $service->GetCategorySpecifics($request);
$specifications = [];
if (isset($response->Recommendations)) {
foreach($response->Recommendations[0]->NameRecommendation as $specific) {
$values = [];
foreach($specific->ValueRecommendation as $value) {
$values[] = $value->Value;
}
$specifications[] = [
'name' => $specific->Name,
'values' => $values
];
}
}
The above code should provide an array of item specifics like the example below.
[
[
'name' => 'Color',
'values' => ['Red', 'White', 'Blue']
],
[
'name' => 'Size',
'values' => ['S', 'M', 'L']
]
]
As a bonus the SDK supports JMESPath expressions. The below code will also produce the same array.
$response = $service->GetCategorySpecifics($request);
$specifications = $response->search('Recommendations[].NameRecommendation[].{name:Name, values: ValueRecommendation[].Value}');
Hello, i try to use category specifics but not response anything about specifics.