From 3c09fda43fe5a61b15e4a81acd36b11114a63539 Mon Sep 17 00:00:00 2001 From: "michael.danielczok" <michael@pcsg.de> Date: Wed, 30 Sep 2020 09:19:22 +0200 Subject: [PATCH] fix: Cleanup duplicated fields id. --- ajax/categories/getFields.php | 6 +++++- src/QUI/ERP/Products/Utils/Search.php | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ajax/categories/getFields.php b/ajax/categories/getFields.php index c7482c0b..257b0c43 100644 --- a/ajax/categories/getFields.php +++ b/ajax/categories/getFields.php @@ -33,9 +33,13 @@ function ($categoryIds) { // cleanup /* @var $Field QUI\ERP\Products\Field\Field */ + $isset = []; + foreach ($fields as $Field) { - if (!isset($results[$Field->getId()])) { + if (!isset($isset[$Field->getId()])) { $result[] = $Field->getAttributes(); + + $isset[$Field->getId()] = true; } } diff --git a/src/QUI/ERP/Products/Utils/Search.php b/src/QUI/ERP/Products/Utils/Search.php index f4d7971a..dbc49065 100644 --- a/src/QUI/ERP/Products/Utils/Search.php +++ b/src/QUI/ERP/Products/Utils/Search.php @@ -146,6 +146,7 @@ public static function getDefaultFrontendFields() if ($defaultIds) { $defaultIds = \explode(',', $defaultIds); + $defaultIds = \array_unique($defaultIds); foreach ($defaultIds as $fieldId) { try { @@ -178,6 +179,7 @@ public static function getDefaultFrontendFreeTextFields() if ($defaultIds) { $defaultIds = \explode(',', $defaultIds); + $defaultIds = \array_unique($defaultIds); foreach ($defaultIds as $fieldId) { try { -- GitLab