Deduplicate limited backoffice price products
This commit is contained in:
@@ -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),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user