Skip to content

Commit

Permalink
MAGETWO-64403: [GitHub] [PR] Sorting the returning array by the posit…
Browse files Browse the repository at this point in the history
…ion of the linked products. Fix for magento2/issues/8392 #8467

 - Merge Pull Request #8467 from kirashet666/magento2:develop
  • Loading branch information
Oleksii Korshenko committed Feb 20, 2017
2 parents c7fff61 + 0002f6d commit 168701c
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,21 @@ public function getCollection(\Magento\Catalog\Model\Product $product, $type)
$products = $this->providers[$type]->getLinkedProducts($product);
$converter = $this->converterPool->getConverter($type);
$output = [];
$realoutput = [];
foreach ($products as $item) {
$output[$item->getId()] = $converter->convert($item);
}
return $output;
foreach ($output as $item) {
$itemPosition = $item["position"];
if (!isset($realoutput[$itemPosition])) {
$realoutput[$itemPosition] = $item;
}
else {
$newPosition = $itemPosition+1;
$realoutput[$newPosition] = $item;
}
}
ksort($realoutput);
return $realoutput;
}
}

0 comments on commit 168701c

Please sign in to comment.