Skip to content

Commit

Permalink
Refactor filtering on status for product feed export
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin-Magmodules committed Mar 3, 2022
1 parent 5247a3f commit 60536e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
11 changes: 1 addition & 10 deletions Helper/Source.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -418,17 +418,8 @@ public function getProductFilters($type)
if ($visibilityFilter) {
$visibility = $this->getStoreValue(self::XPATH_VISIBILITY_OPTIONS);
$filters['visibility'] = explode(',', $visibility);
$filters['visibility_parents'] = $filters['visibility'];
} else {
$filters['visibility'] = [
Visibility::VISIBILITY_IN_CATALOG,
Visibility::VISIBILITY_IN_SEARCH,
Visibility::VISIBILITY_BOTH,
];
$filters['visibility_parents'] = $filters['visibility'];
if (!empty($filters['relations'])) {
array_push($filters['visibility'], Visibility::VISIBILITY_NOT_VISIBLE);
}
$filters['visibility'] = [];
}

$filters['limit'] = preg_replace('/\D/', '', $this->getStoreValue(self::XPATH_LIMIT));
Expand Down
4 changes: 2 additions & 2 deletions Model/Collection/Products.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ public function getParents($parentRelations, $config)
}
}

if (!empty($filters['visibility_parent'])) {
$collection->addAttributeToFilter('visibility', ['in' => $filters['visibility_parent']]);
if (!empty($filters['visibility'])) {
$collection->addAttributeToFilter('visibility', ['in' => $filters['visibility']]);
}

if (!empty($config['inventory']['attributes'])) {
Expand Down

0 comments on commit 60536e8

Please sign in to comment.