Skip to content

Commit

Permalink
add image positions to shopware
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenmanz committed Mar 3, 2017
1 parent e0e460a commit 47b757c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public function handle(CommandInterface $command)

$images = [];

$position = 0;
foreach ($product->getImageIdentifiers() as $imageIdentifier) {
$imageIdentity = $identityService->findOneBy([
'objectIdentifier' => $imageIdentifier,
Expand All @@ -159,6 +160,7 @@ public function handle(CommandInterface $command)

$images[] = [
'mediaId' => $imageIdentity->getAdapterIdentifier(),
'position' => $position++,
];
}

Expand Down Expand Up @@ -740,6 +742,8 @@ private function getVariationData(Variation $variation, Product $product)
}

$images = [];
$position = 0;

foreach ($variation->getImageIdentifiers() as $imageIdentifier) {
$imageIdentity = $identityService->findOneBy([
'objectIdentifier' => $imageIdentifier,
Expand All @@ -751,7 +755,10 @@ private function getVariationData(Variation $variation, Product $product)
continue;
}

$images[] = ['mediaId' => $imageIdentity->getAdapterIdentifier()];
$images[] = [
'mediaId' => $imageIdentity->getAdapterIdentifier(),
'position' => $position++,
];
}

$shopwareVariation = [
Expand Down

0 comments on commit 47b757c

Please sign in to comment.