Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach ($item->getCustomAttributes() as $attribute)
- /**
- * @param SearchResultInterface $searchResult
- * @return array
- */
- protected function searchResultToOutput(SearchResultInterface $searchResult)
- {
- $arrItems = [];
- $arrItems['items'] = [];
- foreach ($searchResult->getItems() as $item) {
- $itemData = [];
- /* THROWS ERROR foreach ($item->getCustomAttributes() as $attribute) {
- $itemData[$attribute->getAttributeCode()] = $attribute->getValue();
- } */
- $arrItems['items'][] = $itemData;
- }
- $arrItems['totalRecords'] = $searchResult->getTotalCount();
- return $arrItems;
- }
Add Comment
Please, Sign In to add comment