Skip to content

Commit b8ac30d

Browse files
authored
Revert "Removed default value for new connector (#44)" (#47)
This reverts commit b7c821a.
1 parent cf7d5f3 commit b8ac30d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Helper/Import/Product.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ protected function getColumnsFromResult(array $result, array $keys = []): array
1616
return $mappedResult;
1717
}
1818

19+
$adminChannel = $this->scopeConfig->getValue('akeneo_connector/akeneo_api/admin_channel');
20+
21+
$defaultLanguage = $this->scopeConfig->getValue('akeneo_connector/justbetter/defaultlanguage');
22+
1923
$requiredAttributes = $this->getRequiredAttributes();
2024

2125
foreach ($requiredAttributes as $requiredAttribute) {
@@ -28,6 +32,10 @@ protected function getColumnsFromResult(array $result, array $keys = []): array
2832
continue;
2933
}
3034

35+
if (!array_key_exists($requiredAttribute.'-'.$defaultLanguage.'-'.$adminChannel, $mappedResult) && $defaultLanguage) {
36+
$mappedResult[$requiredAttribute.'-'.$defaultLanguage.'-'.$adminChannel] = $this->getFirstValue($result['values'][$requiredAttribute]);
37+
}
38+
3139
$mappedResult[$requiredAttribute] = $this->getFirstValue($result['values'][$requiredAttribute]);
3240
}
3341

etc/adminhtml/system.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@
129129
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
130130
<comment>Set the value on the default store for required attributes that are scopable or localizable. (Default no)</comment>
131131
</field>
132+
<field id="defaultlanguage" translate="label" type="text" sortOrder="155" showInDefault="1" showInWebsite="0"
133+
showInStore="0">
134+
<label>Default language for admin channel</label>
135+
<comment>If a value of the admin channel is missing, then this setting can be used to map a certain value as your definitive fallback value for a required attribute for example 'nl_NL'
136+
</comment>
137+
<depends>
138+
<field id="akeneo_connector/justbetter/defaultstorevalues">1</field>
139+
</depends>
140+
</field>
132141
<group id="slack" translate="label" type="text" sortOrder="160" showInDefault="1" showInWebsite="0"
133142
showInStore="0">
134143
<label>Slack Akeneo import notifications</label>

0 commit comments

Comments
 (0)