Skip to content

Commit

Permalink
Merge pull request #554 from akeneo/hotfix/PGTO-203
Browse files Browse the repository at this point in the history
hotfix/PGTO-203 into master
  • Loading branch information
Dnd-Gimix authored Mar 17, 2022
2 parents 5937315 + c1d5e43 commit b74a40c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,6 @@
### Version 102.5.0 :
* Add product status mode "Attribute mapping" in order to map a Yes/No attribute to the status attribute (https://help.akeneo.com/magento2-connector/articles/05-configure-products.html#attribute-mapping-for-status)
* Use "is_root" Akeneo API parameter for category endpoint in order to generate options for the category import configuration in the admin page

### Version 102.5.1 :
* Fix every family being fetched while using IN family search with advanced filter mode
29 changes: 7 additions & 22 deletions Helper/ProductFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ public function getFilters($jobExecutor, $productFamily = null, $isProductModel
$filters = [];
/** @var mixed[] $search */
$search = [];
/** @var $productFilterAdded */
$productFilterAdded = false;
/** @var string $mode */
$mode = $this->configHelper->getFilterMode();
if ($mode == Mode::ADVANCED) {
Expand All @@ -133,25 +131,11 @@ public function getFilters($jobExecutor, $productFamily = null, $isProductModel
// If product import gave a family, add it to the filter
if ($productFamily) {
if (isset($advancedFilters['search']['family'])) {
/**
* @var int $key
* @var string[] $familyFilter
*/
foreach ($advancedFilters['search']['family'] as $key => $familyFilter) {
if (isset($familyFilter['operator']) && $familyFilter['operator'] == 'IN') {
$advancedFilters['search']['family'][$key]['value'][] = $productFamily;
$productFilterAdded = true;

break;
}
}
}

if (!$productFilterAdded) {
/** @var string[] $familyFilter */
$familyFilter = ['operator' => 'IN', 'value' => [$productFamily]];
$advancedFilters['search']['family'][] = $familyFilter;
unset($advancedFilters['search']['family']);
}
/** @var string[] $familyFilter */
$familyFilter = ['operator' => 'IN', 'value' => [$productFamily]];
$advancedFilters['search']['family'][] = $familyFilter;
}

return [$advancedFilters];
Expand All @@ -171,6 +155,9 @@ public function getFilters($jobExecutor, $productFamily = null, $isProductModel
$search['family'][] = $familyFilter;
}

/** @var string[] $akeneoLocales */
$akeneoLocales = $this->localesHelper->getAkeneoLocales();

/** @var string $channel */
foreach ($mappedChannels as $channel) {
/** @var string[] $filter */
Expand All @@ -197,8 +184,6 @@ public function getFilters($jobExecutor, $productFamily = null, $isProductModel
/** @var string[] $locales */
$locales = $this->storeHelper->getChannelStoreLangs($channel);
if (!empty($locales)) {
/** @var string $locales */
$akeneoLocales = $this->localesHelper->getAkeneoLocales();
if (!empty($akeneoLocales)) {
$locales = array_intersect($locales, $akeneoLocales);
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"http-interop/http-factory-guzzle": "^1.0"
},
"type": "magento2-module",
"version": "102.5.0",
"version": "102.5.1",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down

0 comments on commit b74a40c

Please sign in to comment.