Shopware6: improvements and fixed regarding property-groups

This commit is contained in:
Andreas Palm 2023-10-09 23:32:49 +02:00
parent 85c699f5ee
commit d39f9bb2fe

View File

@ -1372,8 +1372,7 @@ class Shopimporter_Shopware6 extends ShopimporterBase
*/ */
protected function mediaToExport($internalArticleData, $articleIdShopware) protected function mediaToExport($internalArticleData, $articleIdShopware)
{ {
$mediaToAdd = [ $mediaToAdd = [];
];
if (empty($internalArticleData['Dateien'])) { if (empty($internalArticleData['Dateien'])) {
return $mediaToAdd; return $mediaToAdd;
@ -1846,7 +1845,6 @@ class Shopimporter_Shopware6 extends ShopimporterBase
protected function createPropertyOption($propertyGroupId, $propertyOptionName): ?string protected function createPropertyOption($propertyGroupId, $propertyOptionName): ?string
{ {
$propertyOptionData = [ $propertyOptionData = [
'id' => '',
'name' => $propertyOptionName 'name' => $propertyOptionName
]; ];
$createdPropertyOption = $this->shopwareRequest( $createdPropertyOption = $this->shopwareRequest(
@ -1901,13 +1899,7 @@ class Shopimporter_Shopware6 extends ShopimporterBase
if (empty($countryIsoToPropertyTranslation['DE'])) { if (empty($countryIsoToPropertyTranslation['DE'])) {
continue; continue;
} }
$propertyGroupId = '';
if (array_key_exists($propertyDefaultName, $this->knownPropertyGroupIds)) {
$propertyGroupId = $this->knownPropertyGroupIds[$propertyDefaultName];
}
if (empty($propertyGroupId)) {
$propertyGroupId = $this->getPropertyGroupId($propertyDefaultName); $propertyGroupId = $this->getPropertyGroupId($propertyDefaultName);
}
if (empty($propertyGroupId)) { if (empty($propertyGroupId)) {
$propertyGroupId = $this->createPropertyGroup($propertyDefaultName); $propertyGroupId = $this->createPropertyGroup($propertyDefaultName);
} }
@ -2684,15 +2676,10 @@ class Shopimporter_Shopware6 extends ShopimporterBase
if (empty($article['matrix_varianten']) || empty($articleIdShopware)) { if (empty($article['matrix_varianten']) || empty($articleIdShopware)) {
return false; return false;
} }
$headerInformation = ['sw-language-id: ' . $languageId];
$internalGroupPropertiesToShopwareId = []; $internalGroupPropertiesToShopwareId = [];
foreach ($article['matrix_varianten']['gruppen'] as $propertyGroupName => $internalPropertyGroupValues) { foreach ($article['matrix_varianten']['gruppen'] as $propertyGroupName => $internalPropertyGroupValues) {
$propertyGroupId = '';
if (array_key_exists($propertyGroupName, $this->knownPropertyGroupIds)) {
$propertyGroupId = $this->knownPropertyGroupIds[$propertyGroupName];
}
if (empty($propertyGroupId)) {
$propertyGroupId = $this->getPropertyGroupId($propertyGroupName); $propertyGroupId = $this->getPropertyGroupId($propertyGroupName);
}
if (empty($propertyGroupId)) { if (empty($propertyGroupId)) {
$propertyGroupId = $this->createPropertyGroup($propertyGroupName); $propertyGroupId = $this->createPropertyGroup($propertyGroupName);
} }
@ -2713,8 +2700,6 @@ class Shopimporter_Shopware6 extends ShopimporterBase
} }
} }
$languageId = $this->getLanguageIdByCountryIso('DE');
$headerInformation = ['sw-language-id: ' . $languageId];
$shopwarePropertyGroupOptions = $this->shopwareRequest( $shopwarePropertyGroupOptions = $this->shopwareRequest(
'GET', 'GET',
'property-group/' . $propertyGroupId . '/options?limit=100', 'property-group/' . $propertyGroupId . '/options?limit=100',