Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Export/Data/Entity/ProductEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public function getProductNumber(): string
return $this->product->getProductNumber();
}

public function getProductName(): string
{
return (string) $this->product->getTranslation('name');
}

public function getFilterAttributes(): string
{
return $this->filterAttributes;
Expand Down Expand Up @@ -100,7 +105,7 @@ public function toArray(): array
$defaultFields = [
'ProductNumber' => $this->product->getProductNumber(),
'Master' => $isVariant ? $this->parent->getProductNumber() : $this->product->getProductNumber(),
'Name' => (string) $this->product->getTranslation('name'),
'Name' => $this->getProductName(),
'FilterAttributes' => $this->getFilterAttributes(),
'CustomFields' => $this->getCustomFields(),
];
Expand Down
1 change: 1 addition & 0 deletions src/Export/Data/Entity/ProductEntityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
interface ProductEntityInterface
{
public function getProductNumber(): string;
public function getProductName(): string;
}
7 changes: 6 additions & 1 deletion src/Export/Data/Entity/VariantEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ public function getProductNumber(): string
return $this->product->getProductNumber();
}

public function getProductName(): string
{
return $this->product->getTranslation('name') ? (string) $this->product->getTranslation('name') : $this->parentData['Name'];
}

public function toArray(): array
{
$opts = '|' . implode('|', map($this->propertyFormatter, $this->product->getOptions()->getElements())) . '|';
return array_reduce($this->variantFields, fn (array $fields, FieldInterface $field): array => [$field->getName() => $field->getValue($this->product)] + $fields, ['ProductNumber' => $this->product->getProductNumber(), 'FilterAttributes' => $opts] + $this->parentData);
return array_reduce($this->variantFields, fn (array $fields, FieldInterface $field): array => [$field->getName() => $field->getValue($this->product)] + $fields, ['ProductNumber' => $this->product->getProductNumber(), 'Name' => $this->getProductName(), 'FilterAttributes' => $opts] + $this->parentData);
}
}
1 change: 1 addition & 0 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
</parameter>
<parameter key="factfinder.export.associations" type="collection">
<parameter key="variant_cover">children.media</parameter>
<parameter key="variant_translations">children.translations</parameter>
</parameter>
<parameter key="factfinder.navigation.category_path_field_name" type="string">CategoryPath</parameter>
<parameter key="factfinder.category_page.add_params" type="collection">
Expand Down