Skip to content

Commit

Permalink
Merge pull request #17 from spryker-eco/bugfix/eco-2519-endless-loop-…
Browse files Browse the repository at this point in the history
…when-importing-product

Fix endless loop
  • Loading branch information
alex-galych authored Feb 27, 2019
2 parents 5d5d061 + 5d2e136 commit 6808263
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function translate($value, array $payload)
{
$this->initAttributeOptionMap();

foreach ($value as $attributeKey => &$attributeValues) {
foreach ($value as $attributeKey => $attributeValues) {
if ($this->isKeySkipped($attributeKey)) {
unset($value[$attributeKey]);
continue;
Expand All @@ -77,7 +77,7 @@ public function translate($value, array $payload)

$isAttributeLocalizable = $this->isAttributeLocalizable($attributeKey);

foreach ($attributeValues as &$attributeValue) {
foreach ($attributeValues as $index => $attributeValue) {
$attributeData = $attributeValue[static::KEY_DATA];
$locale = $attributeValue[static::KEY_LOCALE];

Expand All @@ -86,18 +86,14 @@ public function translate($value, array $payload)
continue 2;
}

// if (count($attributeData) === 0) {
// continue;
// }

if ($isAttributeLocalizable) {
$options = is_array($attributeData) ? $this->getArrayOptions($attributeKey, $attributeData) : $this->getOptions($attributeKey, $attributeData);
if (!array_key_exists($locale, $options)) {
unset($value[$attributeKey]);
continue;
}

$attributeValue[static::KEY_DATA] = $options[$locale];
$value[$attributeKey][$index][static::KEY_DATA] = $options[$locale];
continue;
}

Expand Down

0 comments on commit 6808263

Please sign in to comment.