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
6 changes: 1 addition & 5 deletions src/Export/ExportProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(SalesChannelRepository $productRepository, array $cu
$this->customAssociations = $customAssociations;
}

public function getByContext(SalesChannelContext $context, int $batchSize = 100): iterable
public function getByContext(SalesChannelContext $context, int $batchSize = 1): iterable
{
$criteria = $this->getCriteria($batchSize);
$products = $this->productRepository->search($criteria, $context);
Expand All @@ -46,7 +46,6 @@ private function getCriteria(int $batchSize): Criteria
$criteria->addAssociation('categories');
$criteria->addAssociation('categoriesRo');
$criteria->addAssociation('children.options.group');
$criteria->addAssociation('children.properties.group');
$criteria->addAssociation('manufacturer');
$criteria->addAssociation('properties');
$criteria->addAssociation('customFields');
Expand All @@ -58,9 +57,6 @@ private function getCriteria(int $batchSize): Criteria
}
$criteria->addFilter(new EqualsFilter('parentId', null));

$criteria->getAssociation('children')
->addFilter(new EqualsFilter('active', true));

return $criteria;
}
}
12 changes: 4 additions & 8 deletions src/Export/Field/FilterAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ public function getName(): string
*/
public function getValue(Entity $entity): string
{
$attributes = array_map($this->propertyFormatter, $this->applyPropertyGroupsFilter($entity));

if ($entity->getChildren()) {
$attributes = $entity->getChildren()->reduce(
fn (array $result, Product $child): array => $result + array_map($this->propertyFormatter, $child->getOptions()->getElements()),
$attributes
);
}
$attributes = $entity->getChildren()->reduce(
fn (array $result, Product $child): array => $result + array_map($this->propertyFormatter, $child->getOptions()->getElements()),
array_map($this->propertyFormatter, $this->applyPropertyGroupsFilter($entity))
);

return $attributes ? '|' . implode('|', array_values($attributes)) . '|' : '';
}
Expand Down
1 change: 0 additions & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@
<tag name="factfinder.export.variant_field"/>
</service>
<service id="Omikron\FactFinder\Shopware6\Export\Field\FilterAttributes">
<tag name="factfinder.export.variant_field"/>
<tag name="factfinder.export.cached_product_entity"/>
</service>
<service id="Omikron\FactFinder\Shopware6\Api\UiFeedExportController" />
Expand Down