Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 3da3ae6

Browse files
committed
magento-engcom/import-export-improvements#33: add multi-select attribute filter support for product export
- make sure that the abstract entity class knows how to deal with multi select attributes - add finset attribute filter when type matches \Magento\ImportExport\Model\Export::FILTER_TYPE_MULTISELECT
1 parent 4f28878 commit 3da3ae6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,18 @@ protected function _prepareEntityCollection(\Magento\Eav\Model\Entity\Collection
277277
if (is_scalar($exportFilter[$attrCode]) && trim($exportFilter[$attrCode])) {
278278
$collection->addAttributeToFilter($attrCode, ['eq' => $exportFilter[$attrCode]]);
279279
}
280+
} elseif (\Magento\ImportExport\Model\Export::FILTER_TYPE_MULTISELECT == $attrFilterType) {
281+
if (is_array($exportFilter[$attrCode])) {
282+
array_filter($exportFilter[$attrCode]);
283+
if (!empty($exportFilter[$attrCode])) {
284+
foreach ($exportFilter[$attrCode] as $val) {
285+
$collection->addAttributeToFilter(
286+
$attrCode,
287+
['finset' => $val]
288+
);
289+
}
290+
}
291+
}
280292
} elseif (\Magento\ImportExport\Model\Export::FILTER_TYPE_INPUT == $attrFilterType) {
281293
if (is_scalar($exportFilter[$attrCode]) && trim($exportFilter[$attrCode])) {
282294
$collection->addAttributeToFilter($attrCode, ['like' => "%{$exportFilter[$attrCode]}%"]);

0 commit comments

Comments
 (0)