Deduplicate limited backoffice price products

This commit is contained in:
Jeppe Bundgaard
2026-07-06 16:28:08 +02:00
parent f262047476
commit d9eacf6f84
2 changed files with 84 additions and 1 deletions
@@ -869,9 +869,15 @@ class limited_backoffice_service
$categories = [];
$missing = [];
$requiredProductIds = [];
$seenProductIds = [];
foreach ($rows as $row) {
$categoryId = (int)$row['category_id'];
$productId = (int)$row['product_id'];
if (isset($seenProductIds[$productId])) {
continue;
}
$seenProductIds[$productId] = true;
$requiredProductIds[] = $productId;
if (!isset($categories[$categoryId])) {
@@ -911,7 +917,7 @@ class limited_backoffice_service
return [
'categories' => array_values($categories),
'missing_products' => $missing,
'required_product_ids' => array_values(array_unique($requiredProductIds)),
'required_product_ids' => array_values($requiredProductIds),
];
}